Wednesday, March 1, 2017

How to Update & Delete Roles in Sentinel Laravel 5.4?

I have done with user role create. below is its code.

$role = Sentinel::getRoleRepository()->createModel()->create([
    'name' => request('name'),
    'slug' => request('slug')           
]);

But I am not sure if below update & delete code will work.

Delete Code

$role = Sentinel::findRoleById($this->data['id']));

Edit Code ( I know its wrong, because it making no sense :) )

$role = Sentinel::findRoleById(request('role_id'));
$role = Sentinel::getRoleRepository()->createModel()->update([
    'name' => request('name'),
    'slug' => request('slug')
]);

Please help me out.




via Vishal Tarkar

Advertisement