Added Extruder Livewire components with Create, Edit, Show, and Index. Introduced corresponding routes, views, and navigation updates. Enhanced Buildplate and Manufacturer views for improved linking and consistency.

This commit is contained in:
2025-12-14 04:33:55 +01:00
parent 95f0154235
commit 4759df9077
12 changed files with 449 additions and 25 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace App\Livewire\Extruder;
use App\Models\Extruder as Model;
use Livewire\Attributes\Title;
use Livewire\Component;
#[title('Extruders')]
class EditExtruder extends Component
{
public Model $extruder ;
public string $name = '';
public string $description = '';
public int $manufacturer_id = 0;
public string $diameter = '';
public string $temp_max = '';
public function mount(Model $extruder){
$this->extruder = $extruder;
$this->name = $extruder->name;
$this->description = $extruder->description;
$this->manufacturer_id = $extruder->manufacturer_id;
$this->diameter = $extruder->diameter;
$this->temp_max = $extruder->temp_max;
}
public function save(){
$this->validate([
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string', 'max:255'],
'manufacturer_id' => ['required', 'integer'],
'diameter' => ['required', 'string', 'max:4'],
'temp_max' => ['required', 'integer']
]);
$this->extruder->update([
'name' => $this->name,
'description' => $this->description,
'manufacturer_id' => $this->manufacturer_id,
'diameter' => $this->diameter,
'temp_max' => $this->temp_max
]);
return $this->redirectRoute('extruder.show', $this->extruder->id, navigate: true);
}
public function cancel(){
return $this->redirectRoute('extruder.index', navigate: true);
}
public function render()
{
return view('livewire.extruder.edit', [
]);
}
}