You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@dolcy glad you like it. We aren't planning on putting the implementation on Esensi\Model\Model simply because it is not needed by most models. We haven't written docs on it's use yet so if you'd like to follow the pattern of previous ones and submit a PR we'd welcome it. In the mean time a quick reference for how to use is:
<?phpuseEsensi\Models\Contracts\SluggableModelInterface;
useEsensi\Models\Traits\SluggableModelTrait;
useIlluminate\Database\Eloquent\Model;
class Post extends Model implements SluggableModelInterface
{
use SluggableModelTrait;
protected$sluggableKey = 'permalink';
}
$post = newPost;
$post->title = 'Title of Article'$post->slug = $post->title;
echo$post->slug; // title-of-articleecho$post->permalink; // title-of-article$post = newPost;
$post->title = 'Title of Article';
$post->permalink = $post->makeSlug($post->title);
echo$post->permalink; // title-of-articleecho$post->slug; // title-of-article
Good stuff. Implementation of Sluggable Interface/Trait is missing in Esensi\Model.
The text was updated successfully, but these errors were encountered: