예제 #1
0
 /**
  * Resolve an instance of the given seeder class.
  *
  * @param  string  $class
  * @return \Nova\Database\Seeder
  */
 protected function resolve($class)
 {
     if (isset($this->container)) {
         $instance = $this->container->make($class);
         $instance->setContainer($this->container);
     } else {
         $instance = new $class();
     }
     if (isset($this->command)) {
         $instance->setCommand($this->command);
     }
     return $instance;
 }
예제 #2
0
 /**
  * Resolve the subscriber instance.
  *
  * @param  mixed  $subscriber
  * @return mixed
  */
 protected function resolveSubscriber($subscriber)
 {
     if (is_string($subscriber)) {
         return $this->container->make($subscriber);
     }
     return $subscriber;
 }
예제 #3
0
 /**
  * Return a Files Dispatcher instance
  *
  * @return \Nova\Routing\Assets\DispatcherInterface
  */
 protected function getFileDispatcher()
 {
     if (isset($this->fileDispatcher)) {
         return $this->fileDispatcher;
     }
     return $this->fileDispatcher = $this->container->make('Nova\\Routing\\Assets\\DispatcherInterface');
 }
예제 #4
0
 /**
  * Create a new connection instance.
  *
  * @param  string   $driver
  * @param  \PDO     $connection
  * @param  string   $database
  * @param  string   $prefix
  * @param  array    $config
  * @return \Nova\Database\Connection
  *
  * @throws \InvalidArgumentException
  */
 protected function createConnection($driver, PDO $connection, $database, $prefix = '', array $config = array())
 {
     if ($this->container->bound($key = "db.connection.{$driver}")) {
         return $this->container->make($key, array($connection, $database, $prefix, $config));
     }
     switch ($driver) {
         case 'mysql':
             return new MySqlConnection($connection, $database, $prefix, $config);
         case 'pgsql':
             return new PostgresConnection($connection, $database, $prefix, $config);
         case 'sqlite':
             return new SQLiteConnection($connection, $database, $prefix, $config);
         case 'sqlsrv':
             return new SqlServerConnection($connection, $database, $prefix, $config);
     }
     throw new \InvalidArgumentException("Unsupported driver [{$driver}]");
 }
예제 #5
0
 /**
  * Resolve the given type from the container.
  *
  * (Overriding Container::make)
  *
  * @param  string  $abstract
  * @param  array   $parameters
  * @return mixed
  */
 public function make($abstract, $parameters = array())
 {
     $abstract = $this->getAlias($abstract);
     if (isset($this->deferredServices[$abstract])) {
         $this->loadDeferredProvider($abstract);
     }
     return parent::make($abstract, $parameters);
 }
 /**
  * Make a controller instance via the IoC container.
  *
  * @param  string  $controller
  * @return mixed
  */
 protected function makeController($controller)
 {
     Controller::setFilterer($this->filterer);
     return $this->container->make($controller);
 }