45 lines
816 B
PHP
45 lines
816 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
|
|
class Admin extends Authenticatable
|
|
{
|
|
use HasApiTokens, Notifiable;
|
|
|
|
protected $table = 'admins';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'email',
|
|
'password',
|
|
'alamat',
|
|
'telepon',
|
|
'tipe_pengguna',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
protected $casts = [
|
|
'email_verified_at' => 'datetime',
|
|
'password' => 'hashed',
|
|
];
|
|
|
|
public function isAdmin()
|
|
{
|
|
return $this->tipe_pengguna === 'admin';
|
|
}
|
|
|
|
// Accessor untuk ID
|
|
public function getIdAttribute()
|
|
{
|
|
return $this->attributes['id'];
|
|
}
|
|
}
|