first commit
This commit is contained in:
61
app/Http/Controllers/Admin/ManagePlanController.php
Normal file
61
app/Http/Controllers/Admin/ManagePlanController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Admin\ManagePlanService;
|
||||
use App\Models\SubscriptionMaster;
|
||||
use App\Models\SubscriptionPlanPackage;
|
||||
use App\Models\SubscriptionPackageDescription;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ManagePlanController extends Controller
|
||||
{
|
||||
|
||||
public function __construct(ManagePlanService $managePlanService) {
|
||||
$this->managePlanService = $managePlanService;
|
||||
}
|
||||
|
||||
public function view_plan(Request $req) {
|
||||
$manage_plan = $this->managePlanService->view_plan();
|
||||
// echo "<pre>"; print_r($manage_plan);exit;
|
||||
return view('Admin.Pages.manage_plan.manage_plan')->with(['manage_plan' => $manage_plan]);
|
||||
}
|
||||
|
||||
public function create_plan() {
|
||||
return view('Admin.Pages.manage_plan.add_plan');
|
||||
}
|
||||
|
||||
public function insert_plan(Request $request)
|
||||
{
|
||||
try {
|
||||
$plan = $this->managePlanService->insert_plan($request);
|
||||
return response()->json(['status' => 200, 'message' => 'Plan added successfully']);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo 'Message: ' .$e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data = $this->managePlanService->edit_plan($id);
|
||||
return view('Admin.Pages.manage_plan.edit_plan')->with(['plan_data'=>$data]);
|
||||
}
|
||||
|
||||
public function delete_plan($id) {
|
||||
// print_r($id);die;
|
||||
$plan = SubscriptionMaster::find($id)->delete();
|
||||
$plan = SubscriptionPlanPackage::where('subscription_master_id', $id)->delete();
|
||||
$plan = SubscriptionPackageDescription::where('subscription_master_id', $id)->delete();
|
||||
|
||||
}
|
||||
|
||||
public function update_plan(Request $request)
|
||||
{
|
||||
$plan_update = $this->managePlanService->update_plan($request);
|
||||
return response()->json(['success' => true,'status'=>200]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user