-  
5. Architecture Foundations  i. Service Providers  i. Introduction  ii. Basic Provider Example  iii. Registering Providers  iv. Deferred Providers  ii. Service Container  i. Introduction  ii. Basic Usage Interfaces To Implementations  iv. Contextual Binding  v. Tagging  vi. Practical Applications  vii. Container Events  iii. Contracts  i. Introduction  ii. Why Contracts?  iii. Contract Reference  iv. How To Facade Class Reference  v. Request Lifecycle  i. Introduction  ii. Lifecycle Overview  iii. Focus On Service Providers  vi. Application Structure  i. Introduction  ii. The Root Directory  iii. The App Directory
 0 码力 |
          242 页 |
          1.44 MB
          | 1 年前 3
  -  
Binding 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 Create a new Eloquent model class  make:policy Create a new policy class  make:provider Create a new service provider class  make:request Create a new form request class  make:seeder Create a new seeder class will be available in all views under the name $shareddata.  View::share is typically called in a service provider, or perhaps in the constructor of a controller, so  the data will be shared in views returned
 0 码力 |
          216 页 |
          1.58 MB
          | 1 年前 3
  -  
文档区块示例,注意到 @param 属性前面  有两个空格,参数类型前有两个空格,最后是参数名称,也有两个空  格:  /**  * Register a binding with the container.  *  * @param string|array $abstract  * @param \Closure|string|null $concrete  * @param bool $shared Laravel 中文学习资源:https://xueyuanjun.com 126  $this->app->extend(Service::class, function($service)  {  return new DecoratedService($service);  });  解析  make 方法  有很多方式可以从容器中解析对象,首先,你可以使用 make 方法,  该方法接收你想要解析的类名或接口名作为参数: 服务容器在每一次解析对象时都会触发一个事件,可以使  用 resolving 方法监听该事件:  $this->app->resolving(function ($object, $app) {  // Called when container resolves object of any typ  e...  });  $this->app->resolving(HelpSpot\API::class, function ($api
 0 码力 |
          1442 页 |
          14.66 MB
          | 1 年前 3
  -  
额外代码装饰或配置该服务。extend 方法接收一个闭包来返回修改后的服 务:   $this->app->extend(Service::class, function($service) {      return new DecoratedService($service);  });   解析   make 方法   有很多方式可以从容器中解析对象,首先,你可以使用 make 方法,该方法接收你想要解析的类名或接口名作为参数: $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');        //  });   注:如果绑定到容器的唯一标识有冲突调用
 0 码力 |
          377 页 |
          14.56 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
  -  
..................................................................................... 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
  -  
gitignore 文件,编辑文件 内容如下:   *!.gitignore   该目录应该是可写的,用来存储临时优化文件如 compiled.php,routes.php,config.php 以及 service.json   新增 BroadcastServiceProvider   在配置文件 config/app.php 中,添加  Illuminate\Broadcasting\BroadcastServiceProvider 被废弃并被重命名为  Illuminate\Foundation\Bus\DispatchesJobs.     Illuminate\Container\BindingResolutionException 被移动到  Illuminate\Contracts\Container\BindingResolutionException.     服务容器的 bindShared 方法被废弃,使用 singleton function __construct(UserRepository $users)      {          // Dependencies automatically resolved by service contai ner...          $this->users = $users;      }        /**       * 绑定数据到视图.       *       *
 0 码力 |
          307 页 |
          3.46 MB
          | 1 年前 3
  -  
Laravel 遵循 PSR-2 编码标准和 PSR-4 自动载入标准。   DocBlocks   下面是注释示例:   /**    * Register a binding with the 
container.    *    * @param string|array $abstract   本文档由 Laravel 学院(LaravelAcademy.org)提供      Laravel 学院致力于提供优质 __construct(UserRepository $users)       {           // Dependencies automatically resolved by 
service container...           $this->users = $users;       }          /**        * 绑定数据到视图.        *   本文档由 Laravel @section('sidebar')               This is the master sidebar.           @show              
               @yield('content')