Last active
August 29, 2015 14:06
-
-
Save mrailton/66a2e0d910d47afd6d16 to your computer and use it in GitHub Desktop.
Blog post model in laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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