Last active
May 16, 2016 18:01
-
-
Save artemrogov/92a38abd84f21b5e269fab18f4b82c88 to your computer and use it in GitHub Desktop.
BindingClassLaravel5.2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface BarInterface { | |
} | |
class Bar implements BarInterface | |
{ | |
} | |
App::bind('BarInterface','bar'); | |
Route::get('/bar',function(){ | |
$bar = App::make('BarInterface'); | |
dd($bar); | |
}); | |
/* или вот так */ | |
app()->bind('BarInterface','bar'); | |
Route::get('/bar',function(){ | |
$bar = app()->make('BarInterface'); | |
dd($bar); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment