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(); }
/** * We will set Database Connection object * * @param $connection */ public function setDatabaseConnection($connection) { $this->pdo[$connection] = Connection::getConnection($connection); }
/** * @param $input * @return mixed */ private function getDatabase($input) { return $input->getArgument('database') != '' ? $input->getArgument('database') : Connection::getDefaultConnection(); }
/** * Set the database connection * * @param $database */ public function setConn($database) { $this->_connection = Connection::getConnection($database); }
public function getDefaultDatabaseConnection() { return Connection::getDefaultConnection(); }