コード例 #1
0
ファイル: Sluggable.php プロジェクト: Konro1/pms
 /**
  * Called after save.
  * If the slug uses the primary key it is built after save and it is updated
  * with an additional database query.
  *
  * @param  Jam_Model $model
  */
 public function model_after_save(Jam_Model $model)
 {
     if ($this->auto_save() and $this->uses_primary_key() and !$model->changed('slug')) {
         // Use the built in slug transformation
         $model->slug = $model->build_slug();
         if ($model->slug != $model->original('slug')) {
             Jam::update($this->_model)->where_key($model->id())->value('slug', $model->slug)->execute();
         }
     }
 }