jeudi 5 novembre 2020

How to utilize Web Routes

My Web.php Routes looks like following

Route::prefix('admin')->middleware(['auth:admin'])->namespace('admin')->group(function(){ 
    
    $this->get('/adminuser','UsersController@admin')->name('admin.adminuser');
    $this->get('/adminuser/create','UsersController@create_admin')->name('admin.createadminuser');
    $this->post('/adminuser/create','UsersController@create_admin');
    $this->get('/adminuser/edit/{id}','UsersController@edit_admin')->name('admin.editadminuser');
    $this->post('/adminuser/edit/{id}','UsersController@edit_admin');
    $this->post('/adminuser/delete', 'UsersController@delete_admin');

    $this->get('/user','UsersController@user')->name('admin.user');
    $this->get('/user/create','UsersController@create_user')->name('admin.createuser');
    $this->post('/user/create','UsersController@create_user');
    $this->get('/user/edit/{id}','UsersController@edit_user')->name('admin.edituser');
    $this->post('/user/edit/{id}','UsersController@edit_user');
    $this->post('/user/delete', 'UsersController@delete_user');

    $this->get('/cmspages','MasterController@cmspage')->name('admin.cmspage');
    $this->get('/cmspages/create','MasterController@create_cmspages')->name('admin.createcmspage');
    $this->post('/cmspages/create','MasterController@create_cmspages');
    $this->get('/cmspages/edit/{id}','MasterController@edit_cmspages')->name('admin.editcmspages');
    $this->post('/cmspages/edit/{id}','MasterController@edit_cmspages');
    $this->post('/cmspages/delete', 'MasterController@delete_cmspages');

});

For every new module i've to repeat this lines. how can i utilize this

Note : Route resource doesn't allow me to create custom function except [create,edit,destroy & some of inbuilt methods]. i am using single Controller for many methods

For example My register user and admin user both are retrived from the UserController



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire