CustomerPackagePaymentController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\Models\CustomerPackagePayment;
  5. use App\Models\CustomerPackage;
  6. use App\Models\User;
  7. class CustomerPackagePaymentController extends Controller
  8. {
  9. /**
  10. * Display a listing of the resource.
  11. *
  12. * @return \Illuminate\Http\Response
  13. */
  14. public function index()
  15. {
  16. //
  17. }
  18. public function offline_payment_request(){
  19. $package_payment_requests = CustomerPackagePayment::where('offline_payment',1)->orderBy('id', 'desc')->paginate(10);
  20. return view('manual_payment_methods.customer_package_payment_request', compact('package_payment_requests'));
  21. }
  22. public function offline_payment_approval(Request $request)
  23. {
  24. $package_payment = CustomerPackagePayment::findOrFail($request->id);
  25. $package_details = CustomerPackage::findOrFail($package_payment->customer_package_id);
  26. $package_payment->approval = $request->status;
  27. if($package_payment->save()){
  28. $user = $package_payment->user;
  29. $user->customer_package_id = $package_payment->customer_package_id;
  30. $user->remaining_uploads = $user->remaining_uploads + $package_details->product_upload;
  31. if($user->save()){
  32. return 1;
  33. }
  34. }
  35. return 0;
  36. }
  37. /**
  38. * Show the form for creating a new resource.
  39. *
  40. * @return \Illuminate\Http\Response
  41. */
  42. public function create()
  43. {
  44. //
  45. }
  46. /**
  47. * Store a newly created resource in storage.
  48. *
  49. * @param \Illuminate\Http\Request $request
  50. * @return \Illuminate\Http\Response
  51. */
  52. public function store(Request $request)
  53. {
  54. //
  55. }
  56. /**
  57. * Display the specified resource.
  58. *
  59. * @param int $id
  60. * @return \Illuminate\Http\Response
  61. */
  62. public function show($id)
  63. {
  64. //
  65. }
  66. /**
  67. * Show the form for editing the specified resource.
  68. *
  69. * @param int $id
  70. * @return \Illuminate\Http\Response
  71. */
  72. public function edit($id)
  73. {
  74. //
  75. }
  76. /**
  77. * Update the specified resource in storage.
  78. *
  79. * @param \Illuminate\Http\Request $request
  80. * @param int $id
  81. * @return \Illuminate\Http\Response
  82. */
  83. public function update(Request $request, $id)
  84. {
  85. //
  86. }
  87. /**
  88. * Remove the specified resource from storage.
  89. *
  90. * @param int $id
  91. * @return \Illuminate\Http\Response
  92. */
  93. public function destroy($id)
  94. {
  95. //
  96. }
  97. }