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

121 lines
2.7 KiB
PHP

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