J
J
Jedi2018-02-07 09:22:56
Laravel
Jedi, 2018-02-07 09:22:56

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

2 answer(s)
D
Dmitry Kuznetsov, 2018-02-07
@PHPjedi

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.

A
Alex Wells, 2018-02-07
@Alex_Wells

"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 question

Ask a Question

731 491 924 answers to any question