Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Foundation\Auth\Access;
4
 
5
use Illuminate\Contracts\Auth\Access\Gate;
6
 
7
trait Authorizable
8
{
9
    /**
10
     * Determine if the entity has the given abilities.
11
     *
12
     * @param  iterable|string  $abilities
13
     * @param  array|mixed  $arguments
14
     * @return bool
15
     */
16
    public function can($abilities, $arguments = [])
17
    {
18
        return app(Gate::class)->forUser($this)->check($abilities, $arguments);
19
    }
20
 
21
    /**
22
     * Determine if the entity has any of the given abilities.
23
     *
24
     * @param  iterable|string  $abilities
25
     * @param  array|mixed  $arguments
26
     * @return bool
27
     */
28
    public function canAny($abilities, $arguments = [])
29
    {
30
        return app(Gate::class)->forUser($this)->any($abilities, $arguments);
31
    }
32
 
33
    /**
34
     * Determine if the entity does not have the given abilities.
35
     *
36
     * @param  iterable|string  $abilities
37
     * @param  array|mixed  $arguments
38
     * @return bool
39
     */
40
    public function cant($abilities, $arguments = [])
41
    {
42
        return ! $this->can($abilities, $arguments);
43
    }
44
 
45
    /**
46
     * Determine if the entity does not have the given abilities.
47
     *
48
     * @param  iterable|string  $abilities
49
     * @param  array|mixed  $arguments
50
     * @return bool
51
     */
52
    public function cannot($abilities, $arguments = [])
53
    {
54
        return $this->cant($abilities, $arguments);
55
    }
56
}