Issues (54)

src/Observers/RoleObserver.php (2 issues)

1
<?php
2
3
namespace PhpCollective\MenuMaker\Observers;
4
5
use PhpCollective\MenuMaker\Storage\Role;
6
use PhpCollective\MenuMaker\Jobs\RemoveUserMenuCache;
7
8
class RoleObserver
9
{
10
    /**
11
     * Handle the Role "updated" event.
12
     *
13
     * @param  \App\Role  $group
0 ignored issues
show
The type App\Role was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
     * @return void
15
     */
16
    public function updated(Role $group)
17
    {
18
        $this->removeCache($group);
19
    }
20
21
    /**
22
     * Handle the Role "deleting" event.
23
     *
24
     * @param  \App\Role  $group
25
     * @return void
26
     */
27
    public function deleting(Role $group)
28
    {
29
        $this->removeCache($group);
30
    }
31
32
    /**
33
     * Handle the Cache delete.
34
     *
35
     * @param  \App\Role  $group
36
     * @return void
37
     */
38
    private function removeCache(Role $group)
39
    {
40
        $group->users->each(function ($user) {
0 ignored issues
show
The property users does not seem to exist on PhpCollective\MenuMaker\Storage\Role. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
41
            RemoveUserMenuCache::dispatch($user);
42
        });
43
    }
44
}