perbaili list table corporate, dan table plan
This commit is contained in:
@@ -38,6 +38,8 @@ class CorporateController extends Controller
|
||||
->withCount([
|
||||
'employees',
|
||||
'corporateBenefits',
|
||||
'corporatePlans',
|
||||
|
||||
// 'claims'
|
||||
])
|
||||
->where('type', 'corporate')
|
||||
@@ -141,7 +143,7 @@ class CorporateController extends Controller
|
||||
'description' => 'Optical',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
foreach ($services as $service) {
|
||||
|
||||
$corporateService = $newCorporate->corporateServices()->create([
|
||||
@@ -236,11 +238,11 @@ class CorporateController extends Controller
|
||||
public function show($id)
|
||||
{
|
||||
$corporate = Corporate::query()
|
||||
->with(['currentPolicy'])
|
||||
->withCount('corporatePlans')
|
||||
->withCount('employees')
|
||||
// ->withCount('employees.claims')
|
||||
->findOrFail($id);
|
||||
->with(['currentPolicy'])
|
||||
->withCount('corporatePlans')
|
||||
->withCount('employees')
|
||||
// ->withCount('employees.claims')
|
||||
->findOrFail($id);
|
||||
|
||||
return response()->json($corporate);
|
||||
}
|
||||
|
||||
@@ -17,14 +17,33 @@ class CorporatePlanController extends Controller
|
||||
public function index(Request $request, $corporate_id)
|
||||
{
|
||||
$benefits = CorporatePlan::query()
|
||||
->filter($request->all())
|
||||
->where('corporate_id', $corporate_id)
|
||||
->paginate(0)
|
||||
->appends($request->all());
|
||||
|
||||
->filter($request->all())
|
||||
->where('corporate_id', $corporate_id)
|
||||
->paginate(0)
|
||||
->appends($request->all());
|
||||
|
||||
return $benefits;
|
||||
}
|
||||
|
||||
public function activation(Request $request, $plan_id)
|
||||
{
|
||||
$request->validate([
|
||||
'active' => 'required'
|
||||
]);
|
||||
|
||||
// abort(404);
|
||||
|
||||
$plan = CorporatePlan::findOrFail($plan_id);
|
||||
$plan->active = $request->active == '1';
|
||||
|
||||
if ($plan->save()) {
|
||||
return response()->json([
|
||||
'plan' => $plan,
|
||||
'message' => 'Status Updated Successfully'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
|
||||
Reference in New Issue
Block a user