I'm using implicit model binding in Laravel 5.3.26 for routes like this
POST /teams/{team}/customers/{customer}/addresses
The {team} is used in a middleware to determine which team the user is currently using. However the store method for the addresses only needs the {customer} injected; it does not access the team in any way. So the header of the method could look like this:
public function store(Customer $customer, Request $request)
Unfortunately the id of the selected team gets injected into $customer instead of the actual Customer instance. If I add the $team parameter to the store method, so the function header would look like this:
public function store(Team $team, Customer $customer, Request $request)
everything works as expected. Is there a way to omit the $team parameter but still get the correct Customer instance injected into the function ?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2hXgn0k
via IFTTT
Aucun commentaire:
Enregistrer un commentaire