Пример #1
0
 private function setModelAttributes($model)
 {
     $this->setModelClass(Inflector::getClassNameFromNamespace($model));
     if (!property_exists($model, 'tableName') || is_null($this->tableName)) {
         $this->setTableName(Inflector::tabilize($this->getModelClass()));
     }
     if (!property_exists($model, 'database') || is_null($this->database)) {
         $this->setDatabase(Connection::getDefaultConnection());
     } else {
         $this->setDatabase($this->database);
     }
     if (is_null($this->getDatabase())) {
         throw new \InvalidArgumentException("Please specify database name in your model. " . get_called_class());
     }
     $this->setPrimarykey();
 }
Пример #2
0
 /**
  * We will set Database Connection object
  *
  * @param $connection
  */
 public function setDatabaseConnection($connection)
 {
     $this->pdo[$connection] = Connection::getConnection($connection);
 }
Пример #3
0
 /**
  * @param $input
  * @return mixed
  */
 private function getDatabase($input)
 {
     return $input->getArgument('database') != '' ? $input->getArgument('database') : Connection::getDefaultConnection();
 }
Пример #4
0
 /**
  * Set the database connection
  *
  * @param $database
  */
 public function setConn($database)
 {
     $this->_connection = Connection::getConnection($database);
 }
Пример #5
0
 public function getDefaultDatabaseConnection()
 {
     return Connection::getDefaultConnection();
 }