mardi 17 novembre 2020

How to use composite primary key in laravel 8?

I didn't use the migration files because I have preexisting tables in the database, I want to know how to force laravel to use my composite primary key.if there is any method to override. The composite primary key is (Tel + number_str ) This is my function in the model :

public function saveData(){
  $response = new ResponseModel(); 
                //Primary key(Tel + number_str )
                $reponse->Tel = '0123456789';//---> the first key
                $reponse->number_str = '1'; //---> the second key
    
                $reponse->view = '0';  
                $reponse->channal = '0';
                $reponse->save();
}

when I execute I have this error: Yajra\Pdo\Oci8\Exceptions\Oci8Exception Error Code : 904 Error Message : ORA-00904: "ID": invalid identifier Position : 98 Statement : insert into "REPONSE" ("TEL", "number_str", "view", "channal ") values (:p0, :p1, :p2, :p3) returning "ID" into :p4 Bindings : [0772529403,1,0,0,0]



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire