@
@
@Twitt2017-08-26 15:39:33
Laravel
@Twitt, 2017-08-26 15:39:33

What is the best way to access the admin panel in this case?

I am making a blog on the finished layout, and actually, as I understand it, there is no commenting system here. It's just that the owner of the blog throws out news through the admin panel, and users simply read them. Actually, there can be only one role on the site: Admin. So, I made a banal laravel registration / login, and I need only administrators to register and log in. That is, he may not be one, but there may be three of them, for example. And at any moment they can increase. And leaving registration open is not an option, because users will be able to register and gain access to the admin panel. Or I think to make it so that after the first user registers, the registration mechanism itself is disabled, and in the future the accounts of other administrators can be done by the main admin in the admin panel, and send passwords and logins to these admins? Well, the middleware will only let the AdminController into the controller if the user is logged in. Is it right? How to do it right?
Maybe change in RegisterController with

public function __construct()
    {
        $this->middleware('guest');
    }

on the
public function __construct()
    {
        $this->middleware('auth');
    }

So that only admins can access the new users page?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hakkol, 2017-08-26
@hakkol

From experience, I want to say one thing - it's always better to create roles for users IMMEDIATELY so that your site is flexible for future tasks - for example, you wanted users to be able to leave only one comment on a news item.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question