I have a custom guard named 'customers'.
Config/Auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'users',
],
'api' => [
'driver' => 'token',
'provider' => 'users',
],
'customers' => [
'driver' => 'session',
'provider' => 'customers',
],
],
The login page of the default guard has a method to redirect the already logged in users of the that guard.
LoginController.php
public function __construct()
{
$this->middleware('guest')->except('logout');
}
But this redirects the logged in users of other guards too.
I have tried modifying the abouve method
public function __construct()
{
$this->middleware('guest:web')->except('logout');
}
But no results.
My customer model
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Notifications\CustomerResetPasswordNotification;
class Customer extends Authenticatable
{
use SoftDeletes;
use Notifiable;
protected $guard = 'customers';
use \Askedio\SoftCascade\Traits\SoftCascadeTrait;
protected $dates = ['deleted_at'];
protected $guarded = ['id'];
protected $softCascade = ['address'];
protected $hidden = ['password', 'remember_token'];
public function address()
{
return $this->hasMany(AddressBook::class);
}
public function ipaddress()
{
return $this->hasMany(IpAddress::class);
}
public function sendPasswordResetNotification($token)
{
$this->notify(new CustomerResetPasswordNotification($token));
}
public function coupons()
{
return $this->belongsToMany(Coupon::class);
}
}