Skip to content

Commit

Permalink
Release resource.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed Mar 4, 2024
1 parent fb1006a commit af406d6
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 0 deletions.
72 changes: 72 additions & 0 deletions app/Filament/Resources/Content/ReleaseResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

namespace App\Filament\Resources\Content;

use App\Domain\Shop\Models\Release;
use App\Filament\Resources\Content\ReleaseResource\Pages;
use App\Filament\Tables\Columns\BooleanColumn;
use App\Filament\Tables\Columns\ResourceLinkColumn;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;

class ReleaseResource extends Resource
{
protected static ?string $model = Release::class;

protected static ?string $navigationGroup = 'Content';

protected static ?int $navigationSort = 4;

protected static ?string $navigationIcon = 'heroicon-o-list-bullet';

public static function form(Form $form): Form
{
return $form
->schema([
//
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('id')->searchable()->sortable(),
ResourceLinkColumn::make('product.title',
fn (Release $record) => route('filament.admin.resources.shop.products.edit', ['record' => $record->product])
),
Tables\Columns\TextColumn::make('version')->searchable()->sortable(),
BooleanColumn::make('released'),
Tables\Columns\TextColumn::make('released_at')->dateTime()->sortable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}

public static function getRelations(): array
{
return [
//
];
}

public static function getPages(): array
{
return [
'index' => Pages\ListReleases::route('/'),
'create' => Pages\CreateRelease::route('/create'),
'edit' => Pages\EditRelease::route('/{record}/edit'),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Filament\Resources\Content\ReleaseResource\Pages;

use App\Filament\Resources\Content\ReleaseResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;

class CreateRelease extends CreateRecord
{
protected static string $resource = ReleaseResource::class;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Filament\Resources\Content\ReleaseResource\Pages;

use App\Filament\Resources\Content\ReleaseResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;

class EditRelease extends EditRecord
{
protected static string $resource = ReleaseResource::class;

protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace App\Filament\Resources\Content\ReleaseResource\Pages;

use App\Filament\Resources\Content\ReleaseResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;

class ListReleases extends ListRecords
{
protected static string $resource = ReleaseResource::class;

protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

0 comments on commit af406d6

Please sign in to comment.