Passed
Branch develop (995037)
by Ajit
05:32
created
app/Lubus/Utilities.php 3 patches
Indentation   +540 added lines, -540 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
 static function setActiveMenu($uri,$isParent = false)
15 15
 {
16
-	$class = ($isParent) ? 'active open' : 'active';
16
+    $class = ($isParent) ? 'active open' : 'active';
17 17
     return \Request::is($uri) ? $class : '';
18 18
     //return \Request::is($uri);
19 19
 }
@@ -21,68 +21,68 @@  discard block
 block discarded – undo
21 21
 // Get Setting
22 22
 static function getSetting($key)
23 23
 {
24
-	$settingValue = Setting::where('key','=',$key)->pluck('value');
25
-	return $settingValue;
24
+    $settingValue = Setting::where('key','=',$key)->pluck('value');
25
+    return $settingValue;
26 26
 }
27 27
 
28 28
 //get Settings
29 29
 static function getSettings()
30 30
 {
31
-	$settings = Setting::all();
32
-	$settings_array = array();
31
+    $settings = Setting::all();
32
+    $settings_array = array();
33 33
 
34
-	foreach ($settings as $setting) {
35
-		$settings_array[$setting->key] = $setting->value;
36
-	}
34
+    foreach ($settings as $setting) {
35
+        $settings_array[$setting->key] = $setting->value;
36
+    }
37 37
 
38
-	return $settings_array;
38
+    return $settings_array;
39 39
 }
40 40
 
41 41
 
42 42
 //Follow up Status
43 43
 static function getFollowUpStatus($status)
44 44
 {
45
-	switch ($status) {
46
-		case '1':
47
-			return "Done"; 
48
-			break;
49
-
50
-	    default :
51
-	        return "Pending";
52
-	        break;
53
-	}
45
+    switch ($status) {
46
+        case '1':
47
+            return "Done"; 
48
+            break;
49
+
50
+        default :
51
+            return "Pending";
52
+            break;
53
+    }
54 54
 }
55 55
 
56 56
 //Follow up by
57 57
 static function getFollowupBy($followUpBy)
58 58
 {
59
-	switch ($followUpBy) {
60
-		case '1':
61
-			return "SMS";
62
-			break;
63
-
64
-		case '2':
65
-			return "Personal";
66
-			break;
67
-
68
-	    default :
69
-	        return "Call";
70
-	        break;
71
-	}
59
+    switch ($followUpBy) {
60
+        case '1':
61
+            return "SMS";
62
+            break;
63
+
64
+        case '2':
65
+            return "Personal";
66
+            break;
67
+
68
+        default :
69
+            return "Call";
70
+            break;
71
+    }
72 72
 }
73 73
 
74 74
 //FollowUp Status Icon bg
75 75
 static function getIconBg($status)
76 76
 {
77
-	switch ($status) {
78
-		case '1':
79
-			return "bg-blue-400 border-blue-700"; 
80
-			break;
81
-
82
-	    default :
83
-	        return "bg-orange-400 border-orange-700";
84
-	        break;
85
-	}
77
+    switch ($status) {
78
+        case '1':
79
+            return "bg-blue-400 border-blue-700"; 
80
+            break;
81
+
82
+        default :
83
+            return "bg-orange-400 border-orange-700";
84
+            break;
85
+    }
86 86
 }
87 87
 
88 88
 
@@ -90,123 +90,123 @@  discard block
 block discarded – undo
90 90
 //Followup Status Icon
91 91
 static function getStatusIcon($status)
92 92
 {
93
-	switch ($status) {
94
-		case '1':
95
-			return "fa fa-thumbs-up"; 
96
-			break;
97
-
98
-	    default :
99
-	        return "fa fa-refresh";
100
-	        break;
101
-	}
93
+    switch ($status) {
94
+        case '1':
95
+            return "fa fa-thumbs-up"; 
96
+            break;
97
+
98
+        default :
99
+            return "fa fa-refresh";
100
+            break;
101
+    }
102 102
 }
103 103
 
104 104
 
105 105
 // Aim for member & enquiry creation
106 106
 static function getAim($aim)
107 107
 {
108
-	switch ($aim) {
109
-		case '1':
110
-			return "Networking";
111
-			break;
108
+    switch ($aim) {
109
+        case '1':
110
+            return "Networking";
111
+            break;
112 112
 		
113
-		case '2':
114
-			return "Body Building";
115
-			break;
116
-
117
-		case '3':
118
-			return "Fatloss";
119
-			break;
120
-
121
-		case '4':
122
-			return "Weightgain";
123
-			break;
124
-
125
-		case '5':
126
-			return "Others";
127
-			break;
128
-
129
-	    default :
130
-	        return "Fitness";
131
-	        break;
132
-	}
113
+        case '2':
114
+            return "Body Building";
115
+            break;
116
+
117
+        case '3':
118
+            return "Fatloss";
119
+            break;
120
+
121
+        case '4':
122
+            return "Weightgain";
123
+            break;
124
+
125
+        case '5':
126
+            return "Others";
127
+            break;
128
+
129
+        default :
130
+            return "Fitness";
131
+            break;
132
+    }
133 133
 }
134 134
 
135 135
 
136 136
 // Invoice Labels
137 137
 static function getInvoiceLabel($status)
138 138
 {
139
-	switch ($status) {
140
-		case '0':
141
-			return "label label-danger";
142
-			break;
139
+    switch ($status) {
140
+        case '0':
141
+            return "label label-danger";
142
+            break;
143 143
 		
144
-		case '1':
145
-			return "label label-success";
146
-			break;
147
-
148
-		case '3':
149
-			return "label label-default";
150
-			break;
151
-
152
-	    default :
153
-	        return "label label-primary";
154
-	        break;
155
-	}
144
+        case '1':
145
+            return "label label-success";
146
+            break;
147
+
148
+        case '3':
149
+            return "label label-default";
150
+            break;
151
+
152
+        default :
153
+            return "label label-primary";
154
+            break;
155
+    }
156 156
 }
157 157
 
158 158
 // Expense alert repeat
159 159
 static function expenseRepeatIntervel($repeat)
160 160
 {
161
-	switch ($repeat) {
162
-		case '0':
163
-			return "Never Repeat";
164
-			break;
161
+    switch ($repeat) {
162
+        case '0':
163
+            return "Never Repeat";
164
+            break;
165 165
 		
166
-		case '1':
167
-			return "Every Day";
168
-			break;
169
-
170
-		case '2':
171
-			return "Every Week";
172
-			break;
173
-
174
-		case '3':
175
-			return "Every Month";
176
-			break;
177
-
178
-	    default :
179
-	        return "Every Year";
180
-	        break;
181
-	}
166
+        case '1':
167
+            return "Every Day";
168
+            break;
169
+
170
+        case '2':
171
+            return "Every Week";
172
+            break;
173
+
174
+        case '3':
175
+            return "Every Month";
176
+            break;
177
+
178
+        default :
179
+            return "Every Year";
180
+            break;
181
+    }
182 182
 }
183 183
 
184 184
 //Paid Unpaid Labels
185 185
 static function getPaidUnpaid($status)
186 186
 {
187
-	switch ($status) {
188
-		case '0':
189
-			return "label label-danger";
190
-			break;
191
-
192
-	    default :
193
-	        return "label label-primary";
194
-	        break;
195
-	}
187
+    switch ($status) {
188
+        case '0':
189
+            return "label label-danger";
190
+            break;
191
+
192
+        default :
193
+            return "label label-primary";
194
+            break;
195
+    }
196 196
 }
197 197
 
198 198
 //Active-Inactive Labels
199 199
 static function getActiveInactive($status)
200 200
 {
201
-	switch ($status) {
202
-		case '0':
203
-			return "label label-danger";
204
-			break;
205
-
206
-	    default :
207
-	        return "label label-primary";
208
-	        break;
209
-	}
201
+    switch ($status) {
202
+        case '0':
203
+            return "label label-danger";
204
+            break;
205
+
206
+        default :
207
+            return "label label-primary";
208
+            break;
209
+    }
210 210
 }
