mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-09-04 19:55:05 +02:00
108 lines
2.5 KiB
PHP
108 lines
2.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Filament\RelationManagers\Auth;
|
|
|
|
use App\Filament\RelationManagers\BaseRelationManager;
|
|
use App\Filament\Resources\Auth\Role as RoleResource;
|
|
use App\Models\Auth\Role;
|
|
use Filament\Forms\Form;
|
|
use Filament\Tables\Actions\ViewAction;
|
|
use Filament\Tables\Table;
|
|
|
|
/**
|
|
* Class RoleRelationManager.
|
|
*/
|
|
abstract class RoleRelationManager extends BaseRelationManager
|
|
{
|
|
/**
|
|
* The form to the actions.
|
|
*
|
|
* @param Form $form
|
|
* @return Form
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public function form(Form $form): Form
|
|
{
|
|
return RoleResource::form($form);
|
|
}
|
|
|
|
/**
|
|
* The index page of the resource.
|
|
*
|
|
* @param Table $table
|
|
* @return Table
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public function table(Table $table): Table
|
|
{
|
|
return parent::table(
|
|
$table
|
|
->heading(RoleResource::getPluralLabel())
|
|
->modelLabel(RoleResource::getLabel())
|
|
->recordTitleAttribute(Role::ATTRIBUTE_NAME)
|
|
->columns(RoleResource::table($table)->getColumns())
|
|
->defaultSort(Role::TABLE . '.' . Role::ATTRIBUTE_ID, 'desc')
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the filters available for the relation.
|
|
*
|
|
* @return array
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public static function getFilters(): array
|
|
{
|
|
return array_merge(
|
|
[],
|
|
RoleResource::getFilters(),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the actions available for the relation.
|
|
*
|
|
* @return array
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public static function getActions(): array
|
|
{
|
|
return [
|
|
ViewAction::make(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the bulk actions available for the relation.
|
|
*
|
|
* @return array
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public static function getBulkActions(): array
|
|
{
|
|
return array_merge(
|
|
parent::getBulkActions(),
|
|
RoleResource::getBulkActions(),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Get the header actions available for the relation.
|
|
*
|
|
* @return array
|
|
*
|
|
* @noinspection PhpMissingParentCallCommonInspection
|
|
*/
|
|
public static function getHeaderActions(): array
|
|
{
|
|
return RoleResource::getHeaderActions();
|
|
}
|
|
}
|