View file app/Http/Middleware/CheckUser.php

File size: 440B
<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Http\Request;

class CheckUser
{
    /**
     * Handle an incoming request.
     *
     * @param Request $request
     * @param Closure $next
     *
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        if (! getUser()) {
            abort(403, __('main.not_authorized'));
        }

        return $next($request);
    }
}