Initial commit
This commit is contained in:
26
app/Filament/Resources/Sizes/Pages/EditSize.php
Normal file
26
app/Filament/Resources/Sizes/Pages/EditSize.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Sizes\Pages;
|
||||
|
||||
use App\Filament\Resources\Sizes\SizeResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditSize extends EditRecord
|
||||
{
|
||||
protected static string $resource = SizeResource::class;
|
||||
|
||||
public function mount($record = null): void
|
||||
{
|
||||
$record = $record ?? 1;
|
||||
parent::mount($record);
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
57
app/Filament/Resources/Sizes/Schemas/SizeForm.php
Normal file
57
app/Filament/Resources/Sizes/Schemas/SizeForm.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Sizes\Schemas;
|
||||
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Schemas\Components\Grid;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class SizeForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Section::make()
|
||||
->schema([
|
||||
TextInput::make('small')
|
||||
->label('Mały rozmiar (opis)')
|
||||
->required()
|
||||
->maxLength(2048),
|
||||
FileUpload::make('small_photo')
|
||||
->image()
|
||||
->imageEditor()
|
||||
->disk('public')
|
||||
->nullable()
|
||||
->directory('sizes')
|
||||
->label('Zdjęcie (małego rozmiaru)'),
|
||||
TextInput::make('medium')
|
||||
->label('Średni rozmiar (opis)')
|
||||
->required()
|
||||
->maxLength(2048),
|
||||
FileUpload::make('medium_photo')
|
||||
->image()
|
||||
->imageEditor()
|
||||
->disk('public')
|
||||
->nullable()
|
||||
->directory('sizes')
|
||||
->label('Zdjęcie (średniego rozmiaru)'),
|
||||
TextInput::make('large')
|
||||
->label('Duży rozmiar (opis)')
|
||||
->required()
|
||||
->maxLength(2048),
|
||||
FileUpload::make('large_photo')
|
||||
->image()
|
||||
->imageEditor()
|
||||
->disk('public')
|
||||
->nullable()
|
||||
->directory('sizes')
|
||||
->label('Zdjęcie (dużego rozmiaru)'),
|
||||
])
|
||||
->columns(1)
|
||||
->columnSpan('full'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
57
app/Filament/Resources/Sizes/SizeResource.php
Normal file
57
app/Filament/Resources/Sizes/SizeResource.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Sizes;
|
||||
|
||||
use App\Filament\Resources\Sizes\Pages\CreateSize;
|
||||
use App\Filament\Resources\Sizes\Pages\EditSize;
|
||||
use App\Filament\Resources\Sizes\Pages\ListSizes;
|
||||
use App\Filament\Resources\Sizes\Pages\ViewSize;
|
||||
use App\Filament\Resources\Sizes\Schemas\SizeForm;
|
||||
use App\Filament\Resources\Sizes\Schemas\SizeInfolist;
|
||||
use App\Filament\Resources\Sizes\Tables\SizesTable;
|
||||
use App\Models\Size;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class SizeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Size::class;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-circle-stack';
|
||||
protected static ?string $pluralModelLabel = 'Rozmiary';
|
||||
protected static ?string $modelLabel = 'Rozmiary';
|
||||
protected static ?int $navigationSort = 3;
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Treść';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return SizeForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return SizeInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return SizesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => EditSize::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user