Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel spatie asigne role

$user->assignRole('writer');

// You can also assign multiple roles at once
$user->assignRole('writer', 'admin');
// or as an array
$user->assignRole(['writer', 'admin']);
Comment

create role spatie

// Create a role or permission if necessary
use SpatiePermissionModelsRole;
use SpatiePermissionModelsPermission;

$role = Role::create(['name' => 'writer']);
$permission = Permission::create(['name' => 'edit articles']);
Comment

laravel spatie asigne role

$role->givePermissionTo($permission);
$permission->assignRole($role);
Comment

laravel spatie asigne role

$role->syncPermissions($permissions);
$permission->syncRoles($roles);
Comment

PREVIOUS NEXT
Code Example
Php :: print in file php 
Php :: include blade file in laravel 
Php :: login form using php pdo 
Php :: phpexcel set row height 
Php :: json_encode alternative 
Php :: php pdo sql server connect 
Php :: laravel search multiple tables 
Php :: install php unzip 
Php :: dispatch job with queue name in laravel 
Php :: define php 
Php :: validate columns laravel excel 
Php :: drop table phpmyadmin 
Php :: Advanced Custom Fields get sub field image 
Php :: refresh laravel model 
Php :: export mysql data to word in php 
Php :: run laravel seeder 
Php :: livewire call function from other component 
Php :: find php ini 
Php :: wordpress use jquery in plugin 
Php :: UUIDs LARAVEL 
Php :: explode return empty array 
Php :: yii2 gridview action change urls 
Php :: is null php 
Php :: count column eloquent laravel 
Php :: validate either one field is required in laravel 
Php :: laravel get route path uri 
Php :: saving an image from pc to php 
Php :: laravel blade if else condition 
Php :: join string php 
Php :: php array push 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =