added photoprofile

This commit is contained in:
Alexander Gabriel 2026-06-28 14:58:42 +00:00
parent 1230bda4fe
commit 1ac8009173
9 changed files with 173 additions and 13 deletions

View File

@ -0,0 +1,11 @@
<?php
namespace App\Filament\Resources\Photoprofiles\Pages;
use App\Filament\Resources\Photoprofiles\PhotoprofileResource;
use Filament\Resources\Pages\CreateRecord;
class CreatePhotoprofile extends CreateRecord
{
protected static string $resource = PhotoprofileResource::class;
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Photoprofiles\Pages;
use App\Filament\Resources\Photoprofiles\PhotoprofileResource;
use Filament\Actions\DeleteAction;
use Filament\Resources\Pages\EditRecord;
class EditPhotoprofile extends EditRecord
{
protected static string $resource = PhotoprofileResource::class;
protected function getHeaderActions(): array
{
return [
DeleteAction::make(),
];
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\Photoprofiles\Pages;
use App\Filament\Resources\Photoprofiles\PhotoprofileResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
class ListPhotoprofiles extends ListRecords
{
protected static string $resource = PhotoprofileResource::class;
protected function getHeaderActions(): array
{
return [
CreateAction::make(),
];
}
}

View File

@ -0,0 +1,50 @@
<?php
namespace App\Filament\Resources\Photoprofiles;
use App\Filament\Resources\Photoprofiles\Pages\CreatePhotoprofile;
use App\Filament\Resources\Photoprofiles\Pages\EditPhotoprofile;
use App\Filament\Resources\Photoprofiles\Pages\ListPhotoprofiles;
use App\Filament\Resources\Photoprofiles\Schemas\PhotoprofileForm;
use App\Filament\Resources\Photoprofiles\Tables\PhotoprofilesTable;
use App\Models\Photoprofile;
use BackedEnum;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Table;
class PhotoprofileResource extends Resource
{
protected static ?string $model = Photoprofile::class;
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
protected static ?string $recordTitleAttribute = 'name';
public static function form(Schema $schema): Schema
{
return PhotoprofileForm::configure($schema);
}
public static function table(Table $table): Table
{
return PhotoprofilesTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => ListPhotoprofiles::route('/'),
'create' => CreatePhotoprofile::route('/create'),
'edit' => EditPhotoprofile::route('/{record}/edit'),
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace App\Filament\Resources\Photoprofiles\Schemas;
use Filament\Forms\Components\Checkbox;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Schemas\Schema;
class PhotoprofileForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
TextInput::make('name')
->label('Name')
->required(),
Checkbox::make('active')
->label('Aktiv'),
Textarea::make('commands')
->label('Befehle')
->required(),
]);
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Filament\Resources\Photoprofiles\Tables;
use Filament\Actions\BulkActionGroup;
use Filament\Actions\DeleteBulkAction;
use Filament\Actions\EditAction;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class PhotoprofilesTable
{
public static function configure(Table $table): Table
{
return $table
->columns([
TextColumn::make('created_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('updated_at')
->dateTime()
->sortable()
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('name')
->label('Name')
->searchable(),
IconColumn::make('active')
->label('Aktiv')
])
->filters([
//
])
->recordActions([
EditAction::make(),
])
->toolbarActions([
BulkActionGroup::make([
DeleteBulkAction::make(),
]),
]);
}
}

View File

@ -1,10 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Photocommand extends Model
{
//
}

View File

@ -2,11 +2,11 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;
#[Fillable('name', 'commands')]
class Photoprofile extends Model
{
protected $casts = [
'commands' => 'array',
];
//
}

View File

@ -14,6 +14,7 @@ return new class extends Migration
Schema::create('photoprofiles', function (Blueprint $table) {
$table->id();
$table->timestamps();
$table->boolean('active')->default(1);
$table->string("name");
$table->string("commands");
});