-
-
Notifications
You must be signed in to change notification settings - Fork 461
SluggableScopeHelpers Trait
Shipu Ahamed edited this page Sep 3, 2016
·
1 revision
Earlier versions of the package included some helper functions for working with models and their slugs. Because you can now have more than one slug per model, this functionality has been refactored into a separate trait you can use in your application.
By adding the SluggableScopeHelpers
trait to your model, you can then do things such as:
$post = Post::whereSlug($slugString)->get();
$post = Post::findBySlug($slugString);
$post = Post::findBySlugOrFail($slugString);
See SCOPE-HELPERS.md for all the details.