orientierung
This commit is contained in:
1 parent
326d827543
commit
0b1a1493b2
15 files changed
+363
-6
No files matched your search
+5
-5
@@ -2,8 +2,8 @@ a make:model Customer -ms
|
|||||||
|
|
||||||
a make:filament-resource Customer
|
a make:filament-resource Customer
|
||||||
|
|
||||||
php artisan make:model ModelName -m // creates migration too
|
a make:model ModelName -m // creates migration too
|
||||||
php artisan make:model ModelName -c // creates controller too
|
a make:model ModelName -c // creates controller too
|
||||||
php artisan make:model ModelName -f // also creates a factory
|
a make:model ModelName -f // also creates a factory
|
||||||
php artisan make:model ModelName -s // also creates a database seeder
|
a 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 -mfcs // creates migration, factory, controller and seeder
|
||||||
@@ -13,6 +13,7 @@ use BackedEnum;
|
|||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
class KontoOptionResource extends Resource
|
class KontoOptionResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,8 @@ class KontoOptionResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $cluster = AdministrationCluster::class;
|
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|BackedEnum|null $navigationIcon = 'lucide-key-square';
|
||||||
|
|
||||||
protected static ?string $navigationLabel = 'Konto Optionen';
|
protected static ?string $navigationLabel = 'Konto Optionen';
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Orientierungs;
|
||||||
|
|
||||||
|
use App\Filament\Clusters\Administration\AdministrationCluster;
|
||||||
|
use App\Filament\Resources\Orientierungs\Pages\ListOrientierungs;
|
||||||
|
use App\Filament\Resources\Orientierungs\Schemas\OrientierungForm;
|
||||||
|
use App\Filament\Resources\Orientierungs\Tables\OrientierungsTable;
|
||||||
|
use App\Models\Orientierung;
|
||||||
|
use BackedEnum;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
|
class OrientierungResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = Orientierung::class;
|
||||||
|
|
||||||
|
protected static ?string $cluster = AdministrationCluster::class;
|
||||||
|
|
||||||
|
protected static string|UnitEnum|null $navigationGroup = 'Programm';
|
||||||
|
|
||||||
|
protected static string|BackedEnum|null $navigationIcon = 'lucide-compass';
|
||||||
|
|
||||||
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|
||||||
|
protected static ?string $navigationLabel = 'Orientierung';
|
||||||
|
|
||||||
|
protected static ?string $modelLabel = 'Orientierung';
|
||||||
|
|
||||||
|
protected static ?string $pluralModelLabel = 'Orientierungen';
|
||||||
|
|
||||||
|
public static function form(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return OrientierungForm::configure($schema);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return OrientierungsTable::configure($table);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => ListOrientierungs::route('/'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getNavigationBadge(): ?string
|
||||||
|
{
|
||||||
|
return parent::getEloquentQuery()->where('selectable', true)->count();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Orientierungs\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Orientierungs\OrientierungResource;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateOrientierung extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = OrientierungResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Orientierungs\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Orientierungs\OrientierungResource;
|
||||||
|
use Filament\Actions\DeleteAction;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditOrientierung extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = OrientierungResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// DeleteAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Orientierungs\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\Orientierungs\OrientierungResource;
|
||||||
|
use Filament\Actions\CreateAction;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListOrientierungs extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = OrientierungResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
// CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Orientierungs\Schemas;
|
||||||
|
|
||||||
|
use Filament\Schemas\Schema;
|
||||||
|
|
||||||
|
class OrientierungForm
|
||||||
|
{
|
||||||
|
public static function configure(Schema $schema): Schema
|
||||||
|
{
|
||||||
|
return $schema
|
||||||
|
->components([
|
||||||
|
//
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\Orientierungs\Tables;
|
||||||
|
|
||||||
|
use Filament\Tables\Columns\TextColumn;
|
||||||
|
use Filament\Tables\Filters\SelectFilter;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
|
||||||
|
class OrientierungsTable
|
||||||
|
{
|
||||||
|
public static function configure(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->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',
|
||||||
|
]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@ use BackedEnum;
|
|||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Schemas\Schema;
|
use Filament\Schemas\Schema;
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
|
use UnitEnum;
|
||||||
|
|
||||||
class PermissionResource extends Resource
|
class PermissionResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,8 @@ class PermissionResource extends Resource
|
|||||||
|
|
||||||
protected static ?string $cluster = AdministrationCluster::class;
|
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|BackedEnum|null $navigationIcon = 'lucide-toggle-right';
|
||||||
|
|
||||||
protected static ?string $recordTitleAttribute = 'name';
|
protected static ?string $recordTitleAttribute = 'name';
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Orientierung extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
public static function map()
|
||||||
|
{
|
||||||
|
$res = static::getModel()::where('selectable', 1)->get();
|
||||||
|
$arr = [];
|
||||||
|
foreach ($res as $value) {
|
||||||
|
$arr[$value['id']] = $value['name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Auth\User as AuthUser;
|
||||||
|
use App\Models\Orientierung;
|
||||||
|
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||||
|
|
||||||
|
class OrientierungPolicy
|
||||||
|
{
|
||||||
|
use HandlesAuthorization;
|
||||||
|
|
||||||
|
public function viewAny(AuthUser $authUser): bool
|
||||||
|
{
|
||||||
|
return $authUser->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');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('orientierungs', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->string('name');
|
||||||
|
$table->integer('seitig')->default(0);
|
||||||
|
$table->boolean('selectable');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('orientierungs');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -15,6 +15,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
KontoSeeder::class,
|
KontoSeeder::class,
|
||||||
RolesAndPermissionsSeeder::class,
|
RolesAndPermissionsSeeder::class,
|
||||||
KontoOptionSeeder::class,
|
KontoOptionSeeder::class,
|
||||||
|
OrientierungenSeeder::class,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class OrientierungenSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO `orientierungs` (`id`, `name`, `seitig`, `selectable`, `created_at`, `updated_at`)
|
||||||
|
VALUES
|
||||||
|
('1', 'Ohne Zuordnung', '0', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('2', 'E I N S E I T I G', '0', '0', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('3', 'N', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('4', 'S', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('5', 'O', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('6', 'W', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('7', 'NW', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('8', 'SW', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('9', 'NO', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('10', 'SO', '1', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('11', 'Z W E I S E I T I G', '0', '0', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('12', 'N/S', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('13', 'N/O', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('14', 'N/W', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('15', 'S/O', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('16', 'S/W', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('17', 'O/W', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('18', 'NW/SW', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('19', 'NW/NO', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('20', 'NW/SO', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('21', 'SW/NO', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('22', 'SW/SO', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('23', 'NO/SO', '2', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('24', 'D R E I S E I T I G', '0', '0', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('25', 'N/S/O', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('26', 'N/S/W', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('27', 'N/O/W', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('28', 'S/O/W', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('29', 'NW/SW/NO', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('30', 'NW/SW/SO', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('31', 'NW/NO/SO', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('32', 'SW/NO/SO', '3', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('33', 'V I E R S E I T I G', '0', '0', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('34', 'N/S/O/W', '4', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('35', 'NW/SW/NO/S', '4', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('36', 'E X T R A S', '0', '0', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('37', 'S-SO', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('38', 'S-SW', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('39', 'S-SO-NO', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('40', 'SW/NO/N', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('41', 'SW/NO/W', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('42', 'SW/W', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('43', 'SW/SO/W', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49'),
|
||||||
|
('44', 'N/SW', '5', '1', '2025-09-23 10:25:49', '2025-09-23 10:25:49');
|
||||||
|
";
|
||||||
|
|
||||||
|
DB::unprepared($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -31,7 +31,7 @@ return [
|
|||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'nav.group' => '',
|
'nav.group' => 'Kunden',
|
||||||
'nav.role.icon' => 'heroicon-o-shield-check',
|
'nav.role.icon' => 'heroicon-o-shield-check',
|
||||||
'nav.role.label' => 'Rollen',
|
'nav.role.label' => 'Rollen',
|
||||||
'resource.label.role' => 'Rolle',
|
'resource.label.role' => 'Rolle',
|
||||||
|
|||||||
Reference in new issue
Block a user