I am making a store to my database in this way:
public function store(DocumentoAutorFormRequest $request)
{
// Se crea un objeto vinculo
$vinculo = new DocumentoAutor;
//EL ORDEN ES EL MAXIMO ORDEN +1
$orden=DB::table('cntrl_autor')->max('orden');
$vinculo->orden = $orden+1;
$vinculo->extra=" ";
//Se crea la relacion
$vinculo->fk_doc = $request->get('fk_doc');
$vinculo->fk_autor = $request->get('fk_autor');
//cuando se inserta, va regresar a esta misma ruta
$ruta = "/cntrl_autor/ligar/".$request->get('id_documento');
//Extra no se como se maneja, pero se coloca como espacio vacio mientras
Session::flash('flash_message', 'Vinculación Exitosa!');
$vinculo->save();
return Redirect::to($ruta);
}
and it throws me the following error:
Too few arguments to function Illuminate\Database\Eloquent\Model::setAttribute(). .. and exactly 2 expected
My request is like this
class DocumentoAutor extends Model
{
protected $table='cntrl_autor';
protected $primaryKey=null;
public $timestamps=false;
protected $fillable =[
'orden',
'fk_doc',
'fk_autor',
'extra'
];
protected $guarded =[
];
the error I get, however the insertion is doing well in the database I would like to know what I'm doing wrong or why that error comes out.