I try to create a basic authentication scheme with one administrator user who will create users and dynamically assign roles and page access permissions to them.
This worked partially. I needed node.js in order to run
npm install && npm run dev
command (could this be avoided?).
Unfortunatelly, the styling of the page is not showing as expected and more important there are some malfunctions (eg the users get logged in immediately upon registration, or the standard user can delete othe users).
Is there a simpler way to implement this? We just need one administrator user who will grant roles and access permissions to users.
I am pretty sure that tutorial is old, they just kept updating the Laravel version in the title and some edits in the article.
The npm install && npm run dev is not needed if you're not using the bootstrap scaffolding they are using in that tutorial (which we no longer use after the release of breeze and jetstream).
There is no simpler way, only in case you have two roles, a normal user and an admin, that way you can create an is_admin column in the users table where it's false for everyone else but the admin, and you perform the checks based on that boolean value.
If you do have more than one role, I highly recommend using a package as it simplifies the process, the most used packages are
https://laratrust.santigarcor.me/ (simpler than spatie package, but does not have as much features, so if you are doing basic stuff maybe go with this one instead)
Unfortunately most guides are obsolete. We should work with spatie. We need a user interface and the administrator should assign roles and access permissions.
@konrms and what seem to be the problem? you don't have to worry about role/permissions table, spatie will generate them for you.
Now if a user register he will have a default role/permission, and on your dashboard where you have all the users listed, you do have that edit button for sure, once you wish to edit a user, you can attach a permission or role directly.
Please have a look at these basic examples, based on your use case, that's all you'll need for now: