Removed all controller and view files related to Colors, Filaments, Filament Types, and Manufacturers.
This commit is contained in:
@@ -27,19 +27,21 @@ class Filament extends Component
|
||||
public $type_id = '';
|
||||
public $manufacturer_id = '';
|
||||
public $weight = '1000';
|
||||
public $finish = 'Basic';
|
||||
public $price = '0';
|
||||
public $stock = '0';
|
||||
|
||||
|
||||
public $search = '';
|
||||
|
||||
public $editid = '';
|
||||
public $deleteid = '';
|
||||
|
||||
|
||||
public function create() {
|
||||
@Auth::check();
|
||||
|
||||
// Validate
|
||||
$this->validate();
|
||||
$this->validate();
|
||||
|
||||
$filament = new Model();
|
||||
$filament->name = $this->name;
|
||||
@@ -47,8 +49,9 @@ class Filament extends Component
|
||||
$filament->diameter = $this->diameter;
|
||||
$filament->color_id = $this->color_id;
|
||||
$filament->filament_type_id = $this->type_id;
|
||||
$filament->manufacturer_id = $this->manufacturer_id;
|
||||
$filament->manufacturer_id = $this->manufacturer_id;
|
||||
$filament->weight = $this->weight;
|
||||
$filament->finish = $this->finish;
|
||||
$filament->price = $this->price;
|
||||
$filament->stock = $this->stock;
|
||||
$filament->save();
|
||||
@@ -75,28 +78,30 @@ class Filament extends Component
|
||||
$this->type_id = $filament->filament_type_id;
|
||||
$this->manufacturer_id = $filament->manufacturer_id;
|
||||
$this->weight = $filament->weight;
|
||||
$filament->finish = $this->finish;
|
||||
$this->price = $filament->price;
|
||||
$this->stock = $filament->stock;
|
||||
|
||||
|
||||
Flux::modal('editModal')->show();
|
||||
}
|
||||
public function save($editid) {
|
||||
@Auth::check();
|
||||
|
||||
|
||||
$filament = Model::findOrFail($editid);
|
||||
$filament->name = $this->name;
|
||||
$filament->description = $this->description;
|
||||
$filament->diameter = $this->diameter;
|
||||
$filament->color_id = $this->color_id;
|
||||
$filament->filament_type_id = $this->type_id;
|
||||
$filament->manufacturer_id = $this->manufacturer_id;
|
||||
$filament->manufacturer_id = $this->manufacturer_id;
|
||||
$filament->weight = $this->weight;
|
||||
$filament->finish = $this->finish;
|
||||
$filament->price = $this->price;
|
||||
$filament->stock = $this->stock;
|
||||
$filament->save();
|
||||
|
||||
$this->resetInputFields();
|
||||
|
||||
|
||||
Flux::modal('editModal')->close();
|
||||
}
|
||||
|
||||
@@ -114,6 +119,7 @@ class Filament extends Component
|
||||
$this->type_id = $filament->filament_type_id;
|
||||
$this->manufacturer_id = $filament->manufacturer_id;
|
||||
$this->weight = $filament->weight;
|
||||
$this->finish = $filament->finish;
|
||||
$this->price = $filament->price;
|
||||
$this->stock = $filament->stock;
|
||||
|
||||
@@ -136,7 +142,7 @@ class Filament extends Component
|
||||
Flux::modals()->close();
|
||||
}
|
||||
public function resetInputFields() {
|
||||
$this->reset(['name', 'description', 'diameter', 'color_id', 'type_id', 'manufacturer_id', 'weight', 'price', 'stock', 'deleteid', 'editid']);
|
||||
$this->reset(['name', 'description', 'diameter', 'color_id', 'type_id', 'manufacturer_id', 'weight', 'price', 'finish', 'deleteid', 'editid']);
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ use Livewire\Attributes\title;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Filament;
|
||||
|
||||
#[title('Manufacturer List')]
|
||||
class Manufacturer extends Component{
|
||||
@@ -30,7 +31,7 @@ class Manufacturer extends Component{
|
||||
|
||||
|
||||
// Validate
|
||||
$this->validate();
|
||||
$this->validate();
|
||||
|
||||
$manufacturer = new Model();
|
||||
$manufacturer->name = $this->name;
|
||||
@@ -55,12 +56,12 @@ class Manufacturer extends Component{
|
||||
$this->name = $manufacturer->name;
|
||||
$this->description = $manufacturer->description;
|
||||
$this->website = $manufacturer->website;
|
||||
|
||||
|
||||
Flux::modal('editModal')->show();
|
||||
}
|
||||
public function save($editid) {
|
||||
@Auth::check();
|
||||
|
||||
|
||||
$manufacturer = Model::findOrFail($editid);
|
||||
$manufacturer->name = $this->name;
|
||||
$manufacturer->description = $this->description;
|
||||
@@ -68,7 +69,7 @@ class Manufacturer extends Component{
|
||||
$manufacturer->save();
|
||||
|
||||
$this->resetInputFields();
|
||||
|
||||
|
||||
Flux::modal('editModal')->close();
|
||||
}
|
||||
public function deleteModal($manufacturerid) {
|
||||
@@ -105,6 +106,7 @@ class Manufacturer extends Component{
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
return view('livewire.filament.manufacturer', [
|
||||
'manufacturers' => Model::search('name', $this->search)->paginate(10)
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user