1 | <?php |
||||
2 | |||||
3 | namespace App\Http\Controllers; |
||||
4 | |||||
5 | use Illuminate\Http\Request; |
||||
6 | use Auth; |
||||
7 | use DB; |
||||
8 | use JavaScript; |
||||
0 ignored issues
–
show
|
|||||
9 | use Carbon\Carbon; |
||||
10 | use App\Subscription; |
||||
11 | use App\Plan; |
||||
12 | use App\Setting; |
||||
13 | use App\Member; |
||||
14 | use App\Invoice; |
||||
15 | use App\Service; |
||||
16 | use App\Invoice_detail; |
||||
17 | use App\Payment_detail; |
||||
18 | use App\Cheque_detail; |
||||
19 | use App\Sms_trigger; |
||||
20 | use App\Http\Requests; |
||||
21 | use App\Http\Controllers\Controller; |
||||
22 | |||||
23 | class SubscriptionsController extends Controller |
||||
24 | { |
||||
25 | public function __construct() |
||||
26 | { |
||||
27 | $this->middleware('auth'); |
||||
28 | } |
||||
29 | |||||
30 | public function index(Request $request) |
||||
31 | { |
||||
32 | |||||
33 | $subscriptions = Subscription::indexQuery($request->sort_field,$request->sort_direction,$request->drp_start,$request->drp_end,$request->plan_name)->search('"'.$request->input('search').'"')->paginate(10); |
||||
34 | $subscriptionTotal = Subscription::indexQuery($request->sort_field,$request->sort_direction,$request->drp_start,$request->drp_end,$request->plan_name)->search('"'.$request->input('search').'"')->get(); |
||||
35 | $count = $subscriptionTotal->count(); |
||||
36 | |||||
37 | |||||
38 | if (!$request->has('drp_start') or !$request->has('drp_end')) |
||||
39 | { |
||||
40 | $drp_placeholder = "Select daterange filter"; |
||||
41 | } |
||||
42 | else |
||||
43 | { |
||||
44 | $drp_placeholder = $request->drp_start. ' - ' .$request->drp_end; |
||||
45 | } |
||||
46 | |||||
47 | $request->flash(); |
||||
48 | |||||
49 | return view('subscriptions.index', compact('subscriptions','count','drp_placeholder')); |
||||
50 | |||||
51 | } |
||||
52 | |||||
53 | public function expiring(Request $request) |
||||
54 | { |
||||
55 | $expirings = Subscription::expiring($request->sort_field,$request->sort_direction,$request->drp_start,$request->drp_end)->search('"'.$request->input('search').'"')->paginate(10); |
||||
56 | $expiringTotal = Subscription::expiring($request->sort_field,$request->sort_direction,$request->drp_start,$request->drp_end)->search('"'.$request->input('search').'"')->get(); |
||||
57 | $count = $expiringTotal->count(); |
||||
58 | |||||
59 | if (!$request->has('drp_start') or !$request->has('drp_end')) |
||||
60 | { |
||||
61 | $drp_placeholder = "Select daterange filter"; |
||||
62 | } |
||||
63 | else |
||||
64 | { |
||||
65 | $drp_placeholder = $request->drp_start. ' - ' .$request->drp_end; |
||||
66 | } |
||||
67 | |||||
68 | $request->flash(); |
||||
69 | |||||
70 | return view('subscriptions.expiring',compact('expirings','count','drp_placeholder')); |
||||
71 | } |
||||
72 | |||||
73 | public function expired(Request $request) |
||||
74 | { |
||||
75 | $allExpired = Subscription::expired($request->sort_field,$request->sort_direction,$request->drp_start,$request->drp_end)->search('"'.$request->input('search').'"')->paginate(10); |
||||
76 | $allExpiredTotal = Subscription::expired($request->sort_field,$request->sort_direction,$request->drp_start,$request->drp_end)->search('"'.$request->input('search').'"')->get(); |
||||
77 | $count = $allExpiredTotal->count(); |
||||
78 | |||||
79 | if (!$request->has('drp_start') or !$request->has('drp_end')) |
||||
80 | { |
||||
81 | $drp_placeholder = "Select daterange filter"; |
||||
82 | } |
||||
83 | else |
||||
84 | { |
||||
85 | $drp_placeholder = $request->drp_start. ' - ' .$request->drp_end; |
||||
86 | } |
||||
87 | |||||
88 | $request->flash(); |
||||
89 | |||||
90 | return view('subscriptions.expired',compact('allExpired','count','drp_placeholder')); |
||||
91 | } |
||||
92 | |||||
93 | public function create() |
||||
94 | { |
||||
95 | // For Tax calculation |
||||
96 | JavaScript::put([ |
||||
97 | 'taxes' => \Utilities::getSetting('taxes'), |
||||
98 | 'gymieToday' => Carbon::today()->format('Y-m-d'), |
||||
99 | 'servicesCount' => Service::count(), |
||||
100 | ]); |
||||
101 | |||||
102 | //Get Numbering mode |
||||
103 | $invoice_number_mode = \Utilities::getSetting('invoice_number_mode'); |
||||
104 | |||||
105 | //Generating Invoice number |
||||
106 | if ($invoice_number_mode == \constNumberingMode::Auto ) { |
||||
107 | $invoiceCounter = \Utilities::getSetting('invoice_last_number') + 1; |
||||
108 | $invoicePrefix = \Utilities::getSetting('invoice_prefix'); |
||||
109 | $invoice_number = $invoicePrefix.$invoiceCounter; |
||||
110 | } |
||||
111 | |||||
112 | else { |
||||
113 | $invoice_number = ''; |
||||
114 | $invoiceCounter = ''; |
||||
115 | } |
||||
116 | |||||
117 | return view('subscriptions.create',compact('invoice_number','invoiceCounter','invoice_number_mode')); |
||||
118 | } |
||||
119 | |||||
120 | public function store(Request $request) |
||||
121 | { |
||||
122 | |||||
123 | DB::beginTransaction(); |
||||
124 | |||||
125 | try { |
||||
126 | //Helper function to set Payment status |
||||
127 | $invoice_total = $request->admission_amount + $request->subscription_amount + $request->taxes_amount - $request->discount_amount; |
||||
128 | $paymentStatus = \constPaymentStatus::Unpaid; |
||||
129 | $pending = $invoice_total - $request->payment_amount; |
||||
130 | |||||
131 | if($request->mode == 1) |
||||
132 | { |
||||
133 | if ($request->payment_amount == $invoice_total) |
||||
134 | { |
||||
135 | $paymentStatus = \constPaymentStatus::Paid; |
||||
136 | } |
||||
137 | elseif($request->payment_amount > 0 && $request->payment_amount < $invoice_total) |
||||
138 | { |
||||
139 | $paymentStatus = \constPaymentStatus::Partial; |
||||
140 | } |
||||
141 | elseif($request->payment_amount == 0) |
||||
142 | { |
||||
143 | $paymentStatus = \constPaymentStatus::Unpaid; |
||||
144 | } |
||||
145 | else |
||||
146 | { |
||||
147 | $paymentStatus = \constPaymentStatus::Overpaid; |
||||
148 | } |
||||
149 | } |
||||
150 | |||||
151 | // Storing Invoice |
||||
152 | $invoiceData = array('invoice_number'=> $request->invoice_number, |
||||
153 | 'member_id'=> $request->member_id, |
||||
154 | 'total'=> $invoice_total, |
||||
155 | 'status'=> $paymentStatus, |
||||
156 | 'pending_amount'=> $pending, |
||||
157 | 'discount_amount'=> $request->discount_amount, |
||||
158 | 'discount_percent'=> $request->discount_percent, |
||||
159 | 'discount_note'=> $request->discount_note, |
||||
160 | 'tax'=> $request->taxes_amount, |
||||
161 | 'additional_fees'=> $request->additional_fees, |
||||
162 | 'note'=>' '); |
||||
163 | |||||
164 | $invoice = new Invoice($invoiceData); |
||||
165 | $invoice->createdBy()->associate(Auth::user()); |
||||
166 | $invoice->updatedBy()->associate(Auth::user()); |
||||
167 | $invoice->save(); |
||||
168 | |||||
169 | // Storing subscription |
||||
170 | foreach($request->plan as $plan) |
||||
171 | { |
||||
172 | $subscriptionData = array('member_id'=> $request->member_id, |
||||
173 | 'invoice_id'=> $invoice->id, |
||||
174 | 'plan_id'=> $plan['id'], |
||||
175 | 'start_date'=> $plan['start_date'], |
||||
176 | 'end_date'=> $plan['end_date'], |
||||
177 | 'status'=> \constSubscription::onGoing, |
||||
178 | 'is_renewal'=>'0'); |
||||
179 | |||||
180 | $subscription = new Subscription($subscriptionData); |
||||
181 | $subscription->createdBy()->associate(Auth::user()); |
||||
182 | $subscription->updatedBy()->associate(Auth::user()); |
||||
183 | $subscription->save(); |
||||
184 | |||||
185 | //Adding subscription to invoice(Invoice Details) |
||||
186 | $detailsData = array('invoice_id'=> $invoice->id, |
||||
187 | 'plan_id'=> $plan['id'], |
||||
188 | 'item_amount'=> $plan['price']); |
||||
189 | |||||
190 | $invoice_details = new Invoice_detail($detailsData); |
||||
191 | $invoice_details->createdBy()->associate(Auth::user()); |
||||
192 | $invoice_details->updatedBy()->associate(Auth::user()); |
||||
193 | $invoice_details->save(); |
||||
194 | } |
||||
195 | |||||
196 | //Payment Details |
||||
197 | $paymentData = array('invoice_id'=> $invoice->id, |
||||
198 | 'payment_amount'=> $request->payment_amount, |
||||
199 | 'mode'=> $request->mode, |
||||
200 | 'note'=> ' '); |
||||
201 | |||||
202 | $payment_details = new Payment_detail($paymentData); |
||||
203 | $payment_details->createdBy()->associate(Auth::user()); |
||||
204 | $payment_details->updatedBy()->associate(Auth::user()); |
||||
205 | $payment_details->save(); |
||||
206 | |||||
207 | if($request->mode == 0) |
||||
208 | { |
||||
209 | // Store Cheque Details |
||||
210 | $chequeData = array('payment_id'=> $payment_details->id, |
||||
211 | 'number'=> $request->number, |
||||
212 | 'date'=> $request->date, |
||||
213 | 'status'=> \constChequeStatus::Recieved); |
||||
214 | |||||
215 | $cheque_details = new Cheque_detail($chequeData); |
||||
216 | $cheque_details->createdBy()->associate(Auth::user()); |
||||
217 | $cheque_details->updatedBy()->associate(Auth::user()); |
||||
218 | $cheque_details->save(); |
||||
219 | } |
||||
220 | |||||
221 | // Set the subscription status of the 'Renewed' subscription to Renew |
||||
222 | if ($request->has('previousSubscriptions')) |
||||
223 | { |
||||
224 | Subscription::where('invoice_id',$invoice->id)->update(['is_renewal' => '1']); |
||||
225 | |||||
226 | foreach($request->previousSubscriptions as $subscriptionId) |
||||
227 | { |
||||
228 | $oldSubscription=Subscription::findOrFail($subscriptionId); |
||||
229 | $oldSubscription->status = \constSubscription::renewed; |
||||
230 | $oldSubscription->updatedBy()->associate(Auth::user()); |
||||
231 | $oldSubscription->save(); |
||||
232 | } |
||||
233 | } |
||||
234 | |||||
235 | //Updating Numbering Counters |
||||
236 | Setting::where('key', '=','invoice_last_number')->update(['value' => $request->invoiceCounter]); |
||||
237 | $sender_id = \Utilities::getSetting('sms_sender_id'); |
||||
238 | $gym_name = \Utilities::getSetting('gym_name'); |
||||
239 | |||||
240 | //SMS Trigger |
||||
241 | if ($invoice->status == \constPaymentStatus::Paid) |
||||
242 | { |
||||
243 | if($request->mode == 0) |
||||
244 | { |
||||
245 | $sms_trigger = Sms_trigger::where('alias','=','payment_with_cheque')->first(); |
||||
246 | $message = $sms_trigger->message; |
||||
247 | $sms_text = sprintf($message,$subscription->member->name,$payment_details->payment_amount,$cheque_details->number,$invoice->invoice_number,$gym_name); |
||||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Comprehensibility
Best Practice
introduced
by
|
|||||
248 | $sms_status = $sms_trigger->status; |
||||
249 | |||||
250 | \Utilities::Sms($sender_id,$subscription->member->contact,$sms_text,$sms_status); |
||||
251 | } |
||||
252 | else |
||||
253 | { |
||||
254 | $sms_trigger = Sms_trigger::where('alias','=','subscription_renewal_with_paid_invoice')->first(); |
||||
255 | $message = $sms_trigger->message; |
||||
256 | $sms_text = sprintf($message,$subscription->member->name,$payment_details->payment_amount,$invoice->invoice_number); |
||||
257 | $sms_status = $sms_trigger->status; |
||||
258 | |||||
259 | \Utilities::Sms($sender_id,$subscription->member->contact,$sms_text,$sms_status); |
||||
260 | } |
||||
261 | |||||
262 | } |
||||
263 | elseif($invoice->status == \constPaymentStatus::Partial) |
||||
264 | { |
||||
265 | if($request->mode == 0) |
||||
266 | { |
||||
267 | $sms_trigger = Sms_trigger::where('alias','=','payment_with_cheque')->first(); |
||||
268 | $message = $sms_trigger->message; |
||||
269 | $sms_text = sprintf($message,$subscription->member->name,$payment_details->payment_amount,$cheque_details->number,$invoice->invoice_number,$gym_name); |
||||
270 | $sms_status = $sms_trigger->status; |
||||
271 | |||||
272 | \Utilities::Sms($sender_id,$subscription->member->contact,$sms_text,$sms_status); |
||||
273 | } |
||||
274 | else |
||||
275 | { |
||||
276 | $sms_trigger = Sms_trigger::where('alias','=','subscription_renewal_with_partial_invoice')->first(); |
||||
277 | $message = $sms_trigger->message; |
||||
278 | $sms_text = sprintf($message,$subscription->member->name,$payment_details->payment_amount,$invoice->invoice_number,$invoice->pending_amount); |
||||
279 | $sms_status = $sms_trigger->status; |
||||
280 | |||||
281 | \Utilities::Sms($sender_id,$subscription->member->contact,$sms_text,$sms_status); |
||||
282 | } |
||||
283 | |||||
284 | } |
||||
285 | elseif($invoice->status == \constPaymentStatus::Unpaid) |
||||
286 | { |
||||
287 | if($request->mode == 0) |
||||
288 | { |
||||
289 | $sms_trigger = Sms_trigger::where('alias','=','payment_with_cheque')->first(); |
||||
290 | $message = $sms_trigger->message; |
||||
291 | $sms_text = sprintf($message,$subscription->member->name,$payment_details->payment_amount,$cheque_details->number,$invoice->invoice_number,$gym_name); |
||||
292 | $sms_status = $sms_trigger->status; |
||||
293 | |||||
294 | \Utilities::Sms($sender_id,$subscription->member->contact,$sms_text,$sms_status); |
||||
295 | } |
||||
296 | else |
||||
297 | { |
||||
298 | $sms_trigger = Sms_trigger::where('alias','=','subscription_renewal_with_unpaid_invoice')->first(); |
||||
299 | $message = $sms_trigger->message; |
||||
300 | $sms_text = sprintf($message,$subscription->member->name,$invoice->total,$invoice->invoice_number); |
||||
301 | $sms_status = $sms_trigger->status; |
||||
302 | |||||
303 | \Utilities::Sms($sender_id,$subscription->member->contact,$sms_text,$sms_status); |
||||
304 | } |
||||
305 | |||||
306 | } |
||||
307 | |||||
308 | DB::commit(); |
||||
309 | flash()->success('Subscription was successfully created'); |
||||
310 | return redirect (action('SubscriptionsController@index')); |
||||
311 | } |
||||
312 | |||||
313 | catch (\Exception $e) |
||||
314 | { |
||||
315 | DB::rollback(); |
||||
316 | flash()->error('Error while creating the Subscription'); |
||||
317 | return redirect (action('SubscriptionsController@index')); |
||||
318 | } |
||||
319 | |||||
320 | } //End of store method |
||||
321 | |||||
322 | |||||
323 | public function edit($id) |
||||
324 | { |
||||
325 | $subscription = Subscription::findOrFail($id); |
||||
326 | // $carbonToday = Carbon::today()->format('Y-m-d'); |
||||
327 | // $subscriptionEndDate = $subscription->end_date->format('Y-m-d'); |
||||
328 | $diff = Carbon::today()->diffInDays($subscription->end_date); |
||||
329 | //$gymieDiff = $diff->format('Y-m-d'); |
||||
330 | $gymieDiff = $subscription->end_date->addDays($diff); |
||||
331 | |||||
332 | JavaScript::put([ |
||||
333 | 'gymieToday' => Carbon::today()->format('Y-m-d'), |
||||
334 | 'gymieEndDate' => $subscription->end_date->format('Y-m-d'), |
||||
335 | 'gymieDiff' => $gymieDiff->format('Y-m-d'), |
||||
336 | ]); |
||||
337 | |||||
338 | return view('subscriptions.edit', compact('subscription')); |
||||
339 | } |
||||
340 | |||||
341 | public function update($id, Request $request) |
||||
342 | { |
||||
343 | $subscription=Subscription::findOrFail($id); |
||||
344 | |||||
345 | $subscription->update($request->all()); |
||||
346 | $subscription->updatedBy()->associate(Auth::user()); |
||||
347 | $subscription->save(); |
||||
348 | flash()->success('Subscription details were successfully updated'); |
||||
349 | return redirect('subscriptions/all'); |
||||
350 | } |
||||
351 | |||||
352 | public function renew($id, Request $request) |
||||
0 ignored issues
–
show
The parameter
$request is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
353 | { |
||||
354 | |||||
355 | |||||
356 | //Get Numbering mode |
||||
357 | $invoice_number_mode = \Utilities::getSetting('invoice_number_mode'); |
||||
358 | |||||
359 | //Generating Invoice number |
||||
360 | if ($invoice_number_mode == \constNumberingMode::Auto) { |
||||
361 | $invoiceCounter = \Utilities::getSetting('invoice_last_number') + 1; |
||||
362 | $invoicePrefix = \Utilities::getSetting('invoice_prefix'); |
||||
363 | $invoice_number = $invoicePrefix.$invoiceCounter; |
||||
364 | } |
||||
365 | |||||
366 | else { |
||||
367 | $invoice_number = ''; |
||||
368 | $invoiceCounter = ''; |
||||
369 | } |
||||
370 | |||||
371 | $subscriptions = Subscription::where('invoice_id',$id)->get(); |
||||
372 | $member_id = $subscriptions->pluck('member_id')->first(); |
||||
373 | |||||
374 | // Javascript Variables |
||||
375 | JavaScript::put([ |
||||
376 | 'taxes' => \Utilities::getSetting('taxes'), |
||||
377 | 'gymieToday' => Carbon::today()->format('Y-m-d'), |
||||
378 | 'servicesCount' => Service::count(), |
||||
379 | 'currentServices' => $subscriptions->count(), |
||||
380 | ]); |
||||
381 | |||||
382 | return view('subscriptions.renew',compact('subscriptions','member_id','invoice_number','invoiceCounter','invoice_number_mode')); |
||||
383 | } |
||||
384 | |||||
385 | public function cancelSubscription($id) |
||||
386 | { |
||||
387 | DB::beginTransaction(); |
||||
388 | try |
||||
389 | { |
||||
390 | $subscription = Subscription::findOrFail($id); |
||||
391 | |||||
392 | $subscription->update(['status' => \constSubscription::cancelled]); |
||||
393 | |||||
394 | $subscription->member->update(['status' => \constStatus::InActive]); |
||||
395 | |||||
396 | DB::commit(); |
||||
397 | flash()->success('Subscription was successfully cancelled'); |
||||
398 | return redirect('subscriptions/expired'); |
||||
399 | } |
||||
400 | catch (Exception $e) |
||||
0 ignored issues
–
show
|
|||||
401 | { |
||||
402 | DB::rollback(); |
||||
403 | flash()->error('Error while cancelling the Subscription'); |
||||
404 | return redirect('subscriptions/expired'); |
||||
405 | } |
||||
406 | |||||
407 | } |
||||
408 | |||||
409 | public function delete($id) |
||||
410 | { |
||||
411 | DB::beginTransaction(); |
||||
412 | |||||
413 | try |
||||
414 | { |
||||
415 | $subscription = Subscription::findOrFail($id); |
||||
416 | $invoice = Invoice::where('id',$subscription->invoice_id)->first(); |
||||
417 | $invoice_details = Invoice_detail::where('invoice_id',$invoice->id)->get(); |
||||
418 | $payment_details = Payment_detail::where('invoice_id',$invoice->id)->get(); |
||||
419 | |||||
420 | foreach($invoice_details as $invoice_detail) |
||||
421 | { |
||||
422 | $invoice_detail->delete(); |
||||
423 | } |
||||
424 | |||||
425 | foreach($payment_details as $payment_detail) |
||||
426 | { |
||||
427 | Cheque_detail::where('payment_id',$payment_detail->id)->delete(); |
||||
428 | $payment_detail->delete(); |
||||
429 | } |
||||
430 | |||||
431 | $subscription->delete(); |
||||
432 | $invoice->delete(); |
||||
433 | |||||
434 | DB::commit(); |
||||
435 | return back(); |
||||
436 | } |
||||
437 | |||||
438 | catch(\Exception $e) |
||||
439 | { |
||||
440 | DB::rollback(); |
||||
441 | return back(); |
||||
442 | } |
||||
443 | |||||
444 | } |
||||
445 | |||||
446 | public function change($id) |
||||
447 | { |
||||
448 | $subscription = Subscription::findOrFail($id); |
||||
449 | |||||
450 | $already_paid = Payment_detail::leftJoin('trn_cheque_details','trn_payment_details.id','=','trn_cheque_details.payment_id') |
||||
451 | ->whereRaw("trn_payment_details.invoice_id = $subscription->invoice_id AND (trn_cheque_details.`status` = 2 or trn_cheque_details.`status` IS NULL)") |
||||
452 | ->sum('trn_payment_details.payment_amount'); |
||||
453 | |||||
454 | JavaScript::put([ |
||||
455 | 'taxes' => \Utilities::getSetting('taxes'), |
||||
456 | 'gymieToday' => Carbon::today()->format('Y-m-d'), |
||||
457 | 'servicesCount' => Service::count(), |
||||
458 | ]); |
||||
459 | |||||
460 | return view('subscriptions.change',compact('subscription','already_paid')); |
||||
461 | } |
||||
462 | |||||
463 | public function modify($id, Request $request) |
||||
464 | { |
||||
465 | $subscription = Subscription::findOrFail($id); |
||||
466 | |||||
467 | try |
||||
468 | { |
||||
469 | DB::beginTransaction(); |
||||
470 | //Helper function to set Payment status |
||||
471 | $invoice_total = $request->admission_amount + $request->subscription_amount + $request->taxes_amount - $request->discount_amount; |
||||
472 | $paymentStatus = \constPaymentStatus::Unpaid; |
||||
473 | $total_paid = $request->payment_amount + $request->previous_payment; |
||||
474 | $pending = $invoice_total - $total_paid; |
||||
475 | |||||
476 | if($request->mode == 1) |
||||
477 | { |
||||
478 | if ($total_paid == $invoice_total) |
||||
479 | { |
||||
480 | $paymentStatus = \constPaymentStatus::Paid; |
||||
481 | } |
||||
482 | elseif($total_paid > 0 && $total_paid < $invoice_total) |
||||
483 | { |
||||
484 | $paymentStatus = \constPaymentStatus::Partial; |
||||
485 | } |
||||
486 | elseif($total_paid == 0) |
||||
487 | { |
||||
488 | $paymentStatus = \constPaymentStatus::Unpaid; |
||||
489 | } |
||||
490 | else |
||||
491 | { |
||||
492 | $paymentStatus = \constPaymentStatus::Overpaid; |
||||
493 | } |
||||
494 | } |
||||
495 | |||||
496 | Invoice::where('id',$subscription->invoice_id)->update(['invoice_number'=> $request->invoice_number, |
||||
497 | 'total'=> $invoice_total, |
||||
498 | 'status'=> $paymentStatus, |
||||
499 | 'pending_amount'=> $pending, |
||||
500 | 'discount_amount'=> $request->discount_amount, |
||||
501 | 'discount_percent'=> $request->discount_percent, |
||||
502 | 'discount_note'=> $request->discount_note, |
||||
503 | 'tax'=> $request->taxes_amount, |
||||
504 | 'additional_fees'=> $request->additional_fees, |
||||
505 | 'note'=>' ']); |
||||
506 | |||||
507 | foreach($request->plan as $plan) |
||||
508 | { |
||||
509 | $subscription->update(['plan_id'=> $plan['id'], |
||||
510 | 'start_date'=> $plan['start_date'], |
||||
511 | 'end_date'=> $plan['end_date'], |
||||
512 | 'status'=> \constSubscription::onGoing, |
||||
513 | 'is_renewal'=>'0']); |
||||
514 | |||||
515 | //Adding subscription to invoice(Invoice Details) |
||||
516 | |||||
517 | Invoice_detail::where('invoice_id',$subscription->invoice_id)->update(['plan_id'=> $plan['id'], |
||||
518 | 'item_amount'=> $plan['price']]); |
||||
519 | } |
||||
520 | |||||
521 | //Payment Details |
||||
522 | $paymentData = array('invoice_id'=> $subscription->invoice_id, |
||||
523 | 'payment_amount'=> $request->payment_amount, |
||||
524 | 'mode'=> $request->mode, |
||||
525 | 'note'=> ' '); |
||||
526 | |||||
527 | $payment_details = new Payment_detail($paymentData); |
||||
528 | $payment_details->createdBy()->associate(Auth::user()); |
||||
529 | $payment_details->updatedBy()->associate(Auth::user()); |
||||
530 | $payment_details->save(); |
||||
531 | |||||
532 | if($request->mode == 0) |
||||
533 | { |
||||
534 | // Store Cheque Details |
||||
535 | $chequeData = array('payment_id'=> $payment_details->id, |
||||
536 | 'number'=> $request->number, |
||||
537 | 'date'=> $request->date, |
||||
538 | 'status'=> \constChequeStatus::Recieved); |
||||
539 | |||||
540 | $cheque_details = new Cheque_detail($chequeData); |
||||
541 | $cheque_details->createdBy()->associate(Auth::user()); |
||||
542 | $cheque_details->updatedBy()->associate(Auth::user()); |
||||
543 | $cheque_details->save(); |
||||
544 | } |
||||
545 | |||||
546 | DB::commit(); |
||||
547 | flash()->success('Subscription was successfully changed'); |
||||
548 | return redirect (action('MembersController@show', ['id' => $subscription->member_id])); |
||||
549 | } |
||||
550 | |||||
551 | catch(\Exception $e) |
||||
552 | { |
||||
553 | DB::rollback(); |
||||
554 | flash()->error('Error while changing the Subscription'); |
||||
555 | return back(); |
||||
556 | } |
||||
557 | |||||
558 | } |
||||
559 | |||||
560 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths