89 lines
1.8 KiB
PHP
89 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Tymon\JWTAuth\Contracts\JWTSubject;
|
|
|
|
class AkunTeknisi extends Authenticatable implements JWTSubject
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* Nama tabel yang berelasi dengan model ini.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'akun_teknisis';
|
|
|
|
/**
|
|
* Nama primary key dari tabel.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $primaryKey = 'id_akun_teknisi';
|
|
|
|
/**
|
|
* Atribut yang dapat diisi secara massal (mass assignable).
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'id_teknisi',
|
|
'username',
|
|
'password',
|
|
'password_plain',
|
|
'status',
|
|
];
|
|
|
|
/**
|
|
* Atribut yang harus disembunyikan (hidden) dari array atau JSON.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $hidden = [
|
|
'password',
|
|
];
|
|
|
|
/**
|
|
* Atribut yang harus dikonversi ke tipe data tertentu.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'password' => 'hashed',
|
|
];
|
|
|
|
/**
|
|
* Relasi ke model Teknisi.
|
|
* Sebuah AkunTeknisi dimiliki oleh satu Teknisi.
|
|
*
|
|
* @return BelongsTo
|
|
*/
|
|
public function teknisi(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Teknisi::class, 'id_teknisi', 'id_teknisi');
|
|
}
|
|
|
|
/**
|
|
* Get the identifier that will be stored in the subject claim of the JWT.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function getJWTIdentifier()
|
|
{
|
|
return $this->getKey();
|
|
}
|
|
|
|
/**
|
|
* Return a key value array, containing any custom claims to be added to the JWT.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getJWTCustomClaims()
|
|
{
|
|
return [];
|
|
}
|
|
} |