Generator tool
$ composer require maras0830/laravel-srt
$ php artisan make:service UserService
$ php artisan make:repository UserRepository
$ php artisan make:transformer UserTransformer
$ php artisan make:srt User
in your CustomerTransformer file
public function __construct()
{
// set your eager query required relations.
$this->setRequiredRelations(['notificationable']);
// false: laravel-srt log warning when you forgot eager query( ->with(['notificationable']) )
// true: laravel-srt throw TransformerException when you forgot eager query( ->with(['notificationable']) )
$this->setStrictMode(false);
}