-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb1006a
commit af406d6
Showing
4 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | ||
]; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
app/Filament/Resources/Content/ReleaseResource/Pages/CreateRelease.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Content/ReleaseResource/Pages/EditRelease.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/Content/ReleaseResource/Pages/ListReleases.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
]; | ||
} | ||
} |