<?php

namespace Mtc\Core;

use Mtc\Core\Admin\User;

/**
 * Admin User
 *
 * Backwards-compatibility alias for the canonical admin model,
 * Mtc\Core\Admin\User.
 *
 * The admin_users table used to be represented by two separate Eloquent models
 * on the same row. They have been consolidated onto Mtc\Core\Admin\User
 * (AL2U-T136). This subclass keeps the old Mtc\Core\AdminUser name working so the
 * existing call sites do not break; references are migrated over time.
 *
 * All behaviour - casts, the *_hash boot hook, the whereUsername scope,
 * $searchable, relationships and getCurrent() - is inherited from the canonical
 * model. Only $fillable is intentionally kept distinct: this alias must NOT
 * expose `password` to mass assignment, because \AdminUser::update()
 * (core/classes/class.adminuser.php) relies on fill() ignoring a blank password
 * so it does not clobber the stored hash.
 *
 * @author Florin Radica <florin.radica@mtcmedia.co.uk>
 * @since 04/07/2017
 *
 * @property int $id
 * @property string $username
 * @property string $password
 * @property string $email
 * @property string $signature
 * @property string $session_id
 * @property string $name
 * @property int $role
 */
class AdminUser extends User
{
    protected $fillable = [
        'username',
        'email',
        'signature',
        'session_id',
        'name',
        'role',
        'credentials',
    ];
}
