We can bind a class as a Singleton:
public function register()
{
App::singleton('my-database', function()
{
return new Database();
});
}
This way, the first time an instance of 'my-database'
will be requested to the service container, a new instance will be created. All the successive requests of this class will get back the first created instance:
//a new instance of Database is created
$db = App::make('my-database');
//the same instance created before is returned
$anotherDb = App::make('my-database');