Hey,
You may use the make method to resolve a class instance out of the container.
The make method accepts the name of the class or interface you wish to resolve:
$api = $this->app->make(‘HelpSpot\API’);
One advantage to using the make method, is that Laravel will automatically inject any dependencies the class may define in it's constructor.
E.g. an instance of the Mailer class would be automatically injected here.
namespace App\Services;
use \Illuminate\Mail\Mailer;
class MyService
{
public function __construct(Mailer $mailer) {
$this->mailer = new Mailer;
}
}
Hope this is helpful!
Thank you!