diff --git a/ARTISAN.md b/ARTISAN.md index 0e675e7..7fbd2fe 100644 --- a/ARTISAN.md +++ b/ARTISAN.md @@ -2,8 +2,8 @@ a make:model Customer -ms a make:filament-resource Customer -php artisan make:model ModelName -m // creates migration too -php artisan make:model ModelName -c // creates controller too -php artisan make:model ModelName -f // also creates a factory -php artisan make:model ModelName -s // also creates a database seeder -php artisan make:model ModelName -mfcs // creates migration, factory, controller and seeder +a make:model ModelName -m // creates migration too +a make:model ModelName -c // creates controller too +a make:model ModelName -f // also creates a factory +a make:model ModelName -s // also creates a database seeder +a make:model ModelName -mfcs // creates migration, factory, controller and seeder diff --git a/app/Filament/Resources/KontoOptions/KontoOptionResource.php b/app/Filament/Resources/KontoOptions/KontoOptionResource.php index 37a6a5c..58ab46a 100644 --- a/app/Filament/Resources/KontoOptions/KontoOptionResource.php +++ b/app/Filament/Resources/KontoOptions/KontoOptionResource.php @@ -13,6 +13,7 @@ use BackedEnum; use Filament\Resources\Resource; use Filament\Schemas\Schema; use Filament\Tables\Table; +use UnitEnum; class KontoOptionResource extends Resource { @@ -20,6 +21,8 @@ class KontoOptionResource extends Resource protected static ?string $cluster = AdministrationCluster::class; + protected static string|UnitEnum|null $navigationGroup = 'Kunden'; + protected static string|BackedEnum|null $navigationIcon = 'lucide-key-square'; protected static ?string $navigationLabel = 'Konto Optionen'; diff --git a/app/Filament/Resources/Orientierungs/OrientierungResource.php b/app/Filament/Resources/Orientierungs/OrientierungResource.php new file mode 100644 index 0000000..6346bc2 --- /dev/null +++ b/app/Filament/Resources/Orientierungs/OrientierungResource.php @@ -0,0 +1,62 @@ + ListOrientierungs::route('/'), + ]; + } + + public static function getNavigationBadge(): ?string + { + return parent::getEloquentQuery()->where('selectable', true)->count(); + } +} diff --git a/app/Filament/Resources/Orientierungs/Pages/CreateOrientierung.php b/app/Filament/Resources/Orientierungs/Pages/CreateOrientierung.php new file mode 100644 index 0000000..e9cecfc --- /dev/null +++ b/app/Filament/Resources/Orientierungs/Pages/CreateOrientierung.php @@ -0,0 +1,11 @@ +components([ + // + ]); + } +} diff --git a/app/Filament/Resources/Orientierungs/Tables/OrientierungsTable.php b/app/Filament/Resources/Orientierungs/Tables/OrientierungsTable.php new file mode 100644 index 0000000..c3543d9 --- /dev/null +++ b/app/Filament/Resources/Orientierungs/Tables/OrientierungsTable.php @@ -0,0 +1,36 @@ +columns([ + TextColumn::make('name') + ->color(fn ($record): string => match ($record->seitig) { + 1 => 'primary', + 2 => 'warning', + 3 => 'success', + 4 => 'danger', + 5 => 'indigo', + default => 'gray', + }), + ]) + ->filters([ + SelectFilter::make('seitig') + ->options([ + '1' => 'E I N S E I T I G', + '2' => 'Z W E I S E I T I G', + '3' => 'D R E I S E I T I G', + '4' => 'V I E R S E I T I G', + '5' => 'E X T R A S', + ]), + ]); + } +} diff --git a/app/Filament/Resources/Permissions/PermissionResource.php b/app/Filament/Resources/Permissions/PermissionResource.php index e0e3b20..d812533 100644 --- a/app/Filament/Resources/Permissions/PermissionResource.php +++ b/app/Filament/Resources/Permissions/PermissionResource.php @@ -13,6 +13,7 @@ use BackedEnum; use Filament\Resources\Resource; use Filament\Schemas\Schema; use Filament\Tables\Table; +use UnitEnum; class PermissionResource extends Resource { @@ -20,6 +21,8 @@ class PermissionResource extends Resource protected static ?string $cluster = AdministrationCluster::class; + protected static string|UnitEnum|null $navigationGroup = 'Kunden'; + protected static string|BackedEnum|null $navigationIcon = 'lucide-toggle-right'; protected static ?string $recordTitleAttribute = 'name'; diff --git a/app/Models/Orientierung.php b/app/Models/Orientierung.php new file mode 100644 index 0000000..3d15e77 --- /dev/null +++ b/app/Models/Orientierung.php @@ -0,0 +1,22 @@ +get(); + $arr = []; + foreach ($res as $value) { + $arr[$value['id']] = $value['name']; + } + + return $arr; + } +} diff --git a/app/Policies/OrientierungPolicy.php b/app/Policies/OrientierungPolicy.php new file mode 100644 index 0000000..13cf4a9 --- /dev/null +++ b/app/Policies/OrientierungPolicy.php @@ -0,0 +1,70 @@ +can('ViewAny:Orientierung'); + } + + public function view(AuthUser $authUser, Orientierung $orientierung): bool + { + return $authUser->can('View:Orientierung'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:Orientierung'); + } + + public function update(AuthUser $authUser, Orientierung $orientierung): bool + { + return $authUser->can('Update:Orientierung'); + } + + public function delete(AuthUser $authUser, Orientierung $orientierung): bool + { + return $authUser->can('Delete:Orientierung'); + } + + public function restore(AuthUser $authUser, Orientierung $orientierung): bool + { + return $authUser->can('Restore:Orientierung'); + } + + public function forceDelete(AuthUser $authUser, Orientierung $orientierung): bool + { + return $authUser->can('ForceDelete:Orientierung'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:Orientierung'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:Orientierung'); + } + + public function replicate(AuthUser $authUser, Orientierung $orientierung): bool + { + return $authUser->can('Replicate:Orientierung'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:Orientierung'); + } + +} \ No newline at end of file diff --git a/database/migrations/2025_10_05_062854_create_orientierung_table.php b/database/migrations/2025_10_05_062854_create_orientierung_table.php new file mode 100644 index 0000000..8de48ff --- /dev/null +++ b/database/migrations/2025_10_05_062854_create_orientierung_table.php @@ -0,0 +1,30 @@ +id(); + $table->string('name'); + $table->integer('seitig')->default(0); + $table->boolean('selectable'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('orientierungs'); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 746603f..e876cb2 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -15,6 +15,7 @@ class DatabaseSeeder extends Seeder KontoSeeder::class, RolesAndPermissionsSeeder::class, KontoOptionSeeder::class, + OrientierungenSeeder::class, ]); } } diff --git a/database/seeders/OrientierungenSeeder.php b/database/seeders/OrientierungenSeeder.php new file mode 100644 index 0000000..5badf90 --- /dev/null +++ b/database/seeders/OrientierungenSeeder.php @@ -0,0 +1,65 @@ + '', + 'nav.group' => 'Kunden', 'nav.role.icon' => 'heroicon-o-shield-check', 'nav.role.label' => 'Rollen', 'resource.label.role' => 'Rolle',