Support the ongoing development of Laravel.io →
Authentication Session Database
["remember_token"]=>
    NULL

i have two guards in my auth the first one is "company" and the second one is "operator"

here is the code for operator :

protected $guard = 'operator';
    protected $redirectTo = '/operator';
    protected $redirectPath = '/operator/login';
    protected $loginPath = '/operator/login';
    protected $username = 'adminName';
    protected $redirectAfterLogout = '/dashboard';
    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest', ['except' => ['getLogout']]);
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    public function getCredentials(Request $request)
    {
        $credentials = $request->only($this->loginUsername(), 'password');
        return array_add($credentials, 'status', '1');
    }

    public function authenticated(Request $request,$user)
    {
        var_dump($user); exit;
        if ($user->status) {
            return redirect()->intended($this->redirectPath());
        } else {
            return redirect()->intended($this->loginPath())
            ->withInput($request->only($this->loginUsername(), 'remember'))
            ->withErrors('Your account is Inactive or not verified');;
        }
    }

and here for company

protected $guard = 'company';
    protected $redirectTo = '/';
    protected $redirectPath = '/register';
    protected $loginPath = '/login';
    protected $username = 'username';
    protected $redirectAfterLogout = '/dashboard';
    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest', ['except' => ['getLogout']]);
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    public function getCredentials(Request $request)
    {
        $credentials = $request->only($this->loginUsername(), 'password');
        return array_add($credentials, 'status', '1');
    }

    public function authenticated(Request $request,$user)
    {
        var_dump($user); exit;
        if ($user->status) {
            return redirect()->intended($this->redirectPath());
        } else {
            return redirect()->intended($this->loginPath())
            ->withInput($request->only($this->loginUsername(), 'remember'))
            ->withErrors('Your account is Inactive or not verified');;
        }
    }

both of code exactly same, just little configuration to change field and models. the question is why guard operator always give remember_token null

my source code : [http://pastebin.com/751VAFUe] auth file [http://pastebin.com/PcVUJLWT] model file [http://pastebin.com/PgCzv2ie] config file

Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.