I want to develop an API with Laravel 8 with resource controller. Previously we used id parameter to edit, delete and get single value from the database. But now, here is given model class as a parameter in show, edit, update and destroy method. How can I use this model class to perform crud operations without id parameter? I know I’m on a misconception and I want to get a clear idea.
public function show(Food $food)
{
//
}
public function edit(Food $food)
{
//
}
public function update(Request $request, Food $food)
{
//
}
public function destroy(Food $food)
{
//
}