mardi 27 juin 2017

How to Prefix Sub-directory Containing Controllers in Routes?

I have Prefixed admin URI Using Route Groups, but I also want to Prefix admin Directory Containing Controllers I want to use!

Let's make it simple. Here is the Route File.

Route::prefix('admin')->group(function(){

    Route::get('/',"Admin\HomeController@index");

    Route::get('settings',"Admin\HomeController@getSettings");
    Route::post('settings',"Admin\HomeController@postSettings");

    Route::get('users',"Admin\UserController@index");

    Route::get('invoices',"Admin\InvoiceController@index");
});

Every Time I write new Route, I have to define Admin\ Directory to make Call the Controller Method.

Is there any way to Prefix the Subdirectory containing controllers too?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire