2024-07-03 14:41:15 +03:00
|
|
|
<?php
|
2024-09-06 16:53:20 +03:00
|
|
|
namespace kernel\modules\user\models;
|
2024-07-10 14:39:37 +03:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2024-07-03 14:41:15 +03:00
|
|
|
|
2024-07-24 14:07:45 +03:00
|
|
|
/**
|
2024-07-25 13:23:50 +03:00
|
|
|
* @property int $id
|
2024-07-24 14:07:45 +03:00
|
|
|
* @property string $username
|
|
|
|
* @property string $email
|
|
|
|
* @property string $password_hash
|
2024-12-25 16:32:23 +03:00
|
|
|
* @property string $user_photo
|
2024-10-22 11:09:35 +03:00
|
|
|
* @property string $access_token
|
|
|
|
* @property string $access_token_expires_at
|
2024-07-24 16:31:07 +03:00
|
|
|
* @method static find($id)
|
2024-07-24 14:07:45 +03:00
|
|
|
*/
|
2024-07-03 14:41:15 +03:00
|
|
|
class User extends Model {
|
2024-09-24 17:22:09 +03:00
|
|
|
|
|
|
|
const DEFAULT_USER_ROLE = 1;
|
|
|
|
const ADMIN_USER_ROLE = 9;
|
|
|
|
|
2024-07-10 12:42:50 +03:00
|
|
|
protected $table = 'user';
|
2024-12-25 16:32:23 +03:00
|
|
|
protected $fillable = ['username', 'email', 'password_hash', 'user_photo', 'role', 'access_token', 'access_token_expires_at'];
|
2024-07-12 13:46:44 +03:00
|
|
|
protected array $dates = ['deleted at'];
|
|
|
|
|
|
|
|
public static function labels(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'username' => 'Логин',
|
|
|
|
'email' => 'Email',
|
2024-12-25 16:32:23 +03:00
|
|
|
'user_photo' => 'Фото профиля',
|
2024-07-12 13:46:44 +03:00
|
|
|
'created_at' => 'Создан',
|
2024-10-22 11:09:35 +03:00
|
|
|
'updated_at' => 'Обновлен',
|
2024-07-12 13:46:44 +03:00
|
|
|
];
|
|
|
|
}
|
2024-07-03 14:41:15 +03:00
|
|
|
}
|