<?php

namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;

class Admin extends Authenticatable
{
    protected $fillable = [
        'uid',
        'name',
        'email',
        'password',
        'photo'
    ];

    protected $hidden = [
        'password',
        'remember_token', // ✅ remember token hide
    ];

    protected static function boot()
    {
        parent::boot();

        static::creating(function ($admin) {

            if (!$admin->uid) {
                $lastId = self::max('id') + 1;
                $admin->uid = 'ADM' . str_pad($lastId, 3, '0', STR_PAD_LEFT);
            }
        });
    }
}