File size: 1,278 Bytes
5f32fbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php

namespace App\Http\Controllers\Admin\Finance;

use App\Http\Controllers\Controller;
use App\Http\Controllers\Finance\PaymentProcessController;
use App\Models\PaymentPlans;
use App\Models\Setting;

class PlanController extends Controller
{
    public function index()
    {
        return view('panel.admin.finance.plan.index', [
            'gatewayError' => false,
            'setting'      => Setting::query()->first(),
            'plans'        => PaymentPlans::query()->get(),
        ]);
    }

    public function create()
    {
        return view('panel.admin.finance.plan.form', [
            'method'       => 'POST',
            'title'        => trans('Create Plan'),
            'item'         => new PaymentPlans,
            'subscription' => true,
        ]);
    }

    public function edit(PaymentPlans $plan)
    {

        return view('panel.admin.finance.plan.form', [
            'method'       => 'POST',
            'title'        => trans('Edit Plan'),
            'item'         => $plan,
            'subscription' => true,
        ]);
    }

    public function destroy(PaymentPlans $plan)
    {
        PaymentProcessController::deletePaymentPlan($plan->id);

        return redirect()->route('dashboard.admin.finance.plan.index');
    }
}