I have a resource controller in my Laravel app, where all resource functions are placed. So far I have the creation and store functions working fine, but it falls on edit() and update(). As far as I can see, the issue is that it's not grabbing the model instance. I'm trying to pinpoint where I've gone wrong. Below is my routes web.php code.
// Website Development
Route::resource('website-development-orders',DevelopmentOrderController::class);
and here is my controller code
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\DevelopmentOrder $developmentOrder
* @return \Illuminate\Http\Response
*/
public function edit(DevelopmentOrder $developmentOrder)
{
//
dd($developmentOrder);
$this->authorize('update', $developmentOrder);
$categories = Development::all();
$payment_methods = PaymentMethod::all();
return view('development-orders.edit', compact('categories', 'payment_methods', 'developmentOrder'));
}
and finally, my blade file from I am accessing DevelopmentOrderController,
<td>
<div class="d-flex">
<a href="{{ route('website-development-orders.edit',$commission->id) }}"
class="d-inline-flex btn btn-sm btn-warning mr-2">Edit</a>
<form class="d-inline-flex"
action="{{ route('website-development-orders.destroy', $commission->id) }}"
method="POST"
onsubmit="return confirm('Do you really want to delete this Package?');">
@csrf
@method('DELETE')
<input type="submit" class="btn btn-sm btn-danger" value="Delete">
</form>
@if ($commission->status == 0)
<a href="{{ route('refund-development.refund', $commission->id) }}"
class="d-inline-flex btn btn-sm btn-info ml-2 mr-2">Refund</a>
@endif
</div>
</td>
After that I replaced developmentOrder with website_development_order it works fine so please suggest how can use developmentOrder to fetch the model data.