Add Service Config

This commit is contained in:
2022-08-08 12:51:32 +07:00
parent da739af519
commit 3b63f02bc4
17 changed files with 1171 additions and 3 deletions

View File

@@ -0,0 +1,91 @@
<?php
namespace Modules\Internal\Http\Controllers\Api;
use App\Helpers\Helper;
use App\Models\CorporateService;
use App\Models\CorporateServiceConfig;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Modules\Internal\Transformers\CorporateServiceConfigResource;
class CorporateServiceController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index(Request $request, $corporate_id)
{
$services = CorporateService::with('configs', 'service')->where('corporate_id', $corporate_id)->paginate();
return Helper::paginateResources(CorporateServiceConfigResource::collection($services));
}
/**
* Show the form for creating a new resource.
* @return Renderable
*/
public function create()
{
return view('internal::create');
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @return Renderable
*/
public function store(Request $request)
{
//
}
/**
* Show the specified resource.
* @param int $id
* @return Renderable
*/
public function show($id)
{
return view('internal::show');
}
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id)
{
return view('internal::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $corporate_id)
{
$corporateService = CorporateService::where('corporate_id', $corporate_id)->where('service_code', $request->service_code)->first();
$corporateServiceConfig = $corporateService->configs()->updateOrCreate([
'name' => $request->config_name,
'value' => $request->config_value
]);
return $corporateServiceConfig;
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

View File

@@ -32,7 +32,6 @@ class DiagnosisExclusionController extends Controller
->paginate();
// return $exclusions;
return Helper::paginateResources(DiagnosisExclusionResource::collection($exclusions));
return response()->json(DiagnosisExclusionResource::collection($exclusions)->response()->getData(true));
}
/**