jeudi 29 novembre 2018

Laravel : Middleware Issue

I have middleware UKM i want if the Auth::id() in the table ukm then can access the next request. But not working, if Auth::id() no in the table user can access.

public function handle($request, Closure $next)
    {
        $query = DB::table('ukm')->where('id_user',Auth::id())->get();
        foreach($query as $key){
            $cek = $key->id_user;
        }
        if ($cek != NULL) {
            return $next($request);
        }

            return redirect('/');
    }  



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire