Skip to content

Instantly share code, notes, and snippets.

@mrailton
Last active August 29, 2015 14:06
Show Gist options
  • Save mrailton/66a2e0d910d47afd6d16 to your computer and use it in GitHub Desktop.
Save mrailton/66a2e0d910d47afd6d16 to your computer and use it in GitHub Desktop.
Blog post model in laravel
<?php
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;
class Post extends Eloquent implements SluggableInterface {
protected $fillable = ['title', 'slug', 'user_id', 'content'];
use SluggableTrait;
protected $sluggable = array(
'build_from' => 'title',
'save_to' => 'slug'
);
public function user() {
return $this->belongsTo('User');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment