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\Routing\Controllers;
4
 
5
use Closure;
6
use Illuminate\Support\Arr;
7
 
8
class Middleware
9
{
10
    /**
11
     * The middleware that should be assigned.
12
     *
13
     * @var \Closure|string|array
14
     */
15
    public $middleware;
16
 
17
    /**
18
     * The controller methods the middleware should only apply to.
19
     *
20
     * @var array|null
21
     */
22
    public $only;
23
 
24
    /**
25
     * The controller methods the middleware should not apply to.
26
     *
27
     * @var array|null
28
     */
29
    public $except;
30
 
31
    /**
32
     * Create a new controller middleware definition.
33
     *
34
     * @param  \Closure|string|array  $middleware
35
     * @return void
36
     */
37
    public function __construct(Closure|string|array $middleware)
38
    {
39
        $this->middleware = $middleware;
40
    }
41
 
42
    /**
43
     * Specify the only controller methods the middleware should apply to.
44
     *
45
     * @param  array|string  $only
46
     * @return $this
47
     */
48
    public function only(array|string $only)
49
    {
50
        $this->only = Arr::wrap($only);
51
 
52
        return $this;
53
    }
54
 
55
    /**
56
     * Specify the controller methods the middleware should not apply to.
57
     *
58
     * @param  array|string  $only
59
     * @return $this
60
     */
61
    public function except(array|string $except)
62
    {
63
        $this->except = Arr::wrap($except);
64
 
65
        return $this;
66
    }
67
}