Reputation: 2141
I am new to laravel. I am trying send an array to my view but I am getting the following exception
ErrorException in LandingPagesController.php line 26: Use of undefined constant data - assumed 'data'
My controller is looking like this
public function index($param)
{
$data = LandingPage::where('LandingPage','=',$param)->first();
var_dump($data->landingpage);
return view('lp', compact(data));
}
my view looks like
@if ( $data )
no data
@else
do stuff...
@endif
the var_dump is printing in the screen string 'tests' (length=5) so I know that data has something otherwise will not print, so i dont understand what I am doing wrong
Upvotes: 0
Views: 412