Add Printers and Printertypes modules with CRUD functionality, migrations, and UI components.

This commit is contained in:
2026-01-24 11:23:37 +01:00
parent 563b0e750e
commit fd61f14ffe
25 changed files with 1017 additions and 4 deletions
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace App\Livewire\Printer;
use Livewire\Attributes\Validate;
use Livewire\Component;
use App\Models\Printer as Model;
use Livewire\Attributes\title;
#[title('Create Printertype')]
class CreatePrinter extends Component
{
public Model $printer ;
public string $name = '';
public string $description = '';
public int $printertype_id = 0;
#[Validate('required')]
public function save(){
$this->validate([
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:255'],
'printertype_id' => ['required', 'integer'],
]);
$printer = new Model();
$printer->name = $this->name;
$printer->description = $this->description;
$printer->printertype_id = $this->printertype_id;
$printer->save();
return $this->redirectRoute('printers.show', $printer->id, navigate: true);
}
public function cancel(){
return $this->redirectRoute('printers.index', navigate: true);
}
public function render()
{
return view('livewire.printer.create', [
]);
}
}