Support the ongoing development of Laravel.io →
posted 2 years ago
Laravel
Last updated by @eazzy007 2 years ago.
0

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

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Ezekiel Okeh eazzy007 Joined 31 Mar 2022

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.