I am trying to have available across the system a parameter i bring from another integrated system, inside my dashboard controller i get that parameter , so i can print the parameter before entering middleware. inside middleware I get error " undefined variable body "
use GuzzleHttp\Client;
use Session;
class dashboardController extends Controller
{
protected $body;
protected $valor;
public function __construct(){
$url = 'http://ift.tt/2uMQCba';
$client = new Client(); //GuzzleHttp\Client
$result = $client->get($url);
$body = $result->getBody();
echo $body; <--- when i print $body here I can see the value.
$this->middleware(function($request, $next) {
$this->valor = $request->session()->put('responsable', $body); <-- null here
return $next($request);
});
}
Then I want this session parameter available for my other constructs, how can i do this, i'm not using laravel auth. i log in using an integrated system and pass the username. that's what im checking against.
Thanks in advance!
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2v5RLWH
via IFTTT
Aucun commentaire:
Enregistrer un commentaire