mercredi 16 mars 2016

Laravel Accessing Array Data In View

I know I am very close, I'm just stuck and can't figure out this last step.

I'm trying to echo out some information in my blade template, but I'm getting the following error: Undefined property: Illuminate\Database\Eloquent\Collection::$Moniker

Here is my controller, which returns the $data variable to the view:

$user = User::where('id', $request)->get();
$data = array(
    'images'  => $images,
    'user'   => $user
);
return view('a_profile')->with('data', $data);  

Here is my view:

<title>{{$data['user']->Moniker}} | My Company | Baltimore, MD</title>

How do I get the Moniker which is a column in my users table to echo out, in this case? Thank you! :)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire