0

I'm new to Laravel and all that, and currently working on a little project. The task is to separate admins and users. So I want, just my admins, to access example.com/admin/dashboard. I read through some docs and came across this:

"2) Middleware to app/Http/Middleware/CheckIfAdmin.php

This middleware is used to test if users have access to admin panel pages. You can (and should customize it) if you have both users and admins in your app." in: https://backpackforlaravel.com/docs/5.x/base-about

But since I'm new to all this, I don't know how to "customize" "app/Http/Middleware/CheckIfAdmin.php".

Plus, do I need a second table for my admins, or can I just add a new column, with the name is_admin for example, to my "users" table? Can I do it with just app/Models/User.php, or do I need a separate app/Models/admin.php? Also, which guard do I have to use in "config/backpack/base.php", since when I use "null" instead of "backpack" or "web", I get an error saying:"guard [null] is not defined".

As you can see, I'm pretty lost here, but I hope that someone can help me with this. If you need more information, just ask for them, I would be happy to provide them.

Please bear with me, since I need clear instructions, so I get everything right ^^ also, please excuse my English, since I'm not a native speaker

Thanks in advance for your answers :)

Birb
  • 1
  • 1

1 Answers1

0

I still don't know how this worked at the second, or it generally works, but this solved my problem: Laravel backpack restrict user access to admin panel.

But feel free if you want to add something to this solution or my question^^

Birb
  • 1
  • 1
  • Your answer could be improved by adding some context and explanation around the link. You can find information on how to write good answers (in particular, why link-only answers are discouraged) [in the help center](https://stackoverflow.com/help/how-to-answer). – YurkoFlisk Jul 29 '22 at 19:18