At the moment in my controller I am doing the following
$clients = Client::lists('clientName');
dd($clients);
The above outputs an array as expected
Collection {#182 ▼
#items: array:3 [▼
0 => "John Dandy"
1 => "Jane Doe"
2 => "Nicholas"
]
}
So I continue to pass this data to my view
return View::make('projects.create', compact('clients'));
So I know clients contains data as confirmed by the dd dump. However, in my view, if I do {!! $clients !!}
, I get the error
FatalErrorException in 887e98b93946af76e5541ac7ae310735 line 49: syntax error, unexpected 'null' (T_STRING)
Why is this happening?
It is a collection, so you cannot directly display it. The following might do :)
@foreach($clients as $client)
{{ $client }}
@endforech