211 211
 
212 212
 
@@ -214,31 +214,31 @@  discard block
 block discarded – undo
214 214
 // Occupation of members
215 215
 static function getOccupation($occupation)
216 216
 {
217
-	switch ($occupation) {
218
-		case '1':
219
-			return "Housewife";
220
-			break;
217
+    switch ($occupation) {
218
+        case '1':
219
+            return "Housewife";
220
+            break;
221 221
 		
222
-		case '2':
223
-			return "Self Employed";
224
-			break;
225
-
226
-		case '3':
227
-			return "Professional";
228
-			break;
229
-
230
-		case '4':
231
-			return "Freelancer";
232
-			break;
233
-
234
-		case '5':
235
-			return "Others";
236
-			break;
237
-
238
-	    default :
239
-	        return "Student";
240
-	        break;
241
-	}
222
+        case '2':
223
+            return "Self Employed";
224
+            break;
225
+
226
+        case '3':
227
+            return "Professional";
228
+            break;
229
+
230
+        case '4':
231
+            return "Freelancer";
232
+            break;
233
+
234
+        case '5':
235
+            return "Others";
236
+            break;
237
+
238
+        default :
239
+            return "Student";
240
+            break;
241
+    }
242 242
 }
243 243
 
244 244
 
@@ -246,82 +246,82 @@  discard block
 block discarded – undo
246 246
 // Source for member & enquiry creation
247 247
 static function getSource($source)
248 248
 {
249
-	switch ($source) {
250
-		case '1':
251
-			return "Word of mouth";
252
-			break;
249
+    switch ($source) {
250
+        case '1':
251
+            return "Word of mouth";
252
+            break;
253 253
 		
254
-		case '2':
255
-			return "Others";
256
-			break;
257
-
258
-	    default :
259
-	        return "Promotions";
260
-	        break;
261
-	}
254
+        case '2':
255
+            return "Others";
256
+            break;
257
+
258
+        default :
259
+            return "Promotions";
260
+            break;
261
+    }
262 262
 }
263 263
 
264 264
 
265 265
 // Member Status
266 266
 static function getStatusValue($status)
267 267
 {
268
-	switch ($status) {
269
-		case '0':
270
-			return "Inactive";
271
-			break;
268
+    switch ($status) {
269
+        case '0':
270
+            return "Inactive";
271
+            break;
272 272
 		
273
-		case '2':
274
-			return "Archived";
275
-			break;
276
-
277
-	    default :
278
-	        return "Active";
279
-	        break;
280
-	}
273
+        case '2':
274
+            return "Archived";
275
+            break;
276
+
277
+        default :
278
+            return "Active";
279
+            break;
280
+    }
281 281
 }
282 282
 
283 283
 // Enquiry Status
284 284
 static function getEnquiryStatus($status)
285 285
 {
286
-	switch ($status) {
287
-		case '0':
288
-			return "Lost";
289
-			break;
286
+    switch ($status) {
287
+        case '0':
288
+            return "Lost";
289
+            break;
290 290
 		
291
-		case '2':
292
-			return "Member";
293
-			break;
291
+        case '2':
292
+            return "Member";
293
+            break;
294 294
 			
295
-	    default :
296
-	        return "Lead";
297
-	        break;
298
-	}
295
+        default :
296
+            return "Lead";
297
+            break;
298
+    }
299 299
 }
300 300
 
301 301
 // Enquiry Label
302 302
 static function getEnquiryLabel($status)
303 303
 {
304
-	switch ($status) {
305
-		case '0':
306
-			return "label label-danger";
307
-			break;
304
+    switch ($status) {
305
+        case '0':
306
+            return "label label-danger";
307
+            break;
308 308
 		
309
-		case '2':
310
-			return "label label-success";
311
-			break;
312
-
313
-	    default :
314
-	        return "label label-primary";
315
-	        break;
316
-	}
309
+        case '2':
310
+            return "label label-success";
311
+            break;
312
+
313
+        default :
314
+            return "label label-primary";
315
+            break;
316
+    }
317 317
 }
318 318
 
319 319
 // Set invoice status
320 320
 static function setInvoiceStatus($amount_due,$invoice_total)
