lundi 30 mars 2020

SQLSTATE[42S22] error in Laravel 6 update function

I'm trying to run a update function in my laravel app but every time when i run the function it gives me this error,

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause' (SQL: update `apps` set `domain` = Testinput.test.com, `apps`.`updated_at` = 2020-03-30 13:18:32 where `id` is null)

Here is my update function in the controller,

public function update(Request $request,App $app, $id)
{
    $this->validate($request, [
        'domain' => ['required', 'string','min:2', 'max:255'],
    ],$request->all());

    $fullDomain = $request->domain;
    $app->domain=$fullDomain;
    $app = App::where('appId','=','1')->first()->update($request->all());
    return Redirect::back()->with('success',__('sentence.User updated successfully')); 
}

I dont't have a column called id in my apps table my column is appId



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire