public function update(Request $request, Currency $currency)
{
$validData = $request->validate([
'name' => 'required',
]);
$currency->name = $request ['name'];
$currency->symbol_url = Image::uploadFileToS3($request, 'symbol_url', $company->name . '/currency/');
$currency->save();
return redirect('company');
}
I'm trying to do the update method of the currency controller.
Because of the S3 path, I need to pass down the company name.
The currency already have a company id associated as a foreign key, how can i do the query?
$currency->company->name
It was pretty simple, i was complicating it a lot..
The above answer retrieves the company name for that currency.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.