33 lines
887 B
PHP
33 lines
887 B
PHP
<?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);
|
|
}
|
|
}
|