File "SuperAdminAuthMiddleware.php"

Full Path: /home/isoftco/public_html/hrm/app/Http/Middleware/SuperAdminAuthMiddleware.php
File size: 538 bytes
MIME-type: text/x-php
Charset: utf-8

<?php

namespace App\Http\Middleware;

use Closure;

class SuperAdminAuthMiddleware
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

        if (!admin()) {
            return \Redirect::route("login");
        }

        if (admin()->type === 'admin') {
            return \Redirect::route("admin.dashboard.index");
        }

        return $next($request);
    }
}