Symfony \组件\调试\异常\ FatalThrowableError(E_ERROR)在null上调用成员函数update()

时间:2019-10-02 06:21:48

标签: laravel-5

我想一次从同一视图更新两个表中的数据

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');
}

0 个答案:

没有答案