Kernel.php 2.91 KB
Newer Older
1
2
3
4
<?php

namespace App\Http;

Jacob Priddy's avatar
Jacob Priddy committed
5
use Fruitcake\Cors\HandleCors;
Jacob Priddy's avatar
Jacob Priddy committed
6
7
8
use App\Http\Middleware\TrimStrings;
use App\Http\Middleware\Authenticate;
use App\Http\Middleware\TrustProxies;
9
use App\Http\Middleware\AddAjaxHeader;
Jacob Priddy's avatar
Jacob Priddy committed
10
11
12
13
use App\Http\Middleware\EncryptCookies;
use App\Http\Middleware\VerifyCsrfToken;
use Illuminate\Auth\Middleware\Authorize;
use Illuminate\Auth\Middleware\RequirePassword;
Jacob Priddy's avatar
Jacob Priddy committed
14
use Illuminate\Http\Middleware\SetCacheHeaders;
Jacob Priddy's avatar
Jacob Priddy committed
15
16
17
use Illuminate\Session\Middleware\StartSession;
use App\Http\Middleware\CheckForMaintenanceMode;
use Illuminate\Routing\Middleware\ThrottleRequests;
Jacob Priddy's avatar
Jacob Priddy committed
18
use Illuminate\Foundation\Http\Kernel as HttpKernel;
Jacob Priddy's avatar
Jacob Priddy committed
19
20
use Illuminate\Routing\Middleware\ValidateSignature;
use Illuminate\Auth\Middleware\EnsureEmailIsVerified;
Jacob Priddy's avatar
Jacob Priddy committed
21
22
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\View\Middleware\ShareErrorsFromSession;
Jacob Priddy's avatar
Jacob Priddy committed
23
use Illuminate\Session\Middleware\AuthenticateSession;
Jacob Priddy's avatar
Jacob Priddy committed
24
25
26
27
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
use Illuminate\Foundation\Http\Middleware\ValidatePostSize;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
28
29
30
31
32
33
34
35
36
37
38

class Kernel extends HttpKernel
{
    /**
     * The application's global HTTP middleware stack.
     *
     * These middleware are run during every request to your application.
     *
     * @var array
     */
    protected $middleware = [
Jacob Priddy's avatar
Jacob Priddy committed
39
        TrustProxies::class,
Jacob Priddy's avatar
Jacob Priddy committed
40
        HandleCors::class,
Jacob Priddy's avatar
Jacob Priddy committed
41
42
43
44
        CheckForMaintenanceMode::class,
        ValidatePostSize::class,
        TrimStrings::class,
        ConvertEmptyStringsToNull::class,
Jacob Priddy's avatar
Jacob Priddy committed
45
        EncryptCookies::class,
46
47
48
49
50
51
52
53
54
    ];

    /**
     * The application's route middleware groups.
     *
     * @var array
     */
    protected $middlewareGroups = [
        'web' => [
Jacob Priddy's avatar
Jacob Priddy committed
55
56
            AddQueuedCookiesToResponse::class,
            StartSession::class,
Jacob Priddy's avatar
Jacob Priddy committed
57
            AuthenticateSession::class,
Jacob Priddy's avatar
Jacob Priddy committed
58
59
60
            ShareErrorsFromSession::class,
            VerifyCsrfToken::class,
            SubstituteBindings::class,
61
62
63
        ],

        'api' => [
Jacob Priddy's avatar
Jacob Priddy committed
64
            // Throttle after 100 requests within 2 minutes
65
//            'throttle:500,5',
66
            'bindings',
67
            'ajax',
68
        ],
Jacob Priddy's avatar
Jacob Priddy committed
69
70

        'door' => [
71
            'auth:door',
Jacob Priddy's avatar
Jacob Priddy committed
72
            'bindings',
73
            'ajax',
Jacob Priddy's avatar
Jacob Priddy committed
74
        ],
75
76
77
78
79
80
81
82
83
84
    ];

    /**
     * The application's route middleware.
     *
     * These middleware may be assigned to groups or used individually.
     *
     * @var array
     */
    protected $routeMiddleware = [
Jacob Priddy's avatar
Jacob Priddy committed
85
86
87
88
89
90
91
92
93
        'auth' => Authenticate::class,
        'auth.basic' => AuthenticateWithBasicAuth::class,
        'bindings' => SubstituteBindings::class,
        'cache.headers' => SetCacheHeaders::class,
        'can' => Authorize::class,
        'password.confirm' => RequirePassword::class,
        'signed' => ValidateSignature::class,
        'throttle' => ThrottleRequests::class,
        'verified' => EnsureEmailIsVerified::class,
94
        'ajax' => AddAjaxHeader::class,
95
96
    ];
}