refactor(usermanagement): tidy up User model code structure and improve attribute casting
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Modules\Basicdata\Models\Branch;
|
||||
use Modules\Adk\Models\Appointment;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
use Mattiverse\Userstamps\Traits\Userstamps;
|
||||
|
||||
@@ -68,8 +69,7 @@
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts()
|
||||
: array
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'email_verified_at' => 'datetime',
|
||||
@@ -78,7 +78,8 @@
|
||||
];
|
||||
}
|
||||
|
||||
public function branch(){
|
||||
public function branch()
|
||||
{
|
||||
return $this->belongsTo(Branch::class);
|
||||
}
|
||||
|
||||
@@ -91,4 +92,14 @@
|
||||
{
|
||||
return \Modules\Usermanagement\Database\Factories\UserFactory::new();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the appointments for the User
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function appointments()
|
||||
{
|
||||
return $this->hasMany(Appointment::class, 'admin_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user