Share your route file where you have defined the route name admin.customerInfo.show
.
Alternatively to get the customer data you have to do route model binding. Link to official documentation
https://laravel.com/docs/9.x/helpers#method-route in your route('admin.customerInfo.show', ['customer'=> $loanApplication->user_id])
also in your controller method you should have something like
public function show(CustomerInfoModel $customer)
laravel will automatically match your url paramater with your medel and make an instance, unless you have a POST route method and need the request object
in that case your method sould look something like
public function show(Request $request, CustomerInfoModel $customer)
i ussualy preffer to have something like
public function show(int $customerId){
$customer = Customer::where('id', $customerId)
...
->conditions
...
->first()
}
so that i can add extra conditions to my queries and not instantiate the model if not all DB conditions are meet
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community