staff update

This commit is contained in:
Abhishek Mali
2025-12-05 17:16:02 +05:30
parent 409a854d7b
commit 0a1d0a9c55
29 changed files with 2001 additions and 432 deletions

View File

@@ -1,22 +1,43 @@
<?php
// app/Models/Admin.php
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\Hash;
class Admin extends Authenticatable
{
use Notifiable;
use HasFactory, Notifiable, HasRoles;
protected $guard = 'admin';
protected $guard_name = 'admin';
protected $fillable = [
'name', 'email', 'password', 'role',
'name', 'email', 'password', 'username',
'phone', 'emergency_phone', 'address',
'role', 'department', 'designation', 'joining_date',
'status', 'additional_info', 'type', // admin/staff indicator
];
protected $hidden = [
'password', 'remember_token',
];
public function setPasswordAttribute($value)
{
if (!$value) return;
if (Hash::needsRehash($value)) {
$this->attributes['password'] = Hash::make($value);
} else {
$this->attributes['password'] = $value;
}
}
public function getDisplayNameAttribute()
{
return "{$this->name}";
}
}