aceraven777
aceraven777

Reputation: 4556

Laravel 5 Admin Panel Authentication

ast week I started studying laravel 5 and it was fun.

I want to build a website that has a frontend and a backend (admin panel). I separated the controllers and views of admin panel. Backend is accesible via route: admin/*

But I have a problem separating Auth. I have a user table for the frontend and separate table for users in the backend, because frontend and backend user table has totally different structures.

Here's my code in my routes.php:

Route::group(['prefix' => 'admin', 'namespace' => 'admin'], function(){
    Route::get('custom-url', 'TestController@index');

    Route::controllers([
        'auth'      => 'Auth\AuthController',
        'password'  => 'Auth\PasswordController',
    ]);

});


Route::resource('articles', 'ArticlesController');

Route::controllers([
    'auth'      => 'Auth\AuthController',
    'password'  => 'Auth\PasswordController',
]);

Here's my folder structure:

enter image description here

enter image description here

Upvotes: 0

Views: 1734

Answers (1)

Margus Pala
Margus Pala

Reputation: 8663

If you are having different user accounts for frontend and backend then it is like 2 different applications where you have to implement authentication on your own. Fortunately it is not too difficult.

I would recommend to have user roles instead. Have only minimal info in users table that is shared and have additional information table for each role.

Upvotes: 1

Related Questions