1
I’m using Laravel 5.2 and when I have enter data he wants to return the last, but at the moment I want to enter and know if the operation was successful. My role in the controller
is like this:
public function cadastrar(),
{
$codigo= Request::input('codigo');
$codigo1 = Request::input('codigo1');
$model= new ModelCriado();
$model->CD_SEQUENCIA = "SEQUENCIA.NEXTVAL";
$model->CD_CODIGO = $codigo;
$model->CD_CODIGO1 = $codigo1;
$model->save();
return response()->json( array( "response" => 1 ) );
}
but he’s giving that message:
Error Code: 904 Error Message : ORA-00904: "ID": invalid Identifier Position : 128 Statement : Insert into model (CD_SEQUENCIA, CD_CODIGO, CD_CODIGO1) values (:P0, :P1, :P2) returning id into :P3 Bindings : [SEQ_MODEL.NEXTVAL,759,123,0]
my table only has 3 columns
CD_SEQUENCIA, CD_CODIGO, CD_CODIGO1
How do I fix it?
EDITION 1
class ModelCriado extends Model
{
protected $table = "model_criado";
public $timestamps = false;
}
Post your model?!
– novic
Already. I edited to show my model
– adventistaam
Sorry but this table has some serial field, auto or you pass the 3 values.?
– novic
I call a sequence
– adventistaam
then let’s understand, the field
CD_SEQUENCIA
is yourSequencia
or the bank will generate this value?– novic
Exactly. That’s right!
– adventistaam
I made an answer, but I don’t know the correct behavior to
ORACLE
and maybe all this depends on how the package is configured, the important thing that you inform this package on the question too, so that we can see the possibilities, I know that Eloquent for SQLSERVER, Mysql and Posgres works perfectly now ORACLE has not had any experience.– novic
I found your answer modest, rsrs, because it solved my problem, but that it could work 100% I had to create a Rigger in the oracle that did the auto increment similar to mysql, the one without calling the field. Thanks for the help
– adventistaam
So the package is like this, it’s not my fault kkkkk understood!
– novic