|
|
@@ -14,7 +14,7 @@ class FilterController extends Controller
|
|
|
'products' => 'products',
|
|
|
'reclamations' => 'reclamations_view',
|
|
|
'maf_order' => 'maf_orders_view',
|
|
|
- 'import' => 'imports',
|
|
|
+ 'import' => 'imports',
|
|
|
];
|
|
|
public function getFilters(FilterRequest $request)
|
|
|
{
|
|
|
@@ -23,6 +23,8 @@ class FilterController extends Controller
|
|
|
if(!array_key_exists($table, self::DB_TABLES)) {
|
|
|
abort(400, 'Table not found');
|
|
|
}
|
|
|
+ $gp = session('gp_' . $table);
|
|
|
+
|
|
|
|
|
|
$dbTable = self::DB_TABLES[$table];
|
|
|
|
|
|
@@ -34,6 +36,17 @@ class FilterController extends Controller
|
|
|
if (Schema::hasColumn($dbTable, 'deleted_at')) {
|
|
|
$q->whereNull('deleted_at');
|
|
|
}
|
|
|
+
|
|
|
+ if(isset($gp['filters']) && is_array($gp['filters']) && count($gp['filters'])) {
|
|
|
+ foreach ($gp['filters'] as $colName => $vals) {
|
|
|
+ $q->where(function ($query) use ($gp, $colName, $vals) {
|
|
|
+ foreach (explode('||', $vals) as $val) {
|
|
|
+ $query->orWhere($colName, '=', $val);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+// dd($q->toRawSql());
|
|
|
$result = $q->orderBy($column)->get()->pluck($column)->toArray();
|
|
|
} else {
|
|
|
$result = [];
|