Laravel промежуточное программное обеспечение, выбрасывающее 500 в производство, но не в локальный - PullRequest
0 голосов
/ 19 апреля 2020

(laravel 5.4.36)

Когда я добавляю middleware => 'auth' к любому из моих маршрутов, я получаю три ошибки ниже. Это происходит только на моем производственном сервере. На моем локальном компьютере он перенаправляется на мою страницу входа в систему.

Пример маршрута:

Route::get('/credits', [
    'middleware' => 'auth',
    'as' => 'pages.credits',
    'uses' => 'PagesController@credits'
]);

Symfony \ Component \ Debug \ Exception \ FatalThrowableError Вызов участника Функция setCook ie () в null


Symfony \ Component \ Debug \ Exception \ FatalThrowableError Ошибка типа: Аргумент 1 передан в Illuminate \ Session \ Middleware \ StartSession :: addCookieToResponse () должен быть экземпляром Symfony \ Component \ HttpFoundation \ Response, заданным экземпляром Illuminate \ View \ View, вызванным в ../vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php в строке 72


Symfony \ Component \ Debug \ Exception \ FatalThrowableError Ошибка типа: аргумент 1, переданный в Illuminate \ Cookie \ Middleware \ EncryptCookies :: encrypt (), должен быть экземпляром Symfony \ Component \ HttpFoundation \ Response, экземпляр Illuminate \ View \ View задан, вызывается в ../vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php в строке 59

/ поставщик / Laravel / Framework / подсветка / Auth / Middleware / Authenticate. php:

<?php

namespace Illuminate\Auth\Middleware;

use Closure;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Contracts\Auth\Factory as Auth;

class Authenticate
{
    /**
     * The authentication factory instance.
     *
     * @var \Illuminate\Contracts\Auth\Factory
     */
    protected $auth;

    /**
     * Create a new middleware instance.
     *
     * @param  \Illuminate\Contracts\Auth\Factory  $auth
     * @return void
     */
    public function __construct(Auth $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @param  string[]  ...$guards
     * @return mixed
     *
     * @throws \Illuminate\Auth\AuthenticationException
     */
    public function handle($request, Closure $next, ...$guards)
    {
        $this->authenticate($guards);

        return $next($request);
    }

    /**
     * Determine if the user is logged in to any of the given guards.
     *
     * @param  array  $guards
     * @return void
     *
     * @throws \Illuminate\Auth\AuthenticationException
     */
    protected function authenticate(array $guards)
    {
        if (empty($guards)) {
            return $this->auth->authenticate();
        }

        foreach ($guards as $guard) {
            if ($this->auth->guard($guard)->check()) {
                return $this->auth->shouldUse($guard);
            }
        }

        throw new AuthenticationException('Unauthenticated.', $guards);
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...