Does laravel have a default method it renders within a controller, like the index
method in codeigniter?
Right now I have a controller called TestController
, and within it a method like so:
public function index()
{
echo 'string';
}
What I would like to happen is: when I navigate to mysite.com/public/test I would like the index method to be rendered by default ( or whatever is the equivalent of index
in laravel).
Right now I can do this only if I place the following in the routes.php
file:
Route::get('test', 'TestController@index');
So, is it possible for this to happen automatically in laravel, or do I have to make specific routes for each and every controller and method?
Laravel has implicit controllers functionality. which will allow one to define methods with index which will be called with root URI.
Refer documentation at : http://laravel.com/docs/5.0/controllers#implicit-controllers