jeudi 14 janvier 2016

Laravel 5 Implicit Route Not Resoving

I am embarrassed by how much I am struggling to convert my thinking from standard MVC to Laravel, but here's another noob question.

I have an app with a front end driven by app.blade.php. I have created a separate controller for the backend, which I have named Crud\UserController, which sits inside the Controllers directory. So my structure is Controllers \ Crud \ UserController.

Now somewhere in what follows I have gone wrong because my app/crud is not resolving. I'm going to be as specific as possible so I apologize for all the words.

My crud.blade.php file, which I intend to use as my master for the backend, is view\layouts right next to my app.blade.php file.

In my Crud\UserController I have the following:

class UserController extends Controller{
//
Route::controller('crud', 'Crud\UserController');

public function __construct()
{
  $this->middleware('auth');   }
public function getIndex   {  
  return view('/'); } }

Apologies for smashing that up a bit but the code block wouldn't accept it with normal line breaks.

And then in my routes.php file I am using, within the middleware group because I will require auth()

    Route::get('/crud', 'Crud\UserController@Index');

I'm not sure what else would be required to diagnose this issue. I'm new to implicit routes in this way and I'm a bit lost. As it stands any attempt to access localhost://app/crud returns a 404. Any help would be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire