-
-
Notifications
You must be signed in to change notification settings - Fork 459
Usage
Shipu Ahamed edited this page Sep 3, 2016
·
1 revision
Saving a model is easy:
$post = new Post([
'title' => 'My Awesome Blog Post',
]);
$post->save();
And so is retrieving the slug:
echo $post->slug;
Also note that if you are replicating your models using Eloquent's replicate()
method,
the package will automatically re-slug the model afterwards to ensure uniqueness (in
previous versions of the package, you needed to do this manually).
$post = new Post([
'title' => 'My Awesome Blog Post',
]);
$post->save();
// $post->slug is "my-awesome-blog-post"
$newPost = $post->replicate();
// $newPost->slug is "my-awesome-blog-post-1"