Skip to content

Commit

Permalink
style patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Redjik committed Aug 31, 2015
1 parent 51418fd commit c7cc6db
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions api/app/Models/Article.php
Expand Up @@ -78,8 +78,7 @@ protected static function boot()
parent::boot();
static::saving(function (Article $model) {
if ($model->getOriginal('permalink') !== $model->permalink && !is_null($model->permalink)) {
$articlePermalink = new ArticlePermalink();
$articlePermalink->permalink = $model->permalink;
$articlePermalink = new ArticlePermalink(['permalink'=>$model->permalink]);
$articlePermalink->save();
}
return true;
Expand Down
2 changes: 2 additions & 0 deletions api/app/Models/ArticlePermalink.php
Expand Up @@ -24,6 +24,8 @@ class ArticlePermalink extends BaseModel

protected $primaryKey = 'permalink';

protected $fillable = ['permalink'];

protected static $validationRules = [
'permalink' => 'string|required',
'check_entity_id' => 'uuid',
Expand Down
2 changes: 1 addition & 1 deletion api/database/seeds/ArticleSeeder.php
Expand Up @@ -27,7 +27,7 @@ public function run()
$article->metas()->saveMany($metas);

//add permalinks
$permalinks = factory(ArticlePermalink::class, rand(0, 4))->make()->all();
$permalinks = factory(ArticlePermalink::class, 2)->make()->all();
$article->permalinks()->saveMany($permalinks);

//add tags
Expand Down

0 comments on commit c7cc6db

Please sign in to comment.