87 lines
1.6 KiB
PHP
87 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Contracts\Auth\Authenticatable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
|
|
class UserDosen extends Model implements Authenticatable
|
|
{
|
|
protected $table = 'users_dosen';
|
|
|
|
public $incrementing = false;
|
|
|
|
protected $keyType = 'string';
|
|
|
|
protected $fillable = [
|
|
'id',
|
|
'nama',
|
|
'nip',
|
|
'nidn',
|
|
'prodi',
|
|
'foto',
|
|
'role',
|
|
'password',
|
|
'remember_token',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
];
|
|
|
|
public $timestamps = true;
|
|
|
|
/**
|
|
* Boot the model.
|
|
*/
|
|
protected static function boot(): void
|
|
{
|
|
parent::boot();
|
|
|
|
// Generate UUID untuk new records
|
|
static::creating(function ($model) {
|
|
if (empty($model->{$model->getKeyName()})) {
|
|
$model->{$model->getKeyName()} = Str::uuid()->toString();
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Authenticatable Methods
|
|
*/
|
|
public function getAuthIdentifierName()
|
|
{
|
|
return 'id';
|
|
}
|
|
|
|
public function getAuthIdentifier()
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getAuthPasswordName()
|
|
{
|
|
return 'password';
|
|
}
|
|
|
|
public function getAuthPassword()
|
|
{
|
|
return $this->password;
|
|
}
|
|
|
|
public function getRememberTokenName()
|
|
{
|
|
return 'remember_token';
|
|
}
|
|
|
|
public function getRememberToken()
|
|
{
|
|
return $this->remember_token ?? null;
|
|
}
|
|
|
|
public function setRememberToken($value)
|
|
{
|
|
$this->remember_token = $value;
|
|
}
|
|
} |