コード例 #1
0
ファイル: ModelCore.php プロジェクト: atudz/snapneat
 /**
  * Save the model to the database.
  * Overriden the parent so that customization can be added
  *
  * @param  array  $options
  * @return bool
  */
 public function save(array $options = [])
 {
     // Auto populate creator
     if ($this->__isset('creator_pk_id') && !$this->creator_pk_id && \Auth::user()) {
         $this->setAttribute('creator_pk_id', \Auth::user()->id);
     }
     return parent::save($options);
 }
コード例 #2
0
ファイル: ModelCore.php プロジェクト: atudz/SFAReport
 /**
  * Save the model to the database.
  * Overriden the parent so that customization can be added
  *
  * @param  array  $options
  * @return bool
  */
 public function save(array $options = [])
 {
     // Auto populate modified at
     if ($this->__isset('updated_at') && !$this->__isset('created_at')) {
         $this->setAttribute('updated_at', new \DateTime());
     }
     if ($this->__isset('updated_by') && \Auth::user()) {
         $this->setAttribute('modified_by', \Auth::user()->id);
     }
     return parent::save($options);
 }