Created FilamentTypeController & FilamentType Model

This commit is contained in:
2025-03-10 19:28:46 +01:00
parent 9fd01ee43a
commit 21f33383ae
15 changed files with 404 additions and 5 deletions
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ $title ?? 'Page Title' }}</title>
</head>
<body>
{{ $slot }}
</body>
</html>
+4 -4
View File
@@ -5,10 +5,10 @@
<flux:brand href="{{ route('dashboard') }}" logo="https://fluxui.dev/img/demo/dark-mode-logo.png" name="Filament" class="max-lg:hidden! hidden dark:flex" />
<flux:navbar class="-mb-px max-lg:hidden">
<flux:navbar.item icon="home" href="{{ route('dashboard') }}" current>Dashboard</flux:navbar.item>
<flux:navbar.item icon="archive-box" href="#">Hersteller</flux:navbar.item>
<flux:navbar.item icon="circle-stack" href="#">Filamente</flux:navbar.item>
<flux:navbar.item icon="chart-pie" badge="12" href="#">Arten</flux:navbar.item>
<flux:navbar.item icon="home" href="{{ route('dashboard') }}">Dashboard</flux:navbar.item>
<flux:navbar.item icon="archive-box" href="#">Manufacturers</flux:navbar.item>
<flux:navbar.item icon="circle-stack" href="#">Filaments</flux:navbar.item>
<flux:navbar.item icon="chart-pie" href="{{ route('types.index') }}">Types</flux:navbar.item>
</flux:navbar>
<flux:spacer />
@@ -0,0 +1,43 @@
{{-- Credit: Lucide (https://lucide.dev) --}}
@props([
'variant' => 'outline',
])
@php
if ($variant === 'solid') {
throw new \Exception('The "solid" variant is not supported in Lucide.');
}
$classes = Flux::classes('shrink-0')
->add(match($variant) {
'outline' => '[:where(&)]:size-6',
'solid' => '[:where(&)]:size-6',
'mini' => '[:where(&)]:size-5',
'micro' => '[:where(&)]:size-4',
});
$strokeWidth = match ($variant) {
'outline' => 2,
'mini' => 2.25,
'micro' => 2.5,
};
@endphp
<svg
{{ $attributes->class($classes) }}
data-flux-icon
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="{{ $strokeWidth }}"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
data-slot="icon"
>
<circle cx="12" cy="12" r="1" />
<circle cx="19" cy="12" r="1" />
<circle cx="5" cy="12" r="1" />
</svg>
+42
View File
@@ -0,0 +1,42 @@
{{-- Credit: Lucide (https://lucide.dev) --}}
@props([
'variant' => 'outline',
])
@php
if ($variant === 'solid') {
throw new \Exception('The "solid" variant is not supported in Lucide.');
}
$classes = Flux::classes('shrink-0')
->add(match($variant) {
'outline' => '[:where(&)]:size-6',
'solid' => '[:where(&)]:size-6',
'mini' => '[:where(&)]:size-5',
'micro' => '[:where(&)]:size-4',
});
$strokeWidth = match ($variant) {
'outline' => 2,
'mini' => 2.25,
'micro' => 2.5,
};
@endphp
<svg
{{ $attributes->class($classes) }}
data-flux-icon
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="{{ $strokeWidth }}"
stroke-linecap="round"
stroke-linejoin="round"
aria-hidden="true"
data-slot="icon"
>
<path d="M18 6 6 18" />
<path d="m6 6 12 12" />
</svg>
+1 -1
View File
@@ -28,7 +28,7 @@
<!-- Page Heading -->
@if (isset($header) || isset($headeraction))
<div class="bg-white dark:bg-zinc-700 shadow-sm ">
<div class="flex justify-between max-w-7xl mx-auto">
<div class="flex justify-between max-w-7xl mx-auto items-center">
@if (isset($header))
<x-header>
{{ $header }}
+36
View File
@@ -0,0 +1,36 @@
<x-app-layout>
<x-slot name="header">
{{ __('Create Types') }}
</x-slot>
<x-slot name="headeraction">
<div class="flex gap-4 justify-end">
<a href="{{ route('types.index') }}" class=" text-zinc-50 hover:text-zinc-300 font-bold text-base py-2 px-4 rounded cursor-pointer">Back</a>
<a href="{{ route('types.store') }}" onclick="event.preventDefault(); document.getElementById('create-type-form').submit();" class="bg-green-500 hover:bg-green-700 text-zinc-700 hover:text-white font-bold text-base py-2 px-4 rounded cursor-pointer">Submit</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 p-4 overflow-hidden shadow-xl sm:rounded-lg">
<form id="create-type-form" class="flex flex-col gap-6" method="POST" action="{{ route('types.store') }}">
@csrf
<div class="form-group flex flex-col">
<label for="name" class="text-lg ">Name</label>
<input type="text" id="name" name="name" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required="">
</div>
<div class="form-group flex flex-col">
<label for="description">Description</label>
<textarea name="description" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required=""></textarea>
</div>
<div class="flex justify-end gap-4">
<a href="{{ route('types.index') }}" class="bg-zinc-500 hover:bg-zinc-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Cancel</a>
<button type="submit" class="bg-green-500 hover:bg-green-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Submit</button>
</div>
</form>
</div>
</div>
</div>
</x-app-layout>
+30
View File
@@ -0,0 +1,30 @@
<x-app-layout>
<x-slot name="header">
{{ __('Create Types') }}
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 p-4 overflow-hidden shadow-xl sm:rounded-lg">
<form id="update-type-form" class="flex flex-col gap-6" method="POST" action="{{ route('types.update', $type->id) }}">
@csrf
@method('PUT')
<div class="form-group flex flex-col">
<label for="name" class="text-lg ">Name</label>
<input type="text" id="name" name="name" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required="" value="{{ $type->name }}">
</div>
<div class="form-group flex flex-col">
<label for="description">Description</label>
<textarea name="description" class="form-control bg-white dark:bg-zinc-800 border-zinc-50 dark:border-zinc-600 rounded" required="" value="{{ $type->description }}"></textarea>
</div>
<div class="flex justify-end gap-4">
<a href="{{ route('types.index') }}" class="bg-zinc-500 hover:bg-zinc-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Cancel</a>
<button type="submit" class="bg-green-500 hover:bg-green-700 text-zinc-800 hover:text-white font-bold py-2 px-4 rounded cursor-pointer">Submit</button>
</div>
</form>
</div>
</div>
</div>
</x-app-layout>
+29
View File
@@ -0,0 +1,29 @@
<x-app-layout>
<x-slot name="header">
{{ __('Types') }}
</x-slot>
<x-slot name="headeraction">
<div class="flex gap-4 justify-end">
<a href="{{ route('types.create') }}" class="bg-zinc-500 hover:bg-green-500 text-zinc-50 hover:text-zinc-700 font-bold text-base py-2 px-4 rounded cursor-pointer">Create</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 overflow-hidden shadow-xl sm:rounded-lg">
<ul class="">
<li class="flex gap-6 bg-zinc-50 dark:bg-zinc-900 p-2 px-4"><div class="">ID</div><div class="">Name</div><div class="">Options</div></li>
@foreach ($types as $type)
<li class="flex gap-6 py-3 px-4 items-center">
<div class="p-2">{{ $type->id }}</div>
<div class="p-2"><a href="/types/{{ $type->id }}">{{ $type->name }}</a></div>
<div class="px-2"><a href="{{ route('types.edit', $type->id) }}"><flux:icon.ellipsis class="hover:text-zinc-50 hover:bg-zinc-500 stroke-3 rounded "/></a></div>
</li>
@endforeach
</ul>
</div>
</div>
</div>
</x-app-layout>
+31
View File
@@ -0,0 +1,31 @@
<x-app-layout>
<x-slot name="header">
{{ $type->name }}
</x-slot>
<x-slot name="headeraction">
<div class="flex gap-4 justify-end">
<a href="{{ route('types.index') }}" class=" text-zinc-50 hover:text-zinc-300 font-bold text-base py-2 px-4 rounded cursor-pointer">Back</a>
<a href="{{ route('types.edit', $type->id) }}" class="bg-zinc-500 hover:bg-zinc-700 text-zinc-50 hover:text-white font-bold text-base py-2 px-4 rounded cursor-pointer">Edit</a>
<a href="{{ route('types.destroy', $type->id) }}" onclick="event.preventDefault(); document.getElementById('delete-form-{{ $type->id }}').submit();" class="bg-red-500 hover:bg-red-500 text-zinc-50 hover:text-white font-bold text-base py-2 px-4 rounded cursor-pointer">Delete</a>
</div>
</x-slot>
<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-zinc-700 overflow-hidden shadow-xl sm:rounded-lg">
<div class="p-4">
<div class="text-lg font-bold">Description</div>
<div class="p-4">
{{ $type->description }}
</div>
</div>
<form id="delete-form-{{ $type->id }}" method="POST" action="{{ route('types.destroy', $type->id) }}" class="hidden">
@csrf
@method('DELETE')
</form>
</div>
</div>
</div>
</x-app-layout>