Multi-auth Mutltitrust (Model)


Model setup

It’s multi-auth so two model setup ……..

User Model

<?php
use Code4mk\Multitrust\Traits\HasRoleAndPermission;
use Code4mk\Multitrust\Contracts\HasRoleAndPermission as HasRoleAndPermissionContract;
class User extends Authenticatable implements HasRoleAndPermissionContract
{
use HasRoleAndPermission;
}

Admin-Model

<?php
namespace App;
use Code4mk\Multitrust\Traits\HasRoleAndPermission;
use Code4mk\Multitrust\Contracts\HasRoleAndPermission as HasRoleAndPermissionContract;
class Admin extends Authenticatable implements HasRoleAndPermissionContract
{
use HasRoleAndPermission;
}
<?php
namespace App;
use App\Notifications\AdminResetPasswordNotification;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Code4mk\Multitrust\Traits\HasRoleAndPermission;
use Code4mk\Multitrust\Contracts\HasRoleAndPermission as HasRoleAndPermissionContract;
class Admin extends Authenticatable implements HasRoleAndPermissionContract
{
use Notifiable;
use HasRoleAndPermission;
protected $guard = 'admin';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password','job_title',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
public function sendPasswordResetNotification($token)
{
$this->notify(new AdminResetPasswordNotification($token));
}
}