i am created new project on laravel 8 and have register an user as super admin, also maked an colomn role in my users table the i have register another user, but both are able to logined, but i wanted to login as role based,
1st user's role type = "SuperAdmin" 2nd user's role type = "Admin"
Here Is My Model
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Jetstream\HasProfilePhoto;
use Laravel\Sanctum\HasApiTokens;
class User extends Authenticatable
{
use HasApiTokens;
use HasFactory;
use HasProfilePhoto;
use Notifiable;
use TwoFactorAuthenticatable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'mobile',
'email',
'password',
'isEmailVerified',
'email_verified_at',
'isMobileVerified',
'mobile_verified_at',
'otp',
'otpStatus',
'role',
'status',
'password'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'created_at',
'updated_at',
'profile_photo_url'
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
/**
* The accessors to append to the model's array form.
*
* @var array
*/
protected $appends = [
'profile_photo_url',
];
}
in this if 2nd user type going to login show error you are not authorised, it is possible then please help me Thanks.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3ezNnsU
via IFTTT
Aucun commentaire:
Enregistrer un commentaire