58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class Pegawai extends Model implements AuthenticatableContract
|
|
{
|
|
protected $table = 'pegawai'; // Nama tabel
|
|
protected $primaryKey = 'id'; // Primary key tabel
|
|
|
|
protected $fillable = [
|
|
'nomer', 'nama', 'alamat', 'tgl_lahir', 'tgl_masuk', 'username', 'password', 'foto', 'bisalogin', 'status', 'jeniskelamin', 'agama', 'telepon', 'alamat_lahir', 'alamat_sekarang', 'nip', 'statusabsen', 'level_pegawai'
|
|
];
|
|
|
|
public function getAuthPassword()
|
|
{
|
|
return $this->password;
|
|
}
|
|
|
|
public function validateCredentials(array $credentials)
|
|
{
|
|
$plain = $credentials['password'];
|
|
$hashed = $this->getAuthPassword();
|
|
|
|
// Lihat apakah password cocok dengan yang tersimpan (tanpa hash)
|
|
return $plain === $hashed;
|
|
}
|
|
|
|
// Metode-metode dari kontrak Authenticatable
|
|
public function getAuthIdentifierName()
|
|
{
|
|
return 'id'; // Nama kolom yang menjadi identifier
|
|
}
|
|
|
|
public function getAuthIdentifier()
|
|
{
|
|
return $this->{$this->getAuthIdentifierName()};
|
|
}
|
|
|
|
public function getRememberToken()
|
|
{
|
|
return null; // Jika tidak menggunakan remember token
|
|
}
|
|
|
|
public function setRememberToken($value)
|
|
{
|
|
// Jika tidak menggunakan remember token
|
|
}
|
|
|
|
public function getRememberTokenName()
|
|
{
|
|
return null; // Jika tidak menggunakan remember token
|
|
}
|
|
}
|