问题
Mrs. good morning I'd like to config my Laravel initial route, to works on the /, I don't know how I can to do to use the controller.
I use at this moment redirecting my initial route to /start route, but I'd like to use on / only.
See my router below.
Route::controller("Start");
Route::controller("Search");
Route::controller("Contact");
Route::get('/', function()
{
return Redirect::to("start");
});
I'd like to make:
Route::get('/', function()
{
return View::make("start.index");
});
And pass the Start.php controller to this view, it's possible?
Can somebody help me with?
回答1:
Route::get('/', 'StartController@index');
looks like what you're after: https://laravel.com/docs/5.2/routing
You can also call it using an array, to pass additional params:
Route::get('/', ['as' => 'start', 'uses' => 'StartController@index']);
来源:https://stackoverflow.com/questions/37859953/laravel-initial-router-how-to-pass-the-controller