Commit ee1db268 authored by Guillaume Pommier's avatar Guillaume Pommier
Browse files

Bugfix first logic was not taken into account

parent 6dc887cb
......@@ -30,7 +30,9 @@ class PlasmidController extends Controller
if (request()->ajax()) {
$query = Plasmid::query()->when(request()->searchBuilder, function ($query, $searchBuilderAjaxRequest) {
$criteria = $searchBuilderAjaxRequest['criteria'];
\Log::debug($criteria);
$logic = $searchBuilderAjaxRequest['logic'];
\Log::debug($logic);
$query = $this->buildRecursiveQuery($query, $criteria, $logic);
});
......
......@@ -13,9 +13,15 @@ trait SearchBuilder
// Recursive
$subCriteria = $item['criteria'];
$subLogic = $item['logic'];
$query->where(function ($query) use ($subCriteria, $subLogic) {
$this->buildRecursiveQuery($query, $subCriteria, $subLogic);
});
if ($logic == 'OR') {
$query->orWhere(function ($query) use ($subCriteria, $subLogic) {
$this->buildRecursiveQuery($query, $subCriteria, $subLogic);
});
} else {
$query->where(function ($query) use ($subCriteria, $subLogic) {
$this->buildRecursiveQuery($query, $subCriteria, $subLogic);
});
}
} else {
// Apply criteria
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment