每天laravel-20160820| ContextualBinding
程序员文章站
2022-04-18 11:01:55
...
concrete = $concrete; $this->container = $container;// set the } /** * Define the abstract target that depends on the context. * * @param string $abstract * @return $this */ public function needs($abstract) { $this->needs = $abstract; return $this; }// function is needs /** * Define the implementation for the contextual binding. * * @param \Closure|string $implementation * @return void */ public function give($implementation) { $this->container->addContextualBinding($this->concrete, $this->needs, $implementation); }// Define the implementation for the contextual binding}