Admin: For managing administrators with role-based access LlmProvider: For managing LLM service providers Created SQL schema: All tables as per the database design Proper foreign key constraints and indexes Timestamps for auditing Appropriate character sets and collations Added operation logging: Created LogService for centralized logging Integrated logging into TokenService Logs all token-related operations with user info and IP address Enhanced token management: Added comprehensive logging for all token operations Improved error handling and validation Added proper cleanup for revoked tokens
39 lines
731 B
PHP
39 lines
731 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
|
|
class Admin extends Authenticatable
|
|
{
|
|
protected $table = 'admins';
|
|
|
|
protected $fillable = [
|
|
'username',
|
|
'email',
|
|
'password',
|
|
'role',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
];
|
|
|
|
protected $casts = [
|
|
'role' => 'string',
|
|
];
|
|
|
|
public function clients(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Client::class, 'admin_client')
|
|
->withTimestamp('assigned_at');
|
|
}
|
|
|
|
public function isSuperAdmin(): bool
|
|
{
|
|
return $this->role === 'super';
|
|
}
|
|
}
|