csv export
This commit is contained in:
@@ -107,28 +107,19 @@ class RecordController extends Controller
|
||||
$sort = data_get($urlParams, "sort") ?? "-_sys.updatedAt";
|
||||
$filter = data_get($urlParams, "filter") ?? [];
|
||||
$arguments = array_merge([
|
||||
"_sys.schema" => $schema->name,
|
||||
"_sys.status_in" => "draft,published",
|
||||
"schema" => $schema->name,
|
||||
"status_in" => "draft,published",
|
||||
], $filter);
|
||||
|
||||
|
||||
$records = [];
|
||||
|
||||
try {
|
||||
$queryResult = $this->query
|
||||
$records = $this->query
|
||||
->filter($arguments)
|
||||
// ->limit($limit)
|
||||
->status(explode(",", $arguments["_sys.status_in"]))
|
||||
->limit(-1)
|
||||
->status(explode(",", $arguments["status_in"]))
|
||||
// ->skip($skip)
|
||||
->sort($sort)
|
||||
->childrenDepth(0)
|
||||
->parentsDepth(0)
|
||||
->run();
|
||||
|
||||
$graph = $queryResult->getQueryRecords();
|
||||
$records = $graph->getRootRecords()->toArray();
|
||||
} catch (SubqueryNoResultException) {
|
||||
}
|
||||
->run()
|
||||
->records;
|
||||
|
||||
header('Content-Type: application/csv');
|
||||
header('Content-Disposition: attachment; filename="' . $schemaName . '.csv";');
|
||||
@@ -221,7 +212,6 @@ class RecordController extends Controller
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function editInline(Request $request)
|
||||
{
|
||||
$rid = $request->route("rid");
|
||||
|
||||
@@ -157,8 +157,11 @@ final class Query
|
||||
{
|
||||
$query = DB::table("records");
|
||||
$query = $this->parseFilters($query);
|
||||
if($this->options->limit > 0){
|
||||
$query->limit($this->options->limit);
|
||||
$query->offset($this->options->skip);
|
||||
}
|
||||
|
||||
$query = $this->orderByQuery($query);
|
||||
|
||||
return $query->get()->map(function ($r) {
|
||||
|
||||
Reference in New Issue
Block a user