bitfix and add sql file

dev
Aji Kamaludin 1 year ago
parent f48e76eda0
commit a3f95b3e8a
No known key found for this signature in database
GPG Key ID: 19058F67F0083AD3

@ -3,6 +3,7 @@
## Note ## Note
- [ ] expired point - [ ] expired point
- [ ] like query must use ? and change to lower case or somethink else
## Front ## Front

@ -24,10 +24,10 @@ class CustomerController extends Controller
if ($request->q != '') { if ($request->q != '') {
$query->where(function ($query) use ($request) { $query->where(function ($query) use ($request) {
$query->where('name', 'ilike', "%$request->q%") $query->where('name', 'like', "%$request->q%")
->orWhere('fullname', 'ilike', "%$request->q%") ->orWhere('fullname', 'like', "%$request->q%")
->orWhere('email', 'ilike', "%$request->q%") ->orWhere('email', 'like', "%$request->q%")
->orWhere('phone', 'ilike', "%$request->q%"); ->orWhere('phone', 'like', "%$request->q%");
}); });
} }
@ -115,8 +115,8 @@ class CustomerController extends Controller
public function update(Request $request, Customer $customer) public function update(Request $request, Customer $customer)
{ {
$request->validate([ $request->validate([
'email' => 'nullable|email|unique:customers,email,'.$customer->id, 'email' => 'nullable|email|unique:customers,email,' . $customer->id,
'username' => 'required|string|min:5|alpha_dash|unique:customers,username,'.$customer->id, 'username' => 'required|string|min:5|alpha_dash|unique:customers,username,' . $customer->id,
'password' => 'nullable|string|min:8', 'password' => 'nullable|string|min:8',
'name' => 'required|string', 'name' => 'required|string',
'fullname' => 'required|string', 'fullname' => 'required|string',

@ -44,10 +44,10 @@ class CustomerMitraController extends Controller
if ($request->q != '') { if ($request->q != '') {
$query->where(function ($query) use ($request) { $query->where(function ($query) use ($request) {
$query->where('name', 'ilike', "%$request->q%") $query->where('name', 'like', "%$request->q%")
->orWhere('fullname', 'ilike', "%$request->q%") ->orWhere('fullname', 'like', "%$request->q%")
->orWhere('email', 'ilike', "%$request->q%") ->orWhere('email', 'like', "%$request->q%")
->orWhere('phone', 'ilike', "%$request->q%"); ->orWhere('phone', 'like', "%$request->q%");
}); });
} }
@ -87,7 +87,7 @@ class CustomerMitraController extends Controller
$locations = Location::query(); $locations = Location::query();
if ($request->location_q != '') { if ($request->location_q != '') {
$locations->where('name', 'ilike', "%$request->location_q%"); $locations->where('name', 'like', "%$request->location_q%");
} }
return inertia('CustomerMitra/Form', [ return inertia('CustomerMitra/Form', [
@ -205,7 +205,7 @@ class CustomerMitraController extends Controller
$locations = Location::query(); $locations = Location::query();
if ($request->location_q != '') { if ($request->location_q != '') {
$locations->where('name', 'ilike', "%$request->location_q%"); $locations->where('name', 'like', "%$request->location_q%");
} }
return inertia('CustomerMitra/Form', [ return inertia('CustomerMitra/Form', [

@ -20,11 +20,11 @@ class DepositController extends Controller
if ($request->q != '') { if ($request->q != '') {
$deposits->where(function ($query) use ($request) { $deposits->where(function ($query) use ($request) {
$query->where('description', 'ilike', "%$request->q%") $query->where('description', 'like', "%$request->q%")
->orWhereHas('customer', function ($query) use ($request) { ->orWhereHas('customer', function ($query) use ($request) {
$query->where('fullname', 'ilike', "%$request->q%") $query->where('fullname', 'like', "%$request->q%")
->orWhere('email', 'ilike', "%$request->q%") ->orWhere('email', 'like', "%$request->q%")
->orWhere('phone', 'ilike', "%$request->q%"); ->orWhere('phone', 'like', "%$request->q%");
}); });
}); });
} }

@ -13,7 +13,7 @@ class LocationController extends Controller
$query = Location::orderBy('updated_at', 'desc'); $query = Location::orderBy('updated_at', 'desc');
if ($request->q != '') { if ($request->q != '') {
$query->where('name', 'ilike', "%$request->q%"); $query->where('name', 'like', "%$request->q%");
} }
return inertia('Location/Index', [ return inertia('Location/Index', [

@ -19,8 +19,8 @@ class LocationProfileController extends Controller
} }
if ($request->q != '') { if ($request->q != '') {
$query->where('name', 'ilike', "%$request->q%") $query->where('name', 'like', "%$request->q%")
->orWhere('display_note', 'ilike', "%$request->q%"); ->orWhere('display_note', 'like', "%$request->q%");
} }
return inertia('LocationProfile/Index', [ return inertia('LocationProfile/Index', [

@ -22,11 +22,11 @@ class PaylaterController extends Controller
if ($request->q != '') { if ($request->q != '') {
$deposits->where(function ($query) use ($request) { $deposits->where(function ($query) use ($request) {
$query->where('description', 'ilike', "%$request->q%") $query->where('description', 'like', "%$request->q%")
->orWhereHas('customer', function ($query) use ($request) { ->orWhereHas('customer', function ($query) use ($request) {
$query->where('fullname', 'ilike', "%$request->q%") $query->where('fullname', 'like', "%$request->q%")
->orWhere('email', 'ilike', "%$request->q%") ->orWhere('email', 'like', "%$request->q%")
->orWhere('phone', 'ilike', "%$request->q%"); ->orWhere('phone', 'like', "%$request->q%");
}); });
}); });
} }

@ -20,7 +20,7 @@ class RoleController extends Controller
$query = Role::query()->with(['users']); $query = Role::query()->with(['users']);
if ($request->q) { if ($request->q) {
$query->where('name', 'ilike', "%{$request->q}%"); $query->where('name', 'like', "%{$request->q}%");
} }
$query->orderBy('created_at', 'desc'); $query->orderBy('created_at', 'desc');

@ -39,11 +39,11 @@ class SaleController extends Controller
->withCount(['items']); ->withCount(['items']);
if ($request->q != '') { if ($request->q != '') {
$query->where('code', 'ilike', "%$request->q%") $query->where('code', 'like', "%$request->q%")
->orWhereHas('customer', function ($query) use ($request) { ->orWhereHas('customer', function ($query) use ($request) {
$query->where('name', 'ilike', "%$request->q%") $query->where('name', 'like', "%$request->q%")
->orWhere('fullname', 'ilike', "%$request->q%") ->orWhere('fullname', 'like', "%$request->q%")
->orWhere('username', 'ilike', "%$request->q%"); ->orWhere('username', 'like', "%$request->q%");
}); });
} }

@ -15,7 +15,7 @@ class UserController extends Controller
$query = User::query()->with(['role']); $query = User::query()->with(['role']);
if ($request->q) { if ($request->q) {
$query->where('name', 'ilike', "%{$request->q}%"); $query->where('name', 'like', "%{$request->q}%");
} }
$query->orderBy('created_at', 'desc'); $query->orderBy('created_at', 'desc');
@ -70,9 +70,9 @@ class UserController extends Controller
{ {
$request->validate([ $request->validate([
'name' => 'required|string|max:255', 'name' => 'required|string|max:255',
'email' => 'required|email|unique:users,email,'.$user->id, 'email' => 'required|email|unique:users,email,' . $user->id,
'password' => 'nullable|string|max:255', 'password' => 'nullable|string|max:255',
'username' => 'required|alpha_dash|unique:users,username,'.$user->id, 'username' => 'required|alpha_dash|unique:users,username,' . $user->id,
'phone_wa' => 'required|string', 'phone_wa' => 'required|string',
'photo' => 'nullable|image', 'photo' => 'nullable|image',
]); ]);

@ -19,7 +19,7 @@ class VoucherController extends Controller
$query = Location::orderBy('updated_at', 'desc'); $query = Location::orderBy('updated_at', 'desc');
if ($request->q != '') { if ($request->q != '') {
$query->where('name', 'ilike', "%$request->q%"); $query->where('name', 'like', "%$request->q%");
} }
return inertia('Voucher/Location', [ return inertia('Voucher/Location', [
@ -37,8 +37,8 @@ class VoucherController extends Controller
} }
if ($request->q != '') { if ($request->q != '') {
$query->where('name', 'ilike', "%$request->q%") $query->where('name', 'like', "%$request->q%")
->orWhere('display_note', 'ilike', "%$request->q%"); ->orWhere('display_note', 'like', "%$request->q%");
} }
return inertia('Voucher/Profile', [ return inertia('Voucher/Profile', [
@ -54,10 +54,10 @@ class VoucherController extends Controller
->where('location_profile_id', $profile->id); ->where('location_profile_id', $profile->id);
if ($request->q != '') { if ($request->q != '') {
$query->where(function ($query) use ($request){ $query->where(function ($query) use ($request) {
$query->where('username', 'ilike', "%$request->q%") $query->where('username', 'like', "%$request->q%")
->orWhere('comment', 'ilike', "%$request->q%") ->orWhere('comment', 'like', "%$request->q%")
->orWhere('profile', 'ilike', "%$request->q%"); ->orWhere('profile', 'like', "%$request->q%");
}); });
} }

@ -13,9 +13,9 @@ class CustomerController extends Controller
$query = Customer::orderBy('updated_at', 'desc'); $query = Customer::orderBy('updated_at', 'desc');
if ($request->q != '') { if ($request->q != '') {
$query->where('name', 'ilike', "%$request->q%") $query->where('name', 'like', "%$request->q%")
->orWhere('fullname', 'ilike', "%$request->q%") ->orWhere('fullname', 'like', "%$request->q%")
->orWhere('username', 'ilike', "%$request->q%"); ->orWhere('username', 'like', "%$request->q%");
} }
if ($request->levels != '') { if ($request->levels != '') {

@ -13,7 +13,7 @@ class LocationController extends Controller
$query = Location::orderBy('updated_at', 'desc'); $query = Location::orderBy('updated_at', 'desc');
if ($request->q != '') { if ($request->q != '') {
$query->where('name', 'ilike', "%$request->q%"); $query->where('name', 'like', "%$request->q%");
} }
return $query->limit(100)->get(); return $query->limit(100)->get();

@ -14,9 +14,9 @@ class LocationProfileController extends Controller
->orderBy('updated_at', 'desc'); ->orderBy('updated_at', 'desc');
if ($request->q != '') { if ($request->q != '') {
$query->where('name', 'ilike', "%$request->q%") $query->where('name', 'like', "%$request->q%")
->orWhere('display_note', 'ilike', "%$request->q%") ->orWhere('display_note', 'like', "%$request->q%")
->orWhereHas('location', fn ($q) => $q->where('name', 'ilike', "%$request->q%")); ->orWhereHas('location', fn ($q) => $q->where('name', 'like', "%$request->q%"));
} }
return $query->limit(100)->get(); return $query->limit(100)->get();

@ -13,7 +13,7 @@ class RoleController extends Controller
$query = Role::query(); $query = Role::query();
if ($request->q) { if ($request->q) {
$query->where('name', 'ilike', "%{$request->q}%"); $query->where('name', 'like', "%{$request->q}%");
} }
return $query->limit(100)->get(); return $query->limit(100)->get();

@ -51,7 +51,7 @@ class Setting extends Model
{ {
$data = Cache::get('settings'); $data = Cache::get('settings');
if ($data == null) { if ($data == null) {
$settings = Setting::where('key', 'ilike', 'OPEN%')->get(); $settings = Setting::where('key', 'like', 'OPEN%')->get();
foreach ($settings as $setting) { foreach ($settings as $setting) {
$data[$setting->key] = $setting->value; $data[$setting->key] = $setting->value;
} }

@ -26,11 +26,11 @@ class DummySeeder extends Seeder
{ {
$this->info(); $this->info();
$this->banner(); $this->banner();
$this->account(); // $this->account();
$this->location(); // $this->location();
$this->location_profile(); // $this->location_profile();
$this->voucher(); // $this->voucher();
$this->deposit_location(); // $this->deposit_location();
} }
public function info() public function info()
@ -49,8 +49,8 @@ class DummySeeder extends Seeder
$images = ['1.webp', '2.webp', '3.webp']; $images = ['1.webp', '2.webp', '3.webp'];
foreach ($images as $index => $image) { foreach ($images as $index => $image) {
Banner::create([ Banner::create([
'title' => 'Banner '.$index, 'title' => 'Banner ' . $index,
'image' => 'sample/'.$image, 'image' => 'sample/' . $image,
'description' => '<h1>Banner </h1>', 'description' => '<h1>Banner </h1>',
]); ]);
} }
@ -109,7 +109,7 @@ class DummySeeder extends Seeder
$lp = LocationProfile::create([ $lp = LocationProfile::create([
'location_id' => $location->id, 'location_id' => $location->id,
'name' => 'Profile '.$quota, 'name' => 'Profile ' . $quota,
'quota' => $quota, 'quota' => $quota,
'display_note' => rand(0, 1) == 1 ? 'bisa semua' : null, 'display_note' => rand(0, 1) == 1 ? 'bisa semua' : null,
'expired' => rand(1, 3), 'expired' => rand(1, 3),

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save