SQLSTATE[42S02]: Base table or view not found

Posted 3 months ago by mohammadbasir

Why I am getting this error?

Here is my code.

function createclaim(Request $request){
      $claim = new Claim;
      $claim->title = $request["title"];
      $claim->description = $request["description"];
      $claim->save();

      $files = $request->file;

      foreach ($files as $key => $value) {
        $claimFile = new ClaimFiles;
        $claimFile->urlfile = $value->store('upload');
        $claim->files()->save($claimFile);
      }

      return dd($claim);
    }

Here is my error-

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'main_bd.claimfiles' doesn't exist (SQL: insert into `claimfiles` (`claim_id`, `claimfiles_id`) values (1, 1))

Any suggestion?

Please sign in or create an account to participate in this conversation.