I made a page for a user to update his company information, all companies default values are null, when a user is created. When a user fills the information, i get this error:
Method Illuminate\Database\Eloquent\Collection::update does not exist
I am sure this error is because of my CompanyController@edit
public function edit(Request $request)
{
$this->validate($request, [
'company_name' => 'alpha|max:50',
'phone' => 'integer|max:50',
'gst_hst_number' => 'integer|max:50',
'country' => 'alpha|max:50',
]);
$companies = Company::where('id', Auth::user()->id)->get();
$companies->update([
'company_name' => $request->input('company_name'),
'phone' => $request->input('phone'),
'gst_hst_number' => $request->input('gst_hst_number'),
'country' => $request->input('country')
]);
return redirect()->route('company.index')->with('info', 'Company information was updated.');
}
I am stuck quite some time on this issue, would gladly apriciate help and information how to properly update my company models fillable fields.
via Chebli Mohamed
Your Affiliate Profit Machine is waiting -
RépondreSupprimerAnd getting it running is as simple as 1---2---3!
Here's how it all works...
STEP 1. Input into the system what affiliate products you intend to promote
STEP 2. Add some PUSH button traffic (this ONLY takes 2 minutes)
STEP 3. See how the system explode your list and upsell your affiliate products all by itself!
Do you want to start making profits?
Check it out here