I am creating a Laravel project for the users. Laravel has its own laravel/ui
package, but I am creating its admin panel too, and I am a bit confused about what I should do for admins. Also, I am confused about the security for the admin panel. So there are 2 solutions in my mind:
status,
and if its value is admin, he can access the admin panel; otherwise, redirect to the homepage.laravel/ui auth
. For that, I found documentation here.What should I do? Even i have added table prefix
for tables in .env
& config/database.php
. I am afraid that the hackers/users should not access the admin panel. And also, tell me if the table prefix is good for security, or should I remove the table prefix?
You need the permission-roles system.
https://spatie.be/docs/laravel-permission/v4/introduction
This is good decision for you. With well-configured routes no one wont have access in admin panel without access in data base.
For example, in panel page only admin have access:
Route::name('adminspace.')->group(['middleware' => ['role:admin']], function () {
Route::view('/panel', 'pages.panel');
});