Add Spareparts module with CRUD functionality and UI components.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Sparepart;
|
||||
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Livewire\Component;
|
||||
use App\Models\Sparepart as Model;
|
||||
use App\Models\Manufacturer as Manufacturer;
|
||||
use Livewire\WithPagination;
|
||||
use Livewire\Attributes\title;
|
||||
|
||||
#[title('Filaments')]
|
||||
class Sparepart extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
|
||||
public Model $sparepart ;
|
||||
|
||||
public $search = '';
|
||||
|
||||
public function create(){
|
||||
return $this->redirectRoute('spareparts.create', navigate: true);
|
||||
}
|
||||
|
||||
public function show($id){
|
||||
return $this->redirectRoute('spareparts.show', $id);
|
||||
}
|
||||
|
||||
public function edit($id){
|
||||
return $this->redirectRoute('spareparts.edit', $id);
|
||||
}
|
||||
|
||||
public function delete($id){
|
||||
@Auth::check();
|
||||
Model::destroy($id);
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.sparepart.index', [
|
||||
'spareparts' => Model::search('name', $this->search)->paginate(25)
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user