i have created AdminMiddleware and i have written code as mention below but Auth::user will not work because i want to use Admin table instead of user table.
public function handle($request, Closure $next)
{
$Admin = \App\Admin::all()->count();
if (!($Admin == 1)) {
if (!Auth::user()->hasPermissionTo('Administer roles & permissions')) //If user does //not have this permission
{
abort('401');
}
}
return $next($request);
}