Skip to content

Instantly share code, notes, and snippets.

@ojhaujjwal
Last active October 8, 2017 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ojhaujjwal/74a8fb467c92a140d991a4b6a40b51f0 to your computer and use it in GitHub Desktop.
Save ojhaujjwal/74a8fb467c92a140d991a4b6a40b51f0 to your computer and use it in GitHub Desktop.
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class MyServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton(\My\Service::class, function ($app) {
return new \My\Service($app->make('My\AnotherService'));
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment