Conditions | 1 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
12 | 4 | public function update(RoleInterface $role): bool |
|
13 | { |
||
14 | 4 | $updated = $this->query()->find($role->getId()); |
|
15 | |||
16 | 4 | $updated->fill([ |
|
17 | 4 | 'name' => $role->getName(), |
|
18 | 4 | 'guard_name' => $role->getGuardName(), |
|
19 | 4 | ])->save(); |
|
20 | |||
21 | 4 | $role->setCreatedAt($updated->created_at); |
|
22 | 4 | $role->setUpdatedAt($updated->updated_at); |
|
23 | |||
24 | 4 | $this->syncPermissions($updated, $role); |
|
25 | |||
26 | 4 | event(new RoleUpdated($role, count($updated->getChanges()) >= 1)); |
|
27 | |||
28 | 4 | return count($updated->getChanges()) >= 1; |
|
29 | } |
||
31 |