@tekmi Thank you and yes I watched those episodes when I was starting out with Laravel. Back then, it didn't make sense because I was so new. I watched it again today and it made more sense. So thank you for your guidance.
I made a few adjustments based on those videos and I now get this when I run dd(App::make('App\ResponseErrorHandler'));:
ResponseErrorHandler {#254 ▼
+"notifications": NotificationRepository {#256}
}
But I still have a problem. When I run (new ResponseErrorHandler)->error_931;, I still get:
Type error: Too few arguments to function App\ResponseErrorHandler::__construct(), 0 passed
So then I tried changing it to run this (new ResponseErrorHandler(new NotificationRepository()))->error_931();, but I get this error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'App\NotificationRepository' not found
So I tried fixing it by adding use Laravel\Spark\Contracts\Repositories\NotificationRepository;, but then I got this error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Cannot instantiate interface Laravel\Spark\Contracts\Repositories\NotificationRepository
I'm thinking that I am not instantiating it correctly now that I have registered ErrorHandlerServiceProvider?
I am using the magic method __get as you recommended to me here: https://laracasts.com/discuss/channels/laravel/handling-errors-from-an-outside-api
On your first reply to me in this discussion you said:
I doubt your class ResponseErrorHandler can be resolved by Laravel's service container - make sure you register it in your Service Provider - in this case you won't need to instantiate it by using new ResponseErrorHandler like you were doing.
How would I now instantiate it?
...Thank you again for being so helpful!