今日はlaravel
においてview
ファイルへの引数の渡し方について記録していくよ~
TestController.php
public function test(){
$data1 = 1;
$data2 = 2;
return view('test_view' , ['data1' => $data1 , 'data2' => $data2 ]);
}//1 2
compact
関数を使って同じ出力になる書き方:
TestController.php
public function test(){
$data1 = 1;
$data2 = 2;
return view('test_view' , compact('data1' , 'data2'));
}//1 2
以上だよお~