Renamed and reorganized Livewire components, namespaces, and views for improved file structure and clarity. Introduced filaments.show and filaments.edit routes. Updated database migrations and navigation routes accordingly. Upgraded dependencies in composer.
This commit is contained in:
@@ -1,133 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use App\Models\Manufacturer as Manufacturer;
|
||||
use Flux\Flux;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
use App\Models\Buildplate as BuildplateModel;
|
||||
|
||||
#[title('Buildplates')]
|
||||
class Buildplate extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
#[Validate('required')]
|
||||
public $name = '';
|
||||
public $description = '';
|
||||
public $manufacturer_id = '';
|
||||
public $temp_max = '';
|
||||
public $amount = '';
|
||||
|
||||
public $search ='';
|
||||
|
||||
// Edit Modal + Query
|
||||
public $editquery = '';
|
||||
|
||||
public $editid = '';
|
||||
public $deleteid = '';
|
||||
|
||||
public function create() {
|
||||
@Auth::check();
|
||||
|
||||
|
||||
// Validate
|
||||
$this->validate();
|
||||
|
||||
$buildplate = new BuildplateModel();
|
||||
$buildplate->name = $this->name;
|
||||
$buildplate->description = $this->description;
|
||||
$buildplate->manufacturer_id = $this->manufacturer_id;
|
||||
$buildplate->temp_max = $this->temp_max;
|
||||
$buildplate->amount = $this->amount;
|
||||
$buildplate->save();
|
||||
|
||||
// Clear the form
|
||||
$this->resetInputFields();
|
||||
|
||||
// Close the modal
|
||||
Flux::modal('createModal')->close();
|
||||
}
|
||||
|
||||
public function edit($buildplateid) {
|
||||
@Auth::check();
|
||||
|
||||
$editid = $buildplateid;
|
||||
$this->editid = $editid;
|
||||
|
||||
$buildplate = BuildplateModel::findOrFail($editid);
|
||||
|
||||
$this->name = $buildplate->name;
|
||||
$this->description = $buildplate->description;
|
||||
$this->manufacturer_id = $buildplate->manufacturer_id;
|
||||
$this->temp_max = $buildplate->temp_max;
|
||||
$this->amount = $buildplate->amount;
|
||||
|
||||
Flux::modal('editModal')->show();
|
||||
}
|
||||
|
||||
public function save($editid) {
|
||||
@Auth::check();
|
||||
|
||||
$buildplate = BuildplateModel::findOrFail($editid);
|
||||
$buildplate->name = $this->name;
|
||||
$buildplate->description = $this->description;
|
||||
$buildplate->manufactuerer_id = $this->manufacturer_id;
|
||||
$buildplate->temp_max = $this->temp_max;
|
||||
$buildplate->amount = $this->amount;
|
||||
$buildplate->save();
|
||||
|
||||
$this->resetInputFields();
|
||||
|
||||
Flux::modal('editModal')->close();
|
||||
}
|
||||
|
||||
public function deleteModal($buildplateid) {
|
||||
@Auth::check();
|
||||
|
||||
$deleteid = $buildplateid;
|
||||
$this->deleteid = $deleteid;
|
||||
|
||||
$buildplate = BuildplateModel::findOrFail($deleteid);
|
||||
$this->name = $buildplate->name;
|
||||
$this->description = $buildplate->description;
|
||||
$this->manufacturer_id = $buildplate->manufacturer_id;
|
||||
$this->temp_max = $buildplate->temp_max;
|
||||
$this->amount = $buildplate->amount;
|
||||
|
||||
Flux::modal('deleteModal')->show();
|
||||
}
|
||||
|
||||
public function delete($deleteid) {
|
||||
@Auth::check();
|
||||
|
||||
$buildplate = BuildplateModel::findOrFail($deleteid)->delete();
|
||||
|
||||
$this->deleteid = $deleteid;
|
||||
Flux::modal('deleteModal')->close();
|
||||
|
||||
// Clear the form
|
||||
$this->resetInputFields();
|
||||
}
|
||||
|
||||
public function cancel() {
|
||||
$this->resetInputFields();
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
public function resetInputFields() {
|
||||
$this->reset(['name', 'description', 'manufacturer_id', 'temp_max', 'amount', 'deleteid', 'editid']);;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.buildplate', [
|
||||
'buildplates' => BuildplateModel::search('name', $this->search)->paginate(20),
|
||||
'manufacturers' => Manufacturer::all(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\title;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Flux\Flux;
|
||||
|
||||
use App\Models\Color as ColorModel;
|
||||
|
||||
#[title('Colors')]
|
||||
class Color extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
// Validation
|
||||
#[Validate('required')]
|
||||
public $name = '';
|
||||
|
||||
#[Validate('required')]
|
||||
public $hex = '';
|
||||
|
||||
public $search ='';
|
||||
|
||||
// Edit Modal + Query
|
||||
public $editquery = '';
|
||||
|
||||
public $editid = '';
|
||||
public $deleteid = '';
|
||||
|
||||
|
||||
public function create() {
|
||||
@Auth::check();
|
||||
|
||||
|
||||
// Validate
|
||||
$this->validate();
|
||||
|
||||
$color = new ColorModel();
|
||||
$color->name = $this->name;
|
||||
$color->hex = $this->hex;
|
||||
$color->save();
|
||||
|
||||
session()->flash('status', 'Color successfully created.');
|
||||
|
||||
// Clear the form
|
||||
$this->reset(['name', 'hex']);
|
||||
|
||||
// Close the modal
|
||||
Flux::modal('createModal')->close();
|
||||
}
|
||||
|
||||
public function edit($colorid) {
|
||||
@Auth::check();
|
||||
|
||||
$editid = $colorid;
|
||||
$this->editid = $editid;
|
||||
|
||||
$color =ColorModel::findOrFail($editid);
|
||||
|
||||
$this->name = $color->name;
|
||||
$this->hex = $color->hex;
|
||||
|
||||
Flux::modal('editModal')->show();
|
||||
}
|
||||
|
||||
public function save($editid) {
|
||||
@Auth::check();
|
||||
|
||||
$color = ColorModel::findOrFail($editid);
|
||||
$color->name = $this->name;
|
||||
$color->hex = $this->hex;
|
||||
$color->save();
|
||||
|
||||
session()->flash('status', 'Color successfully updated.');
|
||||
|
||||
Flux::modal('editModal')->close();
|
||||
}
|
||||
|
||||
public function deleteModal($colorid) {
|
||||
@Auth::check();
|
||||
|
||||
$deleteid = $colorid;
|
||||
$this->deleteid = $deleteid;
|
||||
|
||||
$color = ColorModel::findOrFail($colorid);
|
||||
$this->name = $color->name;
|
||||
$this->hex = $color->hex;
|
||||
|
||||
Flux::modal('deleteModal')->show();
|
||||
}
|
||||
public function delete($deleteid) {
|
||||
@Auth::check();
|
||||
|
||||
$color = ColorModel::findOrFail($deleteid)->delete();
|
||||
|
||||
$this->deleteid = $deleteid;
|
||||
Flux::modal('deleteModal')->close();
|
||||
|
||||
// Clear the form
|
||||
$this->reset(['name', 'hex', 'deleteid']);
|
||||
|
||||
session()->flash('status', 'Color successfully deleted.');
|
||||
}
|
||||
|
||||
public function cancel() {
|
||||
$this->reset(['name', 'hex', 'deleteid']);
|
||||
Flux::modals()->close();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.color', [
|
||||
'colors' => ColorModel::search('name', $this->search)->paginate(20)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Models\Filament as Model;
|
||||
use App\Models\Manufacturer;
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\Attributes\title;
|
||||
|
||||
#[title('Show Filament')]
|
||||
class CreateFilament extends Component
|
||||
{
|
||||
|
||||
public Model $filament ;
|
||||
|
||||
public function back(){
|
||||
return redirect()->route('filaments.index');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.edit-filament', [
|
||||
'manufacturers' => Manufacturer::all(),
|
||||
'colors' => \App\Models\Color::all(),
|
||||
'types' => \App\Models\FilamentType::all()
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Models\Filament as Model;
|
||||
use App\Models\Manufacturer;
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\Attributes\title;
|
||||
|
||||
#[title('Show Filament')]
|
||||
class EditFilament extends Component
|
||||
{
|
||||
|
||||
public Model $filament ;
|
||||
|
||||
public function back(){
|
||||
return redirect()->route('filaments.index');
|
||||
}
|
||||
|
||||
public function show($id){
|
||||
return redirect()->route('filaments.show', $id);
|
||||
}
|
||||
|
||||
public function mount(Model $filament){
|
||||
$this->filament = $filament;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.edit', [
|
||||
'manufacturers' => Manufacturer::all(),
|
||||
'colors' => \App\Models\Color::all(),
|
||||
'types' => \App\Models\FilamentType::all()
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -63,27 +63,6 @@ class Filament extends Component
|
||||
Flux::modal('createModal')->close();
|
||||
}
|
||||
|
||||
public function edit($filamentid) {
|
||||
@Auth::check();
|
||||
|
||||
$editid = $filamentid;
|
||||
$this->editid = $editid;
|
||||
|
||||
$filament = Model::findOrFail($editid);
|
||||
|
||||
$this->name = $filament->name;
|
||||
$this->description = $filament->description;
|
||||
$this->diameter = $filament->diameter;
|
||||
$this->color_id = $filament->color_id;
|
||||
$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();
|
||||
|
||||
@@ -144,9 +123,18 @@ class Filament extends Component
|
||||
public function resetInputFields() {
|
||||
$this->reset(['name', 'description', 'diameter', 'color_id', 'type_id', 'manufacturer_id', 'weight', 'price', 'finish', 'deleteid', 'editid']);
|
||||
}
|
||||
|
||||
public function show($id){
|
||||
return redirect()->route('filaments.show', $id);
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
return redirect()->route('filaments.edit', $id);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.filament', [
|
||||
return view('livewire.filament.index', [
|
||||
'filaments' => Model::search('name', $this->search)->paginate(50),
|
||||
'colors' => Color::all(),
|
||||
'manufacturers' => Manufacturer::all(),
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
use App\Models\Manufacturer as Model;
|
||||
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{
|
||||
use WithPagination;
|
||||
|
||||
#[Validate('required')]
|
||||
public $name = '';
|
||||
|
||||
public $description = '';
|
||||
public $website = '';
|
||||
|
||||
public $search ='';
|
||||
|
||||
public $editid = '';
|
||||
public $deleteid = '';
|
||||
|
||||
public function create() {
|
||||
@Auth::check();
|
||||
|
||||
|
||||
// Validate
|
||||
$this->validate();
|
||||
|
||||
$manufacturer = new Model();
|
||||
$manufacturer->name = $this->name;
|
||||
$manufacturer->description = $this->description;
|
||||
$manufacturer->website = $this->website;
|
||||
$manufacturer->save();
|
||||
|
||||
// Clear the form
|
||||
$this->resetInputFields();
|
||||
|
||||
// Close the modal
|
||||
Flux::modal('createModal')->close();
|
||||
}
|
||||
public function edit($manufacturerid) {
|
||||
@Auth::check();
|
||||
|
||||
$editid = $manufacturerid;
|
||||
$this->editid = $editid;
|
||||
|
||||
$manufacturer = Model::findOrFail($editid);
|
||||
|
||||
$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;
|
||||
$manufacturer->website = $this->website;
|
||||
$manufacturer->save();
|
||||
|
||||
$this->resetInputFields();
|
||||
|
||||
Flux::modal('editModal')->close();
|
||||
}
|
||||
public function deleteModal($manufacturerid) {
|
||||
@Auth::check();
|
||||
|
||||
$deleteid = $manufacturerid;
|
||||
$this->deleteid = $deleteid;
|
||||
|
||||
$manufacturer = Model::findOrFail($deleteid);
|
||||
$this->name = $manufacturer->name;
|
||||
$this->description = $manufacturer->description;
|
||||
$this->website = $manufacturer->website;
|
||||
|
||||
Flux::modal('deleteModal')->show();
|
||||
}
|
||||
public function delete($deleteid) {
|
||||
@Auth::check();
|
||||
|
||||
$manufacturer = Model::findOrFail($deleteid)->delete();
|
||||
|
||||
$this->deleteid = $deleteid;
|
||||
Flux::modal('deleteModal')->close();
|
||||
|
||||
// Clear the form
|
||||
$this->resetInputFields();
|
||||
}
|
||||
public function cancel() {
|
||||
$this->resetInputFields();
|
||||
Flux::modals()->close();
|
||||
}
|
||||
public function resetInputFields() {
|
||||
$this->reset(['name', 'description', 'website', 'deleteid', 'editid']);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
|
||||
return view('livewire.filament.manufacturer', [
|
||||
'manufacturers' => Model::search('name', $this->search)->paginate(10)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use Livewire\Component;
|
||||
use App\Models\Filament as Model;
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\Attributes\title;
|
||||
|
||||
#[title('Show Filament')]
|
||||
class ShowFilament extends Component
|
||||
{
|
||||
|
||||
public Model $filament ;
|
||||
|
||||
public function back(){
|
||||
return redirect()->route('filaments.index');
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
return redirect()->route('filaments.edit', $id);
|
||||
}
|
||||
|
||||
public function mount(Model $filament){
|
||||
$this->filament = $filament;
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.show-filament', [
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Filament;
|
||||
|
||||
use Livewire\Component;
|
||||
use Livewire\Attributes\title;
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\Attributes\Validate;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\FilamentType;
|
||||
use Flux\Flux;
|
||||
|
||||
#[title('Types')]
|
||||
class Type extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
// Validation
|
||||
#[Validate('required')]
|
||||
public $name = '';
|
||||
|
||||
public $description = '';
|
||||
|
||||
public $search ='';
|
||||
|
||||
public $editid = '';
|
||||
public $deleteid = '';
|
||||
|
||||
public $amount = '0';
|
||||
|
||||
|
||||
public function create() {
|
||||
@Auth::check();
|
||||
|
||||
|
||||
// Validate
|
||||
$this->validate();
|
||||
|
||||
$type = new FilamentType();
|
||||
$type->name = $this->name;
|
||||
$type->description = $this->description;
|
||||
$type->save();
|
||||
|
||||
// Clear the form
|
||||
$this->resetInputFields();
|
||||
|
||||
// Close the modal
|
||||
Flux::modal('createModal')->close();
|
||||
}
|
||||
|
||||
public function edit($typeid) {
|
||||
@Auth::check();
|
||||
|
||||
$editid = $typeid;
|
||||
$this->editid = $editid;
|
||||
|
||||
$type =FilamentType::findOrFail($editid);
|
||||
|
||||
$this->name = $type->name;
|
||||
$this->description = $type->description;
|
||||
|
||||
Flux::modal('editModal')->show();
|
||||
}
|
||||
|
||||
public function save($editid) {
|
||||
@Auth::check();
|
||||
|
||||
$type = FilamentType::findOrFail($editid);
|
||||
$type->name = $this->name;
|
||||
$type->description = $this->description;
|
||||
$type->save();
|
||||
|
||||
$this->resetInputFields();
|
||||
|
||||
Flux::modal('editModal')->close();
|
||||
}
|
||||
public function deleteModal($typeid) {
|
||||
@Auth::check();
|
||||
|
||||
$deleteid = $typeid;
|
||||
$this->deleteid = $deleteid;
|
||||
|
||||
$type = FilamentType::findOrFail($deleteid);
|
||||
$this->name = $type->name;
|
||||
$this->description = $type->description;
|
||||
|
||||
Flux::modal('deleteModal')->show();
|
||||
}
|
||||
public function delete($deleteid) {
|
||||
@Auth::check();
|
||||
|
||||
$type = FilamentType::findOrFail($deleteid)->delete();
|
||||
|
||||
$this->deleteid = $deleteid;
|
||||
Flux::modal('deleteModal')->close();
|
||||
|
||||
// Clear the form
|
||||
$this->resetInputFields();
|
||||
}
|
||||
|
||||
public function cancel() {
|
||||
$this->resetInputFields();
|
||||
Flux::modals()->close();
|
||||
}
|
||||
|
||||
public function resetInputFields() {
|
||||
$this->reset(['name', 'description', 'deleteid', 'editid']);
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.filament.type', [
|
||||
'types' => FilamentType::search('name', $this->search)->paginate(10)
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user