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:
@@ -0,0 +1,40 @@
|
||||
<?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 CreateManufacturer extends Component{
|
||||
|
||||
public Model $manufacturer ;
|
||||
public string $name = '';
|
||||
public string $description = '';
|
||||
public string $website = '';
|
||||
|
||||
#[Validate('required')]
|
||||
public function save(){
|
||||
$this->validate([
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'description' => ['nullable', 'string'],
|
||||
'website' => ['nullable', 'string', 'max:255']
|
||||
]);
|
||||
|
||||
$manufacturer = new Model();
|
||||
$manufacturer->name = $this->name;
|
||||
$manufacturer->description = $this->description;
|
||||
$manufacturer->website = $this->website;
|
||||
$manufacturer->save();
|
||||
|
||||
return redirect()->route('manufacturer.index');
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
|
||||
return view('livewire.manufacturer.create', [
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user