-
Providers ii. Service Container i. Introduction ii. Basic Usage iii. Binding Interfaces To Implementations iv. Contextual Binding v. Tagging vi. Practical Applications vii. Container Events iii. Contracts existing constructor injection, you may now type-hint dependencies on controller methods. The IoC container will automatically inject the dependencies, even if the route contains other parameters: Release function register(RegisterRequest $request) { var_dump($request->input()); } When the Laravel IoC container identifies that the class it is injecting is a FormRequest instance, the request will automatically
0 码力 |
242 页 |
1.44 MB
| 1 年前 3
-
$app) { // Called when container resolves object of any type... }); $this->app->resolving(HelpSpot\API::class, function ($api, $app) { // Called when container resolves objects of type "HelpSpot\API" 接口。所以,你可以通过类型提示 PSR-11 容器接口来获取 Laravel 容器的实例: use Psr\Container\ContainerInterface; Route::get('/', function (ContainerInterface $container) { $service = $container->get('Service'); // }); 注:如果绑定到容器的唯一标识有冲突调用 erProvider; class AppServiceProvider extends ServiceProvider { /** * All of the container bindings that should be registered. * 本文档由 Laravel 学院提供 Laravel 学院致力于提供优质 Laravel
0 码力 |
377 页 |
14.56 MB
| 1 年前 3
-
..................................................................................... 72 IoC Container ............................................................................................... data from your models for views that are unrelated to that method's page content. The IoC container (Inversion of Control) gives you a method for generating new objects and optionally instantiating current protocol is used. Fix bug in Eloquent auth driver. Added format method to message container. Upgrading From 3.2 Replace the laravel folder. Laravel 3.2 Added to_array method
0 码力 |
139 页 |
1.13 MB
| 1 年前 3
-
an Instance 166 Binding a Singleton to the Service Container 166 Introduction 167 Using the Service Container as a Dependency Injection Container 167 Chapter 57: Socialite 168 Examples 168 Installation Illuminate\Contracts\Filesystem\Factory contract on any class that is resolved via the Laravel service container. Retrieving A Particular Disk $disk = Storage::disk('s3'); $disk = Storage::disk('local'); apache2, caddy, memcached, beanstalkd, beanstalkd-console, workspace 1. Enter the Workspace container, to execute commands like (Artisan, Composer, PHPUnit, Gulp, ...). docker-compose exec workspace
0 码力 |
216 页 |
1.58 MB
| 1 年前 3
-
ypted) ); $record->save(); } 异常处理器 构造函数 异常处理器基类现在需要传递一个 Illuminate\Container\Container 实例到构造函数,这只有 当你在 app/Exception/Handler.php 中定义了自定义的__construct 方法时才会对应用产生影响, 如果你这么做了,需要传递一个容器实例到 文档区块示例,注意到@param 属性前面有两个空格,参数类型前有两 个空格,最后是参数名称,也有两个空格: /** * Register a binding with the container. * 本文档由 Laravel 学院(LaravelAcademy.org)提供 Laravel 学院致力于提供优质 Laravel 中文学习资源 33 * @param $app) { // Called when container resolves object of any type... }); $this->app->resolving(HelpSpot\API::class, function ($api, $app) { // Called when container resolves objects of type "HelpSpot\API"
0 码力 |
691 页 |
9.37 MB
| 1 年前 3
-
被废弃并被重命名为 Illuminate\Foundation\Bus\DispatchesJobs. Illuminate\
Container\BindingResolutionException 被移动到 Illuminate\Contracts\
Container\BindingResolutionException. 服务容器的 bindShared 方法被废弃,使用 singleton @section('sidebar') This is the master sidebar. @show
@yield('content')