????

Your IP : 3.145.90.123


Current Path : /home/thenclexdoctor.com/.trash/app/Http/Middleware/Api/
Upload File :
Current File : /home/thenclexdoctor.com/.trash/app/Http/Middleware/Api/LevelAccess.php

<?php

namespace App\Http\Middleware\Api;

use Closure;

class LevelAccess
{
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next, $level)
    {
        $user = apiAuth();
        $user_level = $user->role_name;
       // dd($user->id) ;
        $level_access = [
            'user' => ['user', 'teacher', 'organization'],
            'teacher' => ['organization', 'teacher'],
            'organization' => ['organization'],

        ];
        $levels = array_keys($level_access);
        if (in_array($level, $levels) && in_array($user_level, $level_access[$level])) {

            return $next($request);
        }
        return apiResponse2(0, 'forbidden', 'Auth user has not access to this level');

    }
}

Page not found | The NCLEX Doctor

Page not found!

Sorry, this page is not available...