Files
animethemes-server/app/Filament/RelationManagers/Wiki/Video/ScriptRelationManager.php
T
2024-06-27 06:22:16 -03:00

121 lines
2.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Filament\RelationManagers\Wiki\Video;
use App\Filament\RelationManagers\BaseRelationManager;
use App\Filament\Resources\Wiki\Video\Script as ScriptResource;
use App\Models\Wiki\Video\VideoScript;
use Filament\Forms\Form;
use Filament\Tables\Table;
/**
* Class ScriptRelationManager.
*/
abstract class ScriptRelationManager extends BaseRelationManager
{
/**
* The form to the actions.
*
* @param Form $form
* @return Form
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public function form(Form $form): Form
{
return ScriptResource::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(ScriptResource::getPluralLabel())
->modelLabel(ScriptResource::getLabel())
->recordTitleAttribute(VideoScript::ATTRIBUTE_PATH)
->columns(ScriptResource::table($table)->getColumns())
->defaultSort(VideoScript::TABLE . '.' . VideoScript::ATTRIBUTE_ID, 'desc')
);
}
/**
* Get the filters available for the relation.
*
* @return array
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public static function getFilters(): array
{
return array_merge(
[],
ScriptResource::getFilters(),
);
}
/**
* Get the actions available for the relation.
*
* @return array
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public static function getActions(): array
{
return array_merge(
parent::getActions(),
ScriptResource::getActions(),
);
}
/**
* Get the bulk actions available for the relation.
*
* @return array
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public static function getBulkActions(): array
{
return array_merge(
parent::getBulkActions(),
ScriptResource::getBulkActions(),
);
}
/**
* Get the header actions available for the relation.
*
* @return array
*
* @noinspection PhpMissingParentCallCommonInspection
*/
public static function getHeaderActions(): array
{
return array_merge(
parent::getHeaderActions(),
ScriptResource::getHeaderActions(),
);
}
/**
* Determine whether the related model can be created.
*
* @return bool
*/
protected function canCreate(): bool
{
return false;
}
}