Hey All I am new to Laravel. I have a table called dsp_account_fee.
This is what I have in my Model.
{
use AdvancedInserts;
protected $table = "dsp_account_fee";
protected $primaryKey = 'dsp_account_id';
protected $secondaryKey = 'screen_type';
public $timestamps = false;
protected function setKeysForSaveQuery(Builder $query)
{
parent::setKeysForSaveQuery($query);
$query->where($this->secondaryKey, '=', $this->{$this->secondaryKey});
return $query;
}
protected $fillable = array(
'dsp_account_id', 'screen_type', 'pmp_percent' , 'omp_percent'
);
}
When I create or update record I use the updateorcreate method like this:
$res1 = DspAccountFee::updateOrCreate(
['dsp_account_id' => $dsp_account_id, 'screen_type' => 'ctv'],
['pmp_percent' =>$fields['fee_ctv_pmp_percent'], 'omp_percent' => $fields['fee_ctv_omp_percent']]
);
The problem is that the created_at and the updated_at not filled automatically and stay null. what I am missing?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire