mardi 11 juillet 2017

How to use laravel auth?

Good day. I'm trying to use laravel auth . But i'm bit confused.

I'm already Login and Register.

Here is my login process

public function index(){

   if(!Auth::check()){
        return view::make("Login");
     }else{
        dd(Auth::user());
    }
}
    function loginproses(Request $request){
        extract(Maincontroller::populateform());    
         $a = Loginmodel::where('username',$username)
                    ->where('password',md5($password))
                    ->first();
            if($a === NULL){ 
                return redirect('/')->with('status', 'Username atau Password salah');
            }else{

            $userdata = array(
                    'username' =>$username
                );

           if(Auth::attempt($userdata)){
                return redirect('/');
           }
        }
    }

I'm using Userlogin as my table so i change this

'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => App\Loginmodel::class,
            'table' => 'Userlogin'
        ],

but the problem after the login. I get this error

Argument 1 passed to Illuminate\Auth\EloquentUserProvider::validateCredentials() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of App\Loginmodel given, called in D:\xampp\htdocs\sitestarter\vendor\laravel\framework\src\Illuminate\Auth\SessionGuard.php on line 380 and defined

how can i fix it ?

when using google for searching how to login in laravel i always see Laravel auth. Then do i really need to use Laravel Auth ? and do really need to use the auth controller ?



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

Aucun commentaire:

Enregistrer un commentaire