Reputation: 319
With Laravel, I'm returning data from controller to blade. How to access to datesValid value in blade directly? I want to print the value in that case true.
Controller code:
if (empty($source)) {
return ["recordsTotal" => 0, "recordsFiltered" => 0, 'data' => [], 'datesValid' => $datesValid];
} else {
return ["recordsTotal" => $source['count'][0]['count'], "recordsFiltered" => $source['count'][0]['count'], 'data' => $source['result'], 'datesValid' => $datesValid ];
}
Upvotes: 0
Views: 1622
Reputation: 2022
please take a look on this: laravel blade
if from controller you are sending it like this:
return view('x', ['result' => $result]);
and result is an object containing these data. So you can do:
{{$result->datesValid}}
if it is an array so you can do:
{{$result['datesValid']}}
Upvotes: 2