Answer the question
In order to leave comments, you need to log in
Where to paste the code from the Spatie/Laravel-permission installation documentation?
I didn't understand where to put the code :(
here is the link
That's all the installation and configuration needed. A role can be created like a regular Eloquent model, like this:
use Spatie\Permission\Models\Role;
use Spatie\Permission\Models\Permission;
$role = Role::create(['name' => 'writer']);
$permission = Permission::create(['name' => 'edit articles']);
As far as I know, there I have to create a model , but I want to clarify.If
you need to create a model, what should it be called?
Thank you very much!
Answer the question
In order to leave comments, you need to log in
As I understand it, this code can be put anywhere. This is just the functionality of creating roles and rights. For example, you can make a page with adding roles and rights, and in the controller, when creating this data, insert this code and it turns out that you created roles and rights very easily.
"That's all the installation and configuration needed. A role can be created like a regular Eloquent model, like this:" - read?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question