= 495c0ea2d8 Feat: add app roles management and relationships
- Added `app_roles` migration to manage role assignments for connected apps, supporting role duration and indexing.
- Introduced `AppRole` pivot model for managing `ConnectedApp` and `Role` relationships.
- Updated `ConnectedApp` and `Role` models with `BelongsToMany` relationships for role associations.
- Adjusted `permission` config to use custom `Role` model.
2026-05-19 07:16:17 +00:00

24 lines
480 B
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Spatie\Permission\Models\Role as SpatieRole;
class Role extends SpatieRole
{
public function apps(): BelongsToMany
{
return $this->belongsToMany(
ConnectedApp::class,
'app_roles',
'role_id',
'app_id'
)
->using(AppRole::class)
->withPivot('id', 'duration');
}
}