321 321
 {
322
-	if($amount_due == 0)
322
+    if($amount_due == 0)
323 323
     {
324
-         $paymentStatus = \constPaymentStatus::Paid;
324
+            $paymentStatus = \constPaymentStatus::Paid;
325 325
     } 
326 326
     elseif($amount_due > 0 && $amount_due < $invoice_total) 
327 327
     {
@@ -342,162 +342,162 @@  discard block
 block discarded – undo
342 342
 // Invoice Status
343 343
 static function getInvoiceStatus($status)
344 344
 {
345
-	switch ($status) {
346
-		case '1':
347
-			return "Paid";
348
-			break;
345
+    switch ($status) {
346
+        case '1':
347
+            return "Paid";
348
+            break;
349 349
 		
350
-		case '2':
351
-			return "Partial";
352
-			break;
353
-
354
-		case '3':
355
-			return "Overpaid";
356
-			break;
357
-
358
-	    default :
359
-	        return "Unpaid";
360
-	        break;
361
-	}
350
+        case '2':
351
+            return "Partial";
352
+            break;
353
+
354
+        case '3':
355
+            return "Overpaid";
356
+            break;
357
+
358
+        default :
359
+            return "Unpaid";
360
+            break;
361
+    }
362 362
 }
363 363
 
364 364
 
365 365
 // Subcription Status
366 366
 static function getSubscriptionStatus($status)
367 367
 {
368
-	switch ($status) {
369
-		case '0':
370
-			return "Expired";
371
-			break;
368
+    switch ($status) {
369
+        case '0':
370
+            return "Expired";
371
+            break;
372 372
 		
373
-		case '2':
374
-			return "Renewed";
375
-			break;
376
-
377
-		case '3':
378
-			return "Cancelled";
379
-			break;
380
-
381
-	    default :
382
-	        return "OnGoing";
383
-	        break;
384
-	}
373
+        case '2':
374
+            return "Renewed";
375
+            break;
376
+
377
+        case '3':
378
+            return "Cancelled";
379
+            break;
380
+
381
+        default :
382
+            return "OnGoing";
383
+            break;
384
+    }
385 385
 }
386 386
 
387 387
 
388 388
 // Subcription Label
389 389
 static function getSubscriptionLabel($status)
390 390
 {
391
-	switch ($status) {
392
-		case '0':
393
-			return "label label-danger";
394
-			break;
391
+    switch ($status) {
392
+        case '0':
393
+            return "label label-danger";
394
+            break;
395 395
 		
396
-		case '2':
397
-			return "label label-success";
398
-			break;
399
-
400
-		case '3':
401
-			return "label label-default";
402
-			break;
403
-
404
-	    default :
405
-	        return "label label-primary";
406
-	        break;
407
-	}
396
+        case '2':
397
+            return "label label-success";
398
+            break;
399
+
400
+        case '3':
401
+            return "label label-default";
402
+            break;
403
+
404
+        default :
405
+            return "label label-primary";
406
+            break;
407
+    }
408 408
 }
409 409
 
410 410
 
411 411
 // Payment Mode
412 412
 static function getPaymentMode($status)
413 413
 {
414
-	switch ($status) {
415
-		case '0':
416
-			return "Cheque";
417
-			break;
418
-
419
-	    default :
420
-	        return "Cash";
421
-	        break;
422
-	}
414
+    switch ($status) {
415
+        case '0':
416
+            return "Cheque";
417
+            break;
418
+
419
+        default :
420
+            return "Cash";
421
+            break;
422
+    }
423 423
 }
424 424
 
425 425
 // Cheque status
426 426
 static function getChequeStatus($status)
427 427
 {
428
-	switch ($status) {
429
-		case '1':
430
-			return "Deposited";
431
-			break;
432
-
433
-		case '2':
434
-			return "Cleared";
435
-			break;
436
-
437
-		case '3':
438
-			return "Bounced";
439
-			break;
440
-
441
-		case '4':
442
-			return "Reissued";
443
-			break;
444
-
445
-	    default :
446
-	        return "Recieved";
447
-	        break;
448
-	}
428
+    switch ($status) {
429
+        case '1':
430
+            return "Deposited";
431
+            break;
432
+
433
+        case '2':
434
+            return "Cleared";
435
+            break;
436
+
437
+        case '3':
438
+            return "Bounced";
439
+            break;
440
+
441
+        case '4':
442
+            return "Reissued";
443
+            break;
444
+
445
+        default :
446
+            return "Recieved";
447
+            break;
448
+    }
449 449
 }
450 450
 
451 451
 // Get Gender
452 452
 static function getGender($gender)
453 453
 {
454
-	switch ($gender) 
455
-	{
456
-		case 'm':
457
-			return "Male";
458
-			break;
454
+    switch ($gender) 
455
+    {
456
+        case 'm':
457
+            return "Male";
458
+            break;
459 459
 		
460
-		case 'f':
461
-			return "Female";
462
-			break;
463
-	}
460
+        case 'f':
461
+            return "Female";
462
+            break;
463
+    }
464 464
 }
465 465
 
466 466
 
467 467
 //Get invoice display name type
468 468
 static function getDisplay($display)
469 469
 {
470
-	switch ($display) 
471
-	{
472
-		case 'gym_logo':
473
-			return "Gym Logo";
474
-			break;
470
+    switch ($display) 
471
+    {
472
+        case 'gym_logo':
473
+            return "Gym Logo";
474
+            break;
475 475
 		
476
-		default:
477
-			return "Gym Name";
478
-			break;
479
-	}
476
+        default:
477
+            return "Gym Name";
478
+            break;
479
+    }
480 480
 }
481 481
 
482 482
 
483 483
 // Get Numbering mode 
484 484
 static function getMode($mode)
485 485
 {
486
-	switch ($mode) 
487
-	{
488
-		case '0':
489
-			return "Manual";
490
-			break;
486
+    switch ($mode) 
487
+    {
488
+        case '0':
489
+            return "Manual";
490
+            break;
491 491
 		
492
-		default :
493
-			return "Automatic";
494
-			break;
495
-	}
492
+        default :
493
+            return "Automatic";
494
+            break;
495
+    }
496 496
 }
497 497
 
498 498
 static function getGreeting(){
499
-	//$time = date("H");
500
-	$time = Carbon::now()->hour;
499
+    //$time = date("H");
500
+    $time = Carbon::now()->hour;
501 501
     /* If the time is less than 1200 hours, show good morning */
502 502
     if ($time < "12") {
503 503
         echo "Good morning";
@@ -521,258 +521,258 @@  discard block
 block discarded – undo
521 521
 *File Upload
522 522
 **/
523 523
 
524
-	static function uploadFile(Request $request, $prefix, $recordId, $upload_field, $upload_path)
525
-		{		
526
-		if ($request->hasFile($upload_field)) 
527
-			{
528
-				$file = $request->file($upload_field);
524
+    static function uploadFile(Request $request, $prefix, $recordId, $upload_field, $upload_path)
525
+        {		
526
+        if ($request->hasFile($upload_field)) 
527
+            {
528
+                $file = $request->file($upload_field);
529 529
 
530
-	            if ($file->isValid())
530
+                if ($file->isValid())
531 531
                 {
532
-                	File::delete(public_path('assets/img/gym/gym_logo.jpg'));
533
-                	$fileName = "gym_logo.jpg";
532
+                    File::delete(public_path('assets/img/gym/gym_logo.jpg'));
533
+                    $fileName = "gym_logo.jpg";
534 534
                     $destinationPath = public_path($upload_path);
535 535
                     $request->file($upload_field)->move($destinationPath,$fileName);
536 536
                     Image::make($destinationPath."/".$fileName)->resize(600, null, function ($constraint) {
537
-																					    $constraint->aspectRatio();
538
-																					})->save();
537
+                                                                                        $constraint->aspectRatio();
538
+                                                                                    })->save();
539 539
                 }
540
-			}
541
-		}
542
-
543
-	static function registrationsTrend()
544
-	{
545
-		// Get Financial date
546
-		$startDate = new Carbon(Setting::where('key','=','financial_start')->pluck('value'));
547
-		$data = array();
540
+            }
541
+        }
542
+
543
+    static function registrationsTrend()
544
+    {
545
+        // Get Financial date
546
+        $startDate = new Carbon(Setting::where('key','=','financial_start')->pluck('value'));
547
+        $data = array();
548 548
 		
549
-		for ($i=1; $i <= 12 ; $i++) { 
550
-			//$members = member::registrations($startDate->month,$startDate->year); // Laravel Scoped Query Issue: Workaroud Needed
551
-			$members = Member::whereMonth('created_at', '=', $startDate->month)->whereYear('created_at', '=',$startDate->year)->count();
552
-			$data[] = array("month" => $startDate->format('Y-m'), "registrations" => $members);
553
-			$startDate->addMonth();
554
-		}
555
-
556
-		return json_encode($data);
557
-	}
558
-
559
-
560
-	static function membersPerPlan()
561
-	{
562
-		$data = array();
563
-
564
-		$plans = Plan::onlyActive()->get();
565
-
566
-		foreach ($plans as $plan) 
567
-		{
568
-			$subscriptions = Subscription::where('status','=',\constSubscription::onGoing)->where('plan_id','=',$plan->id)->count();
569
-			$data[] = array('label' =>$plan->plan_name ,'value'=>$subscriptions);
570
-		}
571
-		return json_encode($data);		
572
-	}
573
-
574
-	// Checking logonutility gateway status
575
-	static function smsGatewayStatus()
576
-	{
577
-		try
578
-		{
579
-			$api_key = Utilities::getSetting('sms_api_key');
580
-
581
-			$api_url = "http://logonutility.in/app/miscapi/".$api_key."/getBalance/true/";
582
-
583
-			if(Utilities::isDomainAvailible($api_url))
584
-	        {
585
-	               return true;
586
-	        }
587
-	        else
588
-	        {
589
-	               return false;
590
-	        }			
549
+        for ($i=1; $i <= 12 ; $i++) { 
550
+            //$members = member::registrations($startDate->month,$startDate->year); // Laravel Scoped Query Issue: Workaroud Needed
551
+            $members = Member::whereMonth('created_at', '=', $startDate->month)->whereYear('created_at', '=',$startDate->year)->count();
552
+            $data[] = array("month" => $startDate->format('Y-m'), "registrations" => $members);
553
+            $startDate->addMonth();
554
+        }
555
+
556
+        return json_encode($data);
557
+    }
558
+
559
+
560
+    static function membersPerPlan()
561
+    {
562
+        $data = array();
563
+
564
+        $plans = Plan::onlyActive()->get();
565
+
566
+        foreach ($plans as $plan) 
567
+        {
568
+            $subscriptions = Subscription::where('status','=',\constSubscription::onGoing)->where('plan_id','=',$plan->id)->count();
569
+            $data[] = array('label' =>$plan->plan_name ,'value'=>$subscriptions);
570
+        }
571
+        return json_encode($data);		
572
+    }
573
+
574
+    // Checking logonutility gateway status
575
+    static function smsGatewayStatus()
576
+    {
577
+        try
578
+        {
579
+            $api_key = Utilities::getSetting('sms_api_key');
580
+
581
+            $api_url = "http://logonutility.in/app/miscapi/".$api_key."/getBalance/true/";
582
+
583
+            if(Utilities::isDomainAvailible($api_url))
584
+            {
585
+                    return true;
586
+            }
587
+            else
588
+            {
589
+                    return false;
590
+            }			
591 591
 						
592
-		}
593
-		catch(Exception $e)
594
-		{
595
-			return false;
596
-		}
597
-	}
598
-
599
-
600
-   // returns true, if domain is availible, false if not
601
-   static function isDomainAvailible($domain)
602
-   {
603
-       //check, if a valid url is provided
604
-       if(!filter_var($domain, FILTER_VALIDATE_URL))
605
-       {
606
-               return false;
607
-       }
608
-
609
-       //initialize curl
610
-       $curlInit = curl_init($domain);
611
-       curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
612
-       curl_setopt($curlInit,CURLOPT_HEADER,true);
613
-       curl_setopt($curlInit,CURLOPT_NOBODY,true);
614
-       curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
615
-
616
-       //get answer
617
-       $response = curl_exec($curlInit);
618
-
619
-       curl_close($curlInit);
620
-
621
-       if ($response) return true;
622
-
623
-       return false;
624
-   }
625
-
626
-
627
-	static function Sms($sender_id,$member_contact,$sms_text,$sms_status)
628
-	{
629
-		$sms = Utilities::getSetting('sms');
630
-		$gatewayStatus = Utilities::smsGatewayStatus();
631
-
632
-		if ($sms && $sms_status) 
633
-		{
634
-			if($gatewayStatus)
635
-			{
636
-				$api_key = Utilities::getSetting('sms_api_key');
637
-				$contacts = $member_contact;
638
-				$from = $sender_id;
639
-				$send_sms_text = urlencode($sms_text);
640
-
641
-				//Transactional = 20 , Promo with sender id = 21 , only promotional = 18
642
-				$api_url = "http://www.logonutility.in/app/smsapi/index.php?key=".$api_key."&campaign=1&routeid=20&type=text&contacts=".$contacts."&senderid=".$from."&msg=".$send_sms_text;
643
-
644
-				//Submit to server
645
-				$response = file_get_contents($api_url);
646
-
647
-				if (str_contains($response,'SMS-SHOOT-ID')) 
648
-				{
649
-					//Log entry for SMS_log table
650
-					$SmsLogData = array('shoot_id' => substr($response, strpos($response, "SMS-SHOOT-ID/") + 13),
651
-										'number' => $member_contact,
652
-										'message' => $sms_text,
653
-										'sender_id' => $sender_id,
654
-										'send_time' => Carbon::now(),
655
-										'status' => 'NA');
656
-
657
-					$SmsLog  = new Sms_log($SmsLogData);
658
-					$SmsLog->save();
659
-				}
660
-				//Update SMS balance
661
-				Utilities::smsBalance();
662
-			}
663
-			else
664
-			{
665
-				$SmsLogData = array('shoot_id' => '',
666
-									'number' => $member_contact,
667
-									'message' => $sms_text,
668
-									'sender_id' => $sender_id,
669
-									'send_time' => Carbon::now(),
670
-									'status' => 'offline');
671
-
672
-				$SmsLog  = new Sms_log($SmsLogData);
673
-				$SmsLog->save();
674
-			}
592
+        }
593
+        catch(Exception $e)
594
+        {
595
+            return false;
596
+        }
597
+    }
598
+
599
+
600
+    // returns true, if domain is availible, false if not
601
+    static function isDomainAvailible($domain)
602
+    {
603
+        //check, if a valid url is provided
604
+        if(!filter_var($domain, FILTER_VALIDATE_URL))
605
+        {
606
+                return false;
607
+        }
608
+
609
+        //initialize curl
610
+        $curlInit = curl_init($domain);
611
+        curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
612
+        curl_setopt($curlInit,CURLOPT_HEADER,true);
613
+        curl_setopt($curlInit,CURLOPT_NOBODY,true);
614
+        curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
615
+
616
+        //get answer
617
+        $response = curl_exec($curlInit);
618
+
619
+        curl_close($curlInit);
620
+
621
+        if ($response) return true;
622
+
623
+        return false;
624
+    }
625
+
626
+
627
+    static function Sms($sender_id,$member_contact,$sms_text,$sms_status)
628
+    {
629
+        $sms = Utilities::getSetting('sms');
630
+        $gatewayStatus = Utilities::smsGatewayStatus();
631
+
632
+        if ($sms && $sms_status) 
633
+        {
634
+            if($gatewayStatus)
635
+            {
636
+                $api_key = Utilities::getSetting('sms_api_key');
637
+                $contacts = $member_contact;
638
+                $from = $sender_id;
639
+                $send_sms_text = urlencode($sms_text);
640
+
641
+                //Transactional = 20 , Promo with sender id = 21 , only promotional = 18
642
+                $api_url = "http://www.logonutility.in/app/smsapi/index.php?key=".$api_key."&campaign=1&routeid=20&type=text&contacts=".$contacts."&senderid=".$from."&msg=".$send_sms_text;
643
+
644
+                //Submit to server
645
+                $response = file_get_contents($api_url);
646
+
647
+                if (str_contains($response,'SMS-SHOOT-ID')) 
648
+                {
649
+                    //Log entry for SMS_log table
650
+                    $SmsLogData = array('shoot_id' => substr($response, strpos($response, "SMS-SHOOT-ID/") + 13),
651
+                                        'number' => $member_contact,
652
+                                        'message' => $sms_text,
653
+                                        'sender_id' => $sender_id,
654
+                                        'send_time' => Carbon::now(),
655
+                                        'status' => 'NA');
656
+
657
+                    $SmsLog  = new Sms_log($SmsLogData);
658
+                    $SmsLog->save();
659
+                }
660
+                //Update SMS balance
661
+                Utilities::smsBalance();
662
+            }
663
+            else
664
+            {
665
+                $SmsLogData = array('shoot_id' => '',
666
+                                    'number' => $member_contact,
667
+                                    'message' => $sms_text,
668
+                                    'sender_id' => $sender_id,
669
+                                    'send_time' => Carbon::now(),
670
+                                    'status' => 'offline');
671
+
672
+                $SmsLog  = new Sms_log($SmsLogData);
673
+                $SmsLog->save();
674
+            }
675 675
 			
676
-		}
677
-	}
678
-
679
-	static function retrySms($sender_id,$member_contact,$sms_text,$log)
680
-	{
681
-		$gatewayStatus = Utilities::smsGatewayStatus();
682
-
683
-		if($gatewayStatus)
684
-		{
685
-			$api_key = Utilities::getSetting('sms_api_key');
686
-			$contacts = $member_contact;
687
-			$from = $sender_id;
688
-			$send_sms_text = urlencode($sms_text);
689
-
690
-			//Transactional = 20 , Promo with sender id = 21 , only promotional = 18
691
-			$api_url = "http://www.logonutility.in/app/smsapi/index.php?key=".$api_key."&campaign=1&routeid=21&type=text&contacts=".$contacts."&senderid=".$from."&msg=".$send_sms_text;
692
-
693
-			//Submit to server
694
-			$response = file_get_contents($api_url);
695
-
696
-			if (str_contains($response,'SMS-SHOOT-ID')) 
697
-			{
698
-				//Log entry for SMS_log table
699
-				$log->update(['shoot_id' => substr($response, strpos($response, "SMS-SHOOT-ID/") + 13),
700
-							  'number' => $member_contact,
701
-							  'message' => $sms_text,
702
-							  'sender_id' => $sender_id,
703
-							  'send_time' => Carbon::now(),
704
-							  'status' => 'NA']);
705
-				$log->save();
706
-			}
707
-			//Update SMS balance
708
-			Utilities::smsBalance();
709
-		}
710
-	}
711
-
712
-	static function smsBalance()
713
-	{
714
-		$sms = Utilities::getSetting('sms');
715
-		$gatewayStatus = Utilities::smsGatewayStatus();
716
-
717
-		if($sms && $gatewayStatus)
718
-		{
719
-			$api_key = Utilities::getSetting('sms_api_key');
720
-
721
-			$api_url = "http://logonutility.in/app/miscapi/".$api_key."/getBalance/true/";
722
-
723
-			//Submit to server
724
-
725
-			$credit_balance = file_get_contents($api_url);
726
-			$balance = json_decode($credit_balance);
727
-			Setting::where('key', '=','sms_balance')->update(['value' => $balance[0]->BALANCE]);
728
-
729
-			// If balance turns zero turn off SMS
730
-			if($balance[0]->BALANCE == 0)
731
-			{
732
-				Setting::where('key', '=','sms')->update(['value' => 0]);
733
-			}
734
-		}
735
-	}
736
-
737
-	static function smsStatusUpdate()
738
-	{
739
-		$sms = Utilities::getSetting('sms');
740
-		$gatewayStatus = Utilities::smsGatewayStatus();
741
-
742
-		if($sms && $gatewayStatus)
743
-		{
744
-			$api_key = Utilities::getSetting('sms_api_key');
676
+        }
677
+    }
678
+
679
+    static function retrySms($sender_id,$member_contact,$sms_text,$log)
680
+    {
681
+        $gatewayStatus = Utilities::smsGatewayStatus();
682
+
683
+        if($gatewayStatus)
684
+        {
685
+            $api_key = Utilities::getSetting('sms_api_key');
686
+            $contacts = $member_contact;
687
+            $from = $sender_id;
688
+            $send_sms_text = urlencode($sms_text);
689
+
690
+            //Transactional = 20 , Promo with sender id = 21 , only promotional = 18
691
+            $api_url = "http://www.logonutility.in/app/smsapi/index.php?key=".$api_key."&campaign=1&routeid=21&type=text&contacts=".$contacts."&senderid=".$from."&msg=".$send_sms_text;
692
+
693
+            //Submit to server
694
+            $response = file_get_contents($api_url);
695
+
696
+            if (str_contains($response,'SMS-SHOOT-ID')) 
697
+            {
698
+                //Log entry for SMS_log table
699
+                $log->update(['shoot_id' => substr($response, strpos($response, "SMS-SHOOT-ID/") + 13),
700
+                                'number' => $member_contact,
701
+                                'message' => $sms_text,
702
+                                'sender_id' => $sender_id,
703
+                                'send_time' => Carbon::now(),
704
+                                'status' => 'NA']);
705
+                $log->save();
706
+            }
707
+            //Update SMS balance
708
+            Utilities::smsBalance();
709
+        }
710
+    }
711
+
712
+    static function smsBalance()
713
+    {
714
+        $sms = Utilities::getSetting('sms');
715
+        $gatewayStatus = Utilities::smsGatewayStatus();
716
+
717
+        if($sms && $gatewayStatus)
718
+        {
719
+            $api_key = Utilities::getSetting('sms_api_key');
720
+
721
+            $api_url = "http://logonutility.in/app/miscapi/".$api_key."/getBalance/true/";
722
+
723
+            //Submit to server
724
+
725
+            $credit_balance = file_get_contents($api_url);
726
+            $balance = json_decode($credit_balance);
727
+            Setting::where('key', '=','sms_balance')->update(['value' => $balance[0]->BALANCE]);
728
+
729
+            // If balance turns zero turn off SMS
730
+            if($balance[0]->BALANCE == 0)
731
+            {
732
+                Setting::where('key', '=','sms')->update(['value' => 0]);
733
+            }
734
+        }
735
+    }
736
+
737
+    static function smsStatusUpdate()
738
+    {
739
+        $sms = Utilities::getSetting('sms');
740
+        $gatewayStatus = Utilities::smsGatewayStatus();
741
+
742
+        if($sms && $gatewayStatus)
743
+        {
744
+            $api_key = Utilities::getSetting('sms_api_key');
745 745
 			
746
-			// Retry Offline Msg
747
-			$messages = Sms_log::where('status','offline')->get();
746
+            // Retry Offline Msg
747
+            $messages = Sms_log::where('status','offline')->get();
748 748
 		
749
-			foreach($messages as $message)
750
-			{
751
-				Utilities::retrySms($message->sender_id,$message->number,$message->message,$message);
752
-			}
749
+            foreach($messages as $message)
750
+            {
751
+                Utilities::retrySms($message->sender_id,$message->number,$message->message,$message);
752
+            }
753 753
 			
754 754
 			
755
-			// Update Status
756
-			$messages = Sms_log::whereNotIn('status', ['Delivered','Failed','offline'])->get();
755
+            // Update Status
756
+            $messages = Sms_log::whereNotIn('status', ['Delivered','Failed','offline'])->get();
757 757
 
758
-			foreach($messages as $message)
759
-				{
760
-					$sms_shoot_id = $message->shoot_id;				
761
-					$api_url = "http://logonutility.in/app/miscapi/".$api_key."/getDLR/".$sms_shoot_id;
758
+            foreach($messages as $message)
759
+                {
760
+                    $sms_shoot_id = $message->shoot_id;				
761
+                    $api_url = "http://logonutility.in/app/miscapi/".$api_key."/getDLR/".$sms_shoot_id;
762 762
 
763
-					//Submit to server
764
-					$response = file_get_contents($api_url);
763
+                    //Submit to server
764
+                    $response = file_get_contents($api_url);
765 765
 					
766 766
 					
767
-					$dlr_array = json_decode($response);
767
+                    $dlr_array = json_decode($response);
768 768
 
769
-					//Update Status
770
-					$message->status = $dlr_array[0]->DLR;
771
-					$message->save();
772
-				}
773
-		}
769
+                    //Update Status
770
+                    $message->status = $dlr_array[0]->DLR;
771
+                    $message->save();
772
+                }
773
+        }
774 774
 				
775
-	}
775
+    }
776 776
 
777 777
 }
778 778
 
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 class Utilities {
13 13
 
14
-static function setActiveMenu($uri,$isParent = false)
14
+static function setActiveMenu($uri, $isParent = false)
15 15
 {
16 16
 	$class = ($isParent) ? 'active open' : 'active';
17 17
     return \Request::is($uri) ? $class : '';
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 // Get Setting
22 22
 static function getSetting($key)
23 23
 {
24
-	$settingValue = Setting::where('key','=',$key)->pluck('value');
24
+	$settingValue = Setting::where('key', '=', $key)->pluck('value');
25 25
 	return $settingValue;
26 26
 }
27 27
 
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
 }
318 318
 
319 319
 // Set invoice status
320
-static function setInvoiceStatus($amount_due,$invoice_total)
320
+static function setInvoiceStatus($amount_due, $invoice_total)
321 321
 {
322
-	if($amount_due == 0)
322
+	if ($amount_due == 0)
323 323
     {
324 324
          $paymentStatus = \constPaymentStatus::Paid;
325 325
     } 
326
-    elseif($amount_due > 0 && $amount_due < $invoice_total) 
326
+    elseif ($amount_due > 0 && $amount_due < $invoice_total) 
327 327
     {
328 328
         $paymentStatus = \constPaymentStatus::Partial;
329 329
     }
330
-    elseif($amount_due == $invoice_total) 
330
+    elseif ($amount_due == $invoice_total) 
331 331
     {
332 332
         $paymentStatus = \constPaymentStatus::Unpaid;
333 333
     }
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	}
496 496
 }
497 497
 
498
-static function getGreeting(){
498
+static function getGreeting() {
499 499
 	//$time = date("H");
500 500
 	$time = Carbon::now()->hour;
501 501
     /* If the time is less than 1200 hours, show good morning */
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
                 	File::delete(public_path('assets/img/gym/gym_logo.jpg'));
533 533
                 	$fileName = "gym_logo.jpg";
534 534
                     $destinationPath = public_path($upload_path);
535
-                    $request->file($upload_field)->move($destinationPath,$fileName);
536
-                    Image::make($destinationPath."/".$fileName)->resize(600, null, function ($constraint) {
535
+                    $request->file($upload_field)->move($destinationPath, $fileName);
536
+                    Image::make($destinationPath."/".$fileName)->resize(600, null, function($constraint) {
537 537
 																					    $constraint->aspectRatio();
538 538
 																					})->save();
539 539
                 }
@@ -543,12 +543,12 @@  discard block
 block discarded – undo
543 543
 	static function registrationsTrend()
544 544
 	{
545 545
 		// Get Financial date
546
-		$startDate = new Carbon(Setting::where('key','=','financial_start')->pluck('value'));
546
+		$startDate = new Carbon(Setting::where('key', '=', 'financial_start')->pluck('value'));
547 547
 		$data = array();
548 548
 		
549
-		for ($i=1; $i <= 12 ; $i++) { 
549
+		for ($i = 1; $i <= 12; $i++) { 
550 550
 			//$members = member::registrations($startDate->month,$startDate->year); // Laravel Scoped Query Issue: Workaroud Needed
551
-			$members = Member::whereMonth('created_at', '=', $startDate->month)->whereYear('created_at', '=',$startDate->year)->count();
551
+			$members = Member::whereMonth('created_at', '=', $startDate->month)->whereYear('created_at', '=', $startDate->year)->count();
552 552
 			$data[] = array("month" => $startDate->format('Y-m'), "registrations" => $members);
553 553
 			$startDate->addMonth();
554 554
 		}
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 
566 566
 		foreach ($plans as $plan) 
567 567
 		{
568
-			$subscriptions = Subscription::where('status','=',\constSubscription::onGoing)->where('plan_id','=',$plan->id)->count();
569
-			$data[] = array('label' =>$plan->plan_name ,'value'=>$subscriptions);
568
+			$subscriptions = Subscription::where('status', '=', \constSubscription::onGoing)->where('plan_id', '=', $plan->id)->count();
569
+			$data[] = array('label' =>$plan->plan_name, 'value'=>$subscriptions);
570 570
 		}
571 571
 		return json_encode($data);		
572 572
 	}
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 
581 581
 			$api_url = "http://logonutility.in/app/miscapi/".$api_key."/getBalance/true/";
582 582
 
583
-			if(Utilities::isDomainAvailible($api_url))
583
+			if (Utilities::isDomainAvailible($api_url))
584 584
 	        {
585 585
 	               return true;
586 586
 	        }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	        }			
591 591
 						
592 592
 		}
593
-		catch(Exception $e)
593
+		catch (Exception $e)
594 594
 		{
595 595
 			return false;
596 596
 		}
@@ -601,17 +601,17 @@  discard block
 block discarded – undo
601 601
    static function isDomainAvailible($domain)
602 602
    {
603 603
        //check, if a valid url is provided
604
-       if(!filter_var($domain, FILTER_VALIDATE_URL))
604
+       if (!filter_var($domain, FILTER_VALIDATE_URL))
605 605
        {
606 606
                return false;
607 607
        }
608 608
 
609 609
        //initialize curl
610 610
        $curlInit = curl_init($domain);
611
-       curl_setopt($curlInit,CURLOPT_CONNECTTIMEOUT,10);
612
-       curl_setopt($curlInit,CURLOPT_HEADER,true);
613
-       curl_setopt($curlInit,CURLOPT_NOBODY,true);
614
-       curl_setopt($curlInit,CURLOPT_RETURNTRANSFER,true);
611
+       curl_setopt($curlInit, CURLOPT_CONNECTTIMEOUT, 10);
612
+       curl_setopt($curlInit, CURLOPT_HEADER, true);
613
+       curl_setopt($curlInit, CURLOPT_NOBODY, true);
614
+       curl_setopt($curlInit, CURLOPT_RETURNTRANSFER, true);
615 615
 
616 616
        //get answer
617 617
        $response = curl_exec($curlInit);
@@ -624,14 +624,14 @@  discard block
 block discarded – undo
624 624
    }
625 625
 
626 626
 
627
-	static function Sms($sender_id,$member_contact,$sms_text,$sms_status)
627
+	static function Sms($sender_id, $member_contact, $sms_text, $sms_status)
628 628
 	{
629 629
 		$sms = Utilities::getSetting('sms');
630 630
 		$gatewayStatus = Utilities::smsGatewayStatus();
631 631
 
632 632
 		if ($sms && $sms_status) 
633 633
 		{
634
-			if($gatewayStatus)
634
+			if ($gatewayStatus)
635 635
 			{
636 636
 				$api_key = Utilities::getSetting('sms_api_key');
637 637
 				$contacts = $member_contact;
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 				//Submit to server
645 645
 				$response = file_get_contents($api_url);
646 646
 
647
-				if (str_contains($response,'SMS-SHOOT-ID')) 
647
+				if (str_contains($response, 'SMS-SHOOT-ID')) 
648 648
 				{
649 649
 					//Log entry for SMS_log table
650 650
 					$SmsLogData = array('shoot_id' => substr($response, strpos($response, "SMS-SHOOT-ID/") + 13),
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 										'send_time' => Carbon::now(),
655 655
 										'status' => 'NA');
656 656
 
657
-					$SmsLog  = new Sms_log($SmsLogData);
657
+					$SmsLog = new Sms_log($SmsLogData);
658 658
 					$SmsLog->save();
659 659
 				}
660 660
 				//Update SMS balance
@@ -669,18 +669,18 @@  discard block
 block discarded – undo
669 669
 									'send_time' => Carbon::now(),
670 670
 									'status' => 'offline');
671 671
 
672
-				$SmsLog  = new Sms_log($SmsLogData);
672
+				$SmsLog = new Sms_log($SmsLogData);
673 673
 				$SmsLog->save();
674 674
 			}
675 675
 			
676 676
 		}
677 677
 	}
678 678
 
679
-	static function retrySms($sender_id,$member_contact,$sms_text,$log)
679
+	static function retrySms($sender_id, $member_contact, $sms_text, $log)
680 680
 	{
681 681
 		$gatewayStatus = Utilities::smsGatewayStatus();
682 682
 
683
-		if($gatewayStatus)
683
+		if ($gatewayStatus)
684 684
 		{
685 685
 			$api_key = Utilities::getSetting('sms_api_key');
686 686
 			$contacts = $member_contact;
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			//Submit to server
694 694
 			$response = file_get_contents($api_url);
695 695
 
696
-			if (str_contains($response,'SMS-SHOOT-ID')) 
696
+			if (str_contains($response, 'SMS-SHOOT-ID')) 
697 697
 			{
698 698
 				//Log entry for SMS_log table
699 699
 				$log->update(['shoot_id' => substr($response, strpos($response, "SMS-SHOOT-ID/") + 13),
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 		$sms = Utilities::getSetting('sms');
715 715
 		$gatewayStatus = Utilities::smsGatewayStatus();
716 716
 
717
-		if($sms && $gatewayStatus)
717
+		if ($sms && $gatewayStatus)
718 718
 		{
719 719
 			$api_key = Utilities::getSetting('sms_api_key');
720 720
 
@@ -724,12 +724,12 @@  discard block
 block discarded – undo
724 724
 
725 725
 			$credit_balance = file_get_contents($api_url);
726 726
 			$balance = json_decode($credit_balance);
727
-			Setting::where('key', '=','sms_balance')->update(['value' => $balance[0]->BALANCE]);
727
+			Setting::where('key', '=', 'sms_balance')->update(['value' => $balance[0]->BALANCE]);
728 728
 
729 729
 			// If balance turns zero turn off SMS
730
-			if($balance[0]->BALANCE == 0)
730
+			if ($balance[0]->BALANCE == 0)
731 731
 			{
732
-				Setting::where('key', '=','sms')->update(['value' => 0]);
732
+				Setting::where('key', '=', 'sms')->update(['value' => 0]);
733 733
 			}
734 734
 		}
735 735
 	}
@@ -739,23 +739,23 @@  discard block
 block discarded – undo
739 739
 		$sms = Utilities::getSetting('sms');
740 740
 		$gatewayStatus = Utilities::smsGatewayStatus();
741 741
 
742
-		if($sms && $gatewayStatus)
742
+		if ($sms && $gatewayStatus)
743 743
 		{
744 744
 			$api_key = Utilities::getSetting('sms_api_key');
745 745
 			
746 746
 			// Retry Offline Msg
747
-			$messages = Sms_log::where('status','offline')->get();
747
+			$messages = Sms_log::where('status', 'offline')->get();
748 748
 		
749
-			foreach($messages as $message)
749
+			foreach ($messages as $message)
750 750
 			{
751
-				Utilities::retrySms($message->sender_id,$message->number,$message->message,$message);
751
+				Utilities::retrySms($message->sender_id, $message->number, $message->message, $message);
752 752
 			}
753 753
 			
754 754
 			
755 755
 			// Update Status
756
-			$messages = Sms_log::whereNotIn('status', ['Delivered','Failed','offline'])->get();
756
+			$messages = Sms_log::whereNotIn('status', ['Delivered', 'Failed', 'offline'])->get();
757 757
 
758
-			foreach($messages as $message)
758
+			foreach ($messages as $message)
759 759
 				{
760 760
 					$sms_shoot_id = $message->shoot_id;				
761 761
 					$api_url = "http://logonutility.in/app/miscapi/".$api_key."/getDLR/".$sms_shoot_id;
Please login to merge, or discard this patch.
Braces   +9 added lines, -13 removed lines patch added patch discarded remove patch
@@ -322,16 +322,13 @@  discard block
 block discarded – undo
322 322
 	if($amount_due == 0)
323 323
     {
324 324
          $paymentStatus = \constPaymentStatus::Paid;
325
-    } 
326
-    elseif($amount_due > 0 && $amount_due < $invoice_total) 
325
+    } elseif($amount_due > 0 && $amount_due < $invoice_total) 
327 326
     {
328 327
         $paymentStatus = \constPaymentStatus::Partial;
329
-    }
330
-    elseif($amount_due == $invoice_total) 
328
+    } elseif($amount_due == $invoice_total) 
331 329
     {
332 330
         $paymentStatus = \constPaymentStatus::Unpaid;
333
-    }
334
-    else
331
+    } else
335 332
     {
336 333
         $paymentStatus = \constPaymentStatus::Overpaid;
337 334
     }    
@@ -583,14 +580,12 @@  discard block
 block discarded – undo
583 580
 			if(Utilities::isDomainAvailible($api_url))
584 581
 	        {
585 582
 	               return true;
586
-	        }
587
-	        else
583
+	        } else
588 584
 	        {
589 585
 	               return false;
590 586
 	        }			
591 587
 						
592
-		}
593
-		catch(Exception $e)
588
+		} catch(Exception $e)
594 589
 		{
595 590
 			return false;
596 591
 		}
@@ -618,7 +613,9 @@  discard block
 block discarded – undo
618 613
 
619 614
        curl_close($curlInit);
620 615
 
621
-       if ($response) return true;
616
+       if ($response) {
617
+           return true;
618
+       }
622 619
 
623 620
        return false;
624 621
    }
@@ -659,8 +656,7 @@  discard block
 block discarded – undo
659 656
 				}
