Commit awal: prototipe UI SIAKAD Untan
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Admin;
|
||||
|
||||
use App\Models\User;
|
||||
use Database\Factories\Admin\AdminFactory;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Table;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
#[Table('profil_admin')]
|
||||
#[Fillable(['user_id', 'nip', 'jabatan', 'unit_kerja'])]
|
||||
class Admin extends Model
|
||||
{
|
||||
/** @use HasFactory<AdminFactory> */
|
||||
use HasFactory;
|
||||
|
||||
/** @return BelongsTo<User, $this> */
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
/** @return Attribute<string|null, never> */
|
||||
protected function nomorInduk(): Attribute
|
||||
{
|
||||
return Attribute::get(fn (): ?string => $this->nip);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user