mardi 1 octobre 2019

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Call to a member function update() on null

I want to update data from two tables from same view or at a time, please help me!

public function edit($company_id) { //dd($company);

    $company=company::findOrFail($company_id);
    $industry=Industry::get();
    $country=Country::where('country_name','India')->first();
    $state=State::where('country_id',$country->country_id)->get();
    $city=City::where('state_id',$company->company_state)->get();
    $segment=Segment::get();
    $HeadOffice=HeadOffice::get();
    //$CompanyOtherInfo=CompanyOtherInfo::get();

    $CompanyOtherInfo=CompanyOtherInfo::where('company_other_infos.company_id',$company_id)->get();

    //dd($industry);
    //dd($HeadOffice);
    //dd($program_type);
    return view('backend.company.editCompany',compact('company','industry','state','city','segment','HeadOffice','CompanyOtherInfo'));
}

public function update(Request $request, Company $company) 
{
    //dd($request->all());
   $company->update($request->all());
   $company->companyOtherInfo->update($request->all());

return redirect('company/view');

}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire