error laravel 5 undefined variable

controller public function index() { $meetingData = Newsnotice::news(); $meetingData=json_decode(json_encode($meetingData),true); return view('index',$meetingData); }

in view file index.blade.php echo'<pre>'; print_r($meetingData);

error Undefined variable: meetingData (View: C:\xampp\htdocs\lara_wcd_pension\resources\views\index.blade.php)

phpspider replied 1 year ago

use return view('index',array(meetingData"=>$meetingData)); OR return view('index',compact($meetingData));

AddWebSolution replied 1 year ago


public function index() 
	$meetingData = Newsnotice::news(); 
	$meetingData = json_decode(json_encode($meetingData),true); 
	return view('index', compact('meetingData'));

Sign in to participate in this thread!

We'd like to thank these amazing companies for supporting us