planiverse

A minimalist, no-JS front-end for Mastodon.
git clone https://git.stjo.hn/planiverse
Log | Files | Refs | README | LICENSE

CheckSession.php (473B)


      1 <?php
      2 
      3 namespace App\Http\Middleware;
      4 
      5 use Closure;
      6 
      7 class CheckSession
      8 {
      9     /**
     10      * Check the user's session to ensure their user object is loaded.
     11      *
     12      * @param  \Illuminate\Http\Request  $request
     13      * @param  \Closure  $next
     14      * @return mixed
     15      */
     16     public function handle($request, Closure $next)
     17     {
     18         if (!session()->has('user'))
     19         {
     20             return redirect()->route('login');
     21         }
     22 
     23         return $next($request);
     24     }
     25 }