Skip to content

Instantly share code, notes, and snippets.

@mrailton
Created September 17, 2014 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrailton/92895caac6e0be3a81c4 to your computer and use it in GitHub Desktop.
Save mrailton/92895caac6e0be3a81c4 to your computer and use it in GitHub Desktop.
<?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