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('/');
    }  



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2zvUsFU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire