I've been trying to get variables for several views for a long time. Basically what I need is to do this:
class VarComposers
{
public function compose(View $view ){
$user = '555';
$view->with('user', $user);
}
} //class
But with the data I get here:
public function login(Request $request){
$client = new Client();
$this->validate($request, [
'email' => 'email|required',
'password' => 'min:3|max:100',
]);
$response = $client->post("http://localhost:8000/v1/login", [
'headers' => ['foo' => 'bar'],
'json' => [
'email' => $request['email'],
'password' => $request['password'],
]
]);
$user = json_decode( $response->getBody()->getContents() );
return view('pages.home', compact('user'));
}
I do not know if I make myself understood, but I hope someone can help me.