assada / laravel-achievements

Laravel 6+ User Achievements system.
https://assada.github.io/laravel-achievements/
MIT License
66 stars 28 forks source link

Relations documentation #15

Open theveloperspl opened 3 years ago

theveloperspl commented 3 years ago

Hello, I suggest adding a documentation block about available relations. It took me a while to find them so having such information at the start will save some time and effort for library users. I am talking about those two relations as they are not described anywhere:

        $user = User::find(1);
        $achievements = $user->achievements;

        foreach ($achievements as $achievement) {
            dump($achievement->details); <- this one
            dump($achievement->achiever); <- and that one too
        }

Also, PHPStorm IDE is not suggesting them until you scan the library models directory with the command (which may be worth mentioning):

php artisan ide-helper:models --dir="vendor/assada/laravel-achievements/src/Model"

Thanks for reading my suggestions and I hope to get back from you soon.