Skip to content

Commit

Permalink
str_limit for title
Browse files Browse the repository at this point in the history
  • Loading branch information
sdebacker committed Nov 17, 2017
1 parent c8dae55 commit a0109d5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Traits/Historable.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ trait Historable
*/
public static function bootHistorable()
{

static::created(function (Model $model) {
$model->writeHistory('created', $model->present()->title, [], $model->toArray());
$model->writeHistory('created', str_limit($model->present()->title, 200, ''), [], $model->toArray());
});

static::updated(function (Model $model) {
Expand All @@ -44,13 +43,12 @@ public static function bootHistorable()
}
}

$model->writeHistory($action, $model->present()->title, $old, $new);
$model->writeHistory($action, str_limit($model->present()->title, 200, ''), $old, $new);
});

static::deleted(function (Model $model) {
$model->writeHistory('deleted', $model->present()->title);
$model->writeHistory('deleted', str_limit($model->present()->title, 200, ''));
});

}

/**
Expand Down

0 comments on commit a0109d5

Please sign in to comment.