Full page livewire components versus laravel controllers when doing resourceful CRUD

Viewed 1008

I created a resourceful Laravel livewire component instead of going the controller route and was wondering if this practice is a clean approach? I've also eliminated the render method and have 3 methods that display a view. the problem with this I've noticed is that the wire:submit.prevent won't work.

for example routes

Route::resource('products', 'ProductComponent');

Component:

class ProductComponent extends Component
{
    public function index()
    {
        return view('mypage');
    }

    public function create()
    {
        return view('create page');
    }

    public function store()
    {
        //
    }

    public function edit(Model $model)
    {
        return view('edit page');
    }

    public function update()
    {
        //
    }

    public function destroy(Model $model)
    {
        //
    }
}
0 Answers
Related