vendredi 1 juillet 2016

Laravel 5 Implicit Controllers. Controller Method Not Found Errors

I am using Laravel with an implicit controller

Routes.php

Route::controller('', 'PagesController');
Route::controller('users', 'UsersController');

PagesController

class PagesController extends BaseController
{
    protected $layout = 'layouts.publiclayout';

    public function getIndex()
    {
        //come code here Called from localhost/project/
    }
    public function getAboutus()
    {
        //some code here. Called from localhost/project/aboutus
    }
}

UsersController

class UsersController extends BaseController
{
    protected $layout = 'layouts.publiclayout';

    public function getIndex()
    {
        //should be called from localhost/project/users/
    }

    public function getRegister()
    {
        //should be called from localhost/project/users/register
    }
}

Whenever I browse to "localhost/project/" or "localhost/project/aboutus" it works well calling the right controllers and methods. But whenever I browse to "localhost/project/users" or "localhost/project/users/register", "Controller method not found" error is displayed, even though I implicity specify that all "Users" route should be directed to "UsersControllers"

Please help!!!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire