【发布时间】:2018-06-17 18:10:03
【问题描述】:
我有这样的资源路线
Route::resource('users','UsersController');
我想将数组和变量传递给索引页面或创建页面 所以我需要它是这样的
Route::resource('users','UsersController')-> with array to use it in the functions; // with array passed
并像这样在我的控制器中使用它
public function index()
{
return $my_array_passed_from_route;
if(Gate::allows('users.view'))
{
$users = User::withTrashed()->paginate(100);
return view('users.index',compact('users'));
}
else
return Helper::not_auth();
}
非常感谢
【问题讨论】:
标签: arrays laravel controller routes resources