- Introduced `is_unlimited` field in `app_roles` table to support roles with unlimited duration. - Enhanced front-end and back-end implementations to manage unlimited roles, including UI updates and validation. - Refactored `KekaOutlookController` and `KekaOutlookService` for streamlined exception handling and code consistency. - Applied linting and formatting improvements across updated files.
47 lines
972 B
PHP
47 lines
972 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\{Relations\BelongsTo, Relations\Pivot};
|
|
use Spatie\Permission\Models\Role;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $app_id
|
|
* @property int $role_id
|
|
* @property string $duration Validity of the role
|
|
*/
|
|
#[Fillable(['app_id', 'role_id', 'duration', 'is_unlimited'])]
|
|
class AppRole extends Pivot
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $table = 'app_roles';
|
|
|
|
/**
|
|
* @return BelongsTo<ConnectedApp, $this>
|
|
*/
|
|
public function app(): BelongsTo
|
|
{
|
|
return $this->belongsTo(ConnectedApp::class, 'app_id');
|
|
}
|
|
|
|
/**
|
|
* @return BelongsTo<Role, $this>
|
|
*/
|
|
public function role(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Role::class, 'role_id');
|
|
}
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'is_unlimited' => 'boolean',
|
|
];
|
|
}
|
|
}
|