660 657
 				//Update SMS balance
661 658
 				Utilities::smsBalance();
662
-			}
663
-			else
659
+			} else
664 660
 			{
665 661
 				$SmsLogData = array('shoot_id' => '',
666 662
 									'number' => $member_contact,
Please login to merge, or discard this patch.
app/Lubus/ImageFilters/Invoice.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
     public function applyFilter(Image $image)
10 10
     {
11 11
         return $image->resize(150, null, function ($constraint) {
12
-		    $constraint->aspectRatio();
13
-		})->encode('jpg', 100);   
14
-	}
12
+            $constraint->aspectRatio();
13
+        })->encode('jpg', 100);   
14
+    }
15 15
 }
16 16
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 {
9 9
     public function applyFilter(Image $image)
10 10
     {
11
-        return $image->resize(150, null, function ($constraint) {
11
+        return $image->resize(150, null, function($constraint) {
12 12
 		    $constraint->aspectRatio();
13 13
 		})->encode('jpg', 100);   
14 14
 	}
Please login to merge, or discard this patch.
app/Lubus/constants.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
 
17 17
 //Follow Up Status
18 18
 class constFollowUpStatus {
19
-	const Pending = 0;
20
-	const Done = 1;
19
+    const Pending = 0;
20
+    const Done = 1;
21 21
 }
22 22
 
23 23
 //Follow Up By
24 24
 class constFollowUpBy {
25
-	const Call = 0;
26
-	const SMS = 1;
27
-	const Personal = 2;
25
+    const Call = 0;
26
+    const SMS = 1;
27
+    const Personal = 2;
28 28
 }
29 29
 
30 30
 // File PATHS
@@ -36,53 +36,53 @@  discard block
 block discarded – undo
36 36
 }
37 37
 
38 38
 class constFilePrefix {
39
-	const UserProfilePhoto = 'profile_';
40
-	const UserProofPhoto = 'proof_';
41
-	const StaffPhoto = 'staff_';
39
+    const UserProfilePhoto = 'profile_';
40
+    const UserProofPhoto = 'proof_';
41
+    const StaffPhoto = 'staff_';
42 42
 }
43 43
 
44 44
 // Payment status
45 45
 class constPaymentStatus {
46
-	const Unpaid = 0;
47
-	const Paid = 1;
48
-	const Partial = 2;
49
-	const Overpaid = 3;
46
+    const Unpaid = 0;
47
+    const Paid = 1;
48
+    const Partial = 2;
49
+    const Overpaid = 3;
50 50
 }
51 51
 
52 52
 // Cheque status
53 53
 class constChequeStatus {
54
-	const Recieved = 0;
55
-	const Deposited = 1;
56
-	const Cleared = 2;
57
-	const Bounced = 3;
58
-	const Reissued = 4;
54
+    const Recieved = 0;
55
+    const Deposited = 1;
56
+    const Cleared = 2;
57
+    const Bounced = 3;
58
+    const Reissued = 4;
59 59
 }
60 60
 
61 61
 // Invoice Items
62 62
 class constInvoiceItem {
63
-	const admission = "Admission";
64
-	const gymSubscription = "Gym Subscription";
65
-	const taxes = "Taxes";
63
+    const admission = "Admission";
64
+    const gymSubscription = "Gym Subscription";
65
+    const taxes = "Taxes";
66 66
 }
67 67
 
68 68
 //subscription
69 69
 class constSubscription {
70
-	const Expired = 0;
71
-	const onGoing = 1;
72
-	const renewed = 2;
73
-	const cancelled = 3;  
70
+    const Expired = 0;
71
+    const onGoing = 1;
72
+    const renewed = 2;
73
+    const cancelled = 3;  
74 74
 }
75 75
 
76 76
 //numbering mode
77 77
 class constNumberingMode {
78
-	const Manual = 0;
79
-	const Auto = 1;
78
+    const Manual = 0;
79
+    const Auto = 1;
80 80
 }
81 81
 
82 82
 //Payment mode
83 83
 class constPaymentMode {
84
-	const Cheque = 0;
85
-	const Cash = 1;
84
+    const Cheque = 0;
85
+    const Cash = 1;
86 86
 }
87 87
 
88 88
 ?>
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
app/Service.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
     protected $table = 'mst_services';
12 12
 
13 13
     protected $fillable = [
14
-    		'name',
15
-    		'description',
16
-    		'created_by',
17
-    		'updated_by'
14
+            'name',
15
+            'description',
16
+            'created_by',
17
+            'updated_by'
18 18
     ];
19 19
 
20 20
     //Eloquence Search mapping
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@
 block discarded – undo
27 27
 
28 28
     public function createdBy()
29 29
     {
30
-        return $this->belongsTo('App\User','created_by');
30
+        return $this->belongsTo('App\User', 'created_by');
31 31
     }
32 32
 
33 33
     public function updatedBy()
34 34
     {
35
-        return $this->belongsTo('App\User','updated_by');
35
+        return $this->belongsTo('App\User', 'updated_by');
36 36
     }
37 37
 
38 38
     public function Plans()
39 39
     {
40
-        return $this->hasMany('App\Plan','service_id');
40
+        return $this->hasMany('App\Plan', 'service_id');
41 41
     }
42 42
 }
Please login to merge, or discard this patch.
app/Sms_trigger.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
 
28 28
     public function createdBy()
29 29
     {
30
-        return $this->belongsTo('App\User','created_by');
30
+        return $this->belongsTo('App\User', 'created_by');
31 31
     }
32 32
 
33 33
     public function updatedBy()
34 34
     {
35
-        return $this->belongsTo('App\User','updated_by');
35
+        return $this->belongsTo('App\User', 'updated_by');
36 36
     }
37 37
 }
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@
 block discarded – undo
