/** * Returns current database prefix * * @return string */ public function databasePrefix() { if ($this->query_type == 'builder') { $query = $this->query; } else { $query = $this->query->getQuery(); } return $query->getGrammar()->getTablePrefix(); }
/** * EloquentManager constructor. * * @param Builder|\Eloquent $model * @param Request $request */ public function __construct($model, Request $request) { $this->response = new DataTable(); $this->query = $model instanceof Builder ? $model : $model->getQuery(); $this->request = $request; // $this->columns = $this->query->columns; $this->connection = $model->getConnection(); $this->prefix = $this->connection->getTablePrefix(); $this->database = $this->connection->getDriverName(); }