Skip to content

Commit

Permalink
feat: add findBySlug docs
Browse files Browse the repository at this point in the history
  • Loading branch information
IsraelOrtuno committed May 24, 2023
1 parent 03bf492 commit d691887
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,16 @@ class YourEloquentModel extends Model
}
```

### Find models by slug

For convenience, you can use the alias `findBySlug` to retrieve a model. The query will compare against the field passed to `saveSlugsTo` when defining the `SlugOptions`.

```php
$model = Article::findBySlug('my-article');
```

`findBySlug` also accepts a second parameter `$columns` just like the default Eloquent `find` method.


## Changelog

Expand Down

0 comments on commit d691887

Please sign in to comment.