how to crate instance in laravel code example
Example 1: how to use service container in laravel
use App\Services\Transistor;
$this->app->resolving(Transistor::class, function ($api, $app) {
// Called when container resolves objects of type "HelpSpot\API"...
});
$this->app->resolving(function ($object, $app) {
// Called when container resolves object of any type...
});
Example 2: make() laravel
$api = $this->app->make(‘HelpSpot\API’);