I'm getting this error when I'm trying to assign a value to all the columns in a table.
Controller
public function updateallcompany(Request $request, $id)
{
$active = $request->input('active');
AccessCode::where('company_id', $id)->update([$active, 'active']);
return view('pages.accesscode.showallaccesscodecompany')
->with('success', "AccessCodes Updated");
}
Error
SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'field list' (SQL: update
access_codesset0= Yes,1= active,updated_at= 2019-04-11 11:10:03 wherecompany_id= 2)
You must pass the
$activevalue to the fieldactive.You can see
Mass Updatesexample on laravel documentation: https://laravel.com/docs/5.8/eloquentTry: