Level 104
Inside the Request object, you can get the route-model bound model instance using:
$this->route('company');
5 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm using a route model binding. But for the validation, i would like to get the instance of my model ($company) in the form request ($companyRequest)
public function update(CompanyRequest $companyRequest, Company $company) {
$updates = $companyRequest->merge(["active" => $companyRequest->active_check === "on"])
->only("name", "phone_number", "address", "active");
$this->companyRepository->update($updates, $company);
return back();
}
Inside the Request object, you can get the route-model bound model instance using:
$this->route('company');
Please or to participate in this conversation.