diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php
index 58b5299..0ca0a9f 100644
--- a/app/Http/Controllers/CustomerController.php
+++ b/app/Http/Controllers/CustomerController.php
@@ -39,18 +39,22 @@ class CustomerController extends Controller
->join('brands', function (JoinClause $join) {
$join->on('brands.id', '=', 'customer_infos.brand_id');
});
- if (request()->brand) {
- $query = $query->where('customer_infos.brand_id', $request->brand);
+ if (request()->brand or Session::has("crud.$modelTable.brand")) {
+ $brand = $request->brand ?? Session::get("crud.$modelTable.brand");
+ Session::put("crud.$modelTable.brand", $brand);
+ $query = $query->where('customer_infos.brand_id', $brand);
}
// Search on crud Label column
- if ($request->search) {
- $query->where(function ($q) use ($columns, $request) {
+ if ($request->search or Session::has("crud.$modelTable.search")) {
+ $search = $request->search ?? Session::get("crud.$modelTable.search");
+ Session::put("crud.$modelTable.search", $search);
+ $query->where(function ($q) use ($columns, $search) {
foreach ($columns as $column) {
- $q = $q->orWhere($column, 'LIKE', "%$request->search%");
+ $q = $q->orWhere($column, 'LIKE', "%$search%");
}
- $q = $q->orWhere('customers.email', 'LIKE', "%$request->search%");
- $q = $q->orWhere('customer_logins.last_connection', 'LIKE', "%$request->search%");
+ $q = $q->orWhere('customers.email', 'LIKE', "%$search%");
+ $q = $q->orWhere('customer_logins.last_connection', 'LIKE', "%$search%");
});
}
@@ -63,6 +67,8 @@ class CustomerController extends Controller
}
if ($request->rst) {
+ Session::remove("crud.$modelTable.brand");
+ Session::remove("crud.$modelTable.search");
Session::remove("crud.$modelTable.sort_way");
Session::remove("crud.$modelTable.sort_col");
}
diff --git a/resources/views/customer/index.blade.php b/resources/views/customer/index.blade.php
index 0b73358..b700135 100644
--- a/resources/views/customer/index.blade.php
+++ b/resources/views/customer/index.blade.php
@@ -20,11 +20,11 @@
-
+
@if(request()->brand)