11 11
 
12 12
     protected $fillable = [
13 13
             'name',
14
-    		'alias',
14
+            'alias',
15 15
             'message',
16
-    		'status',
17
-    		'updated_by'
16
+            'status',
17
+            'updated_by'
18 18
     ];
19 19
 
20 20
     const CREATED_AT = null;
Please login to merge, or discard this patch.
app/Sms_log.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,6 +33,6 @@
 block discarded – undo
33 33
 
34 34
     public function scopeDashboardLogs($query)
35 35
     {
36
-    	return $query->where('send_time','<=',Carbon::now())->take(5)->orderBy('send_time','desc');
36
+        return $query->where('send_time','<=',Carbon::now())->take(5)->orderBy('send_time','desc');
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     public $timestamps = false;
22 22
     
23
-    protected $dates  = ['send_time'];
23
+    protected $dates = ['send_time'];
24 24
 
25 25
     //Eloquence Search mapping
26 26
     use Eloquence;
@@ -33,6 +33,6 @@  discard block
 block discarded – undo
33 33
 
34 34
     public function scopeDashboardLogs($query)
35 35
     {
36
-    	return $query->where('send_time','<=',Carbon::now())->take(5)->orderBy('send_time','desc');
36
+    	return $query->where('send_time', '<=', Carbon::now())->take(5)->orderBy('send_time', 'desc');
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
app/Permission.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 class Permission extends EntrustPermission
8 8
 {
9 9
 
10
-	protected $table = 'permissions';
10
+    protected $table = 'permissions';
11 11
 
12 12
     protected $fillable = [
13
-    		'name',
14
-    		'display_name',
13
+            'name',
14
+            'display_name',
15 15
             'description',
16
-    		'group_key',
16
+            'group_key',
17 17
     ];
18 18
 
19 19
     public function Roles()
Please login to merge, or discard this patch.
app/Luser.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@
 block discarded – undo
9 9
     protected $table = 'mst_staff';
10 10
 
11 11
     protected $fillable = [
12
-    		'username',
13
-    		'password',
14
-    		'name',
15
-    		'created_by',
16
-    		'updated_by'
12
+            'username',
13
+            'password',
14
+            'name',
15
+            'created_by',
16
+            'updated_by'
17 17
     ];
18 18
 }
Please login to merge, or discard this patch.
app/Followup.php 2 patches
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -8,35 +8,35 @@
 block discarded – undo
8 8
 
9 9
 class Followup extends Model
10 10
 {
11
-	protected $table = 'trn_enquiry_followups';
12
-
13
-	protected $fillable = [
14
-		'enquiry_id',
15
-		'followup_by',
16
-		'due_date',
17
-		'status',
18
-		'outcome',
19
-		'created_by',
20
-    	'updated_by',
21
-	];
22
-
23
-	protected $dates  = ['created_at', 'updated_at', 'due_date'];
24
-
25
-	public function Enquiry()
26
-	{
27
-		return $this->belongsTo('App\Enquiry','enquiry_id');
28
-	}
29
-
30
-	public function scopeReminders($query)
31
-	{
32
-		return $query->leftJoin('mst_enquiries','trn_enquiry_followups.enquiry_id','=','mst_enquiries.id')
33
-					 ->select('trn_enquiry_followups.*','mst_enquiries.status')
34
-					 ->where('trn_enquiry_followups.due_date','<=',Carbon::today())
35
-					 ->where('trn_enquiry_followups.status','=',\constFollowUpStatus::Pending)
36
-					 ->where('mst_enquiries.status','=',\constEnquiryStatus::Lead);
37
-	}
38
-
39
-	public function createdBy()
11
+    protected $table = 'trn_enquiry_followups';
12
+
13
+    protected $fillable = [
14
+        'enquiry_id',
15
+        'followup_by',
16
+        'due_date',
17
+        'status',
18
+        'outcome',
19
+        'created_by',
20
+        'updated_by',
21
+    ];
22
+
23
+    protected $dates  = ['created_at', 'updated_at', 'due_date'];
24
+
25
+    public function Enquiry()
26
+    {
27
+        return $this->belongsTo('App\Enquiry','enquiry_id');
28
+    }
29
+
30
+    public function scopeReminders($query)
31
+    {
32
+        return $query->leftJoin('mst_enquiries','trn_enquiry_followups.enquiry_id','=','mst_enquiries.id')
33
+                        ->select('trn_enquiry_followups.*','mst_enquiries.status')
34
+                        ->where('trn_enquiry_followups.due_date','<=',Carbon::today())
35
+                        ->where('trn_enquiry_followups.status','=',\constFollowUpStatus::Pending)
36
+                        ->where('mst_enquiries.status','=',\constEnquiryStatus::Lead);
37
+    }
38
+
39
+    public function createdBy()
40 40
     {
41 41
         return $this->belongsTo('App\User','created_by');
42 42
     }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,29 +20,29 @@
 block discarded – undo
20 20
     	'updated_by',
21 21
 	];
22 22
 
23
-	protected $dates  = ['created_at', 'updated_at', 'due_date'];
23
+	protected $dates = ['created_at', 'updated_at', 'due_date'];
24 24
 
25 25
 	public function Enquiry()
26 26
 	{
27
-		return $this->belongsTo('App\Enquiry','enquiry_id');
27
+		return $this->belongsTo('App\Enquiry', 'enquiry_id');
28 28
 	}
29 29
 
30 30
 	public function scopeReminders($query)
31 31
 	{
32
-		return $query->leftJoin('mst_enquiries','trn_enquiry_followups.enquiry_id','=','mst_enquiries.id')
33
-					 ->select('trn_enquiry_followups.*','mst_enquiries.status')
34
-					 ->where('trn_enquiry_followups.due_date','<=',Carbon::today())
35
-					 ->where('trn_enquiry_followups.status','=',\constFollowUpStatus::Pending)
36
-					 ->where('mst_enquiries.status','=',\constEnquiryStatus::Lead);
32
+		return $query->leftJoin('mst_enquiries', 'trn_enquiry_followups.enquiry_id', '=', 'mst_enquiries.id')
33
+					 ->select('trn_enquiry_followups.*', 'mst_enquiries.status')
34
+					 ->where('trn_enquiry_followups.due_date', '<=', Carbon::today())
35
+					 ->where('trn_enquiry_followups.status', '=', \constFollowUpStatus::Pending)
36
+					 ->where('mst_enquiries.status', '=', \constEnquiryStatus::Lead);
37 37
 	}
38 38
 
39 39
 	public function createdBy()
40 40
     {
41
-        return $this->belongsTo('App\User','created_by');
41
+        return $this->belongsTo('App\User', 'created_by');
42 42
     }
43 43
 
44 44
     public function updatedBy()
45 45
     {
46
-        return $this->belongsTo('App\User','updated_by');
46
+        return $this->belongsTo('App\User', 'updated_by');
47 47
     }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.