diff --git a/README.md b/README.md index 7efe5d2..087db14 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,12 @@ If you don't want to group you can call `dontGroup()`. You can hide errors from the index by calling `hideFromIndex()`. + +## Model relation + +When using the `withModel` method you can retrieve errors for a specific model. +The `\JustBetter\ErrorLogger\Traits\HasErrors` trait contains this relation with the name `errors()` + ## License The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/src/Traits/HasErrors.php b/src/Traits/HasErrors.php new file mode 100644 index 0000000..42285a7 --- /dev/null +++ b/src/Traits/HasErrors.php @@ -0,0 +1,14 @@ +morphMany(Error::class, 'model'); + } +} \ No newline at end of file