Paulo Teixeira
Paulo Teixeira

Reputation: 458

Laravel initial router, how to pass the controller?

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?

Upvotes: 1

Views: 94

Answers (1)

Damien Pirsy
Damien Pirsy

Reputation: 25435

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']);

Upvotes: 3

Related Questions