Skip to content

Instantly share code, notes, and snippets.

@johngan
Last active June 15, 2016 08:38
Show Gist options
  • Save johngan/f7d7baa7d0b769db30d66b005f03c461 to your computer and use it in GitHub Desktop.
Save johngan/f7d7baa7d0b769db30d66b005f03c461 to your computer and use it in GitHub Desktop.
Laravel Service Container

##Binding object to Laravel Service Container

###bind to container

App::bind('foo', function(){
    return 1;
});

###Singleton

App::singleton('foo', function(){
    return 1;
});

###get foo from container

var_dump(App::make('foo'));

###helper function of Auth::make();

var_dump(app('foo'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment