Skip to content

Instantly share code, notes, and snippets.

@nissicreative
Created August 31, 2016 13:56
Show Gist options
  • Save nissicreative/41e1f8ba5da9975ca0cd997dbfa01b2a to your computer and use it in GitHub Desktop.
Save nissicreative/41e1f8ba5da9975ca0cd997dbfa01b2a to your computer and use it in GitHub Desktop.
Laravel Admin Middleware
<?php
namespace App\Http\Middleware;
use Auth;
use Closure;
class Admin
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (Auth::check() && Auth::user()->isAdmin()) {
return $next($request);
}
abort(403);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment