Refactored Manufacturer and Buildplate Livewire components. Introduced create, edit, and show components with route-based navigation. Updated views for consistency and cleaned up unused modals and legacy code. Adjusted styles and table layouts.

This commit is contained in:
2025-12-14 02:30:52 +01:00
parent ac812ed142
commit 95f0154235
22 changed files with 599 additions and 382 deletions
@@ -0,0 +1,52 @@
<?php
namespace App\Livewire\Manufacturer;
use App\Models\Manufacturer as Model;
use Livewire\Attributes\title;
use Livewire\Attributes\Validate;
use Livewire\Component;
#[title('Manufacturer List')]
class EditManufacturer extends Component{
public Model $manufacturer ;
public string $name = '';
public string $description = '';
public string $website = '';
public function mount(Model $manufacturer){
$this->manufacturer = $manufacturer;
$this->name = $manufacturer->name;
$this->description = $manufacturer->description;
$this->website = $manufacturer->website;
}
#[Validate('required')]
public function save(){
$this->validate([
'name' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'website' => ['nullable', 'string', 'max:255']
]);
$this->manufacturer->update([
'name' => $this->name,
'description' => $this->description,
'website' => $this->website
]);
return $this->redirectRoute('manufacturer.show', $this->manufacturer->id, navigate: true);
}
public function cancel(){
return $this->redirectRoute('manufacturer.index', navigate: true);
}
public function render()
{
return view('livewire.manufacturer.edit', [
]);
}
}