dimanche 29 janvier 2017

How can I get the value of my role using this query

im having an error... i don't know how to fix this... im doing something that will set page privileges to admin employee and other roles. But suddenly i doesnt get the value of my variable role.

enter image description here

 public function login(Request $req)
     {
        $username=$req->input('email');
        $password=$req->input('password');
        $breadcrumb = 'Dashboard';
        $pageTitle = 'CollabUX | Dashboard';
        $prepath ='../';
        $currentURL = Req::url();

        $user = DB::table('add_users')->where(['username'=>$username,'password'=>$password])->get();

        if(count($user)>0){
            session(['isloggedin' => 'true']);
            session(['roles' => $user->role]);

        return View::make('dashboard')->with(
            array('breadcrumb' => $breadcrumb,'pageTitle' => $pageTitle,'currentURL' => $currentURL,'prepath' => $prepath));
        }
        else{
            //redirect page
            $data = array(
                'error' => 1,
                'remarks' => 'Invalid Username/Password. Please try again.'
                );
            return View::make('login')->with('data', $data);


        }       
     }



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

Aucun commentaire:

Enregistrer un commentaire