如何将值从控制器内部的函数传递到render()?
例如:
class NewClass extends Component
{
// $a is being passed in. Already defined
public function DoSomething($a){
return $a;
}
public function render()
{
return view('FirstPage', [
'posts' => NewModel::
// HOW TO PASS IN value of $a
where('Value1', '=', $a)
]);
}
}
编辑: 我不知道如何在where()中调用DoSomething方法,因为render()中没有定义$a.