117 lines
3.6 KiB
PHP
117 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api\V1\Access;
|
|
|
|
use App\Constant\Constant;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\ChaturmasReview;
|
|
use App\Models\Chaturmas;
|
|
use Illuminate\Support\Facades\Log;
|
|
use App\Http\Controllers\Api\ApiController;
|
|
use App\Http\Requests\Api\ChaturmasReview\StoreChaturmasReviewRequest;
|
|
use App\Http\Requests\Api\ChaturmasReview\UpdateChaturmasReviewRequest;
|
|
use App\Repositories\Api\Access\ChaturmasReview\ChaturmasReviewInterface as ChaturmasReviewRepository;
|
|
|
|
|
|
class ChaturmasReviewController extends ApiController
|
|
{
|
|
|
|
/**
|
|
* @param ChaturmasReviewRepository $chaturmasReviewRepository
|
|
* ChaturmasController constructor.
|
|
*/
|
|
public function __construct(ChaturmasReviewRepository $chaturmasReviewRepository)
|
|
{
|
|
$this->chaturmasReviewRepository = $chaturmasReviewRepository;
|
|
}
|
|
|
|
/**
|
|
* Display a listing of the resource.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
try {
|
|
$response = $this->chaturmasReviewRepository->getChaturmasReviewList($request->all());
|
|
$this->updateStatusCode($response);
|
|
|
|
return $this->respond($response);
|
|
} catch (Exception $ex) {
|
|
Log::error($ex);
|
|
return $this->respondInternalError(trans('api.something_went_wrong'));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Store a newly created resource in storage.
|
|
*
|
|
* @param StoreChaturmasReviewRequest $request
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function store(StoreChaturmasReviewRequest $request, Chaturmas $chaturmas)
|
|
{
|
|
try {
|
|
$response = $this->chaturmasReviewRepository->storeChaturmasReview($request->all(), $chaturmas);
|
|
$this->updateStatusCode($response);
|
|
$this->setStatusCode($response['status']);
|
|
} catch (Exception $ex) {
|
|
$response['message'] = $ex->getMessage();
|
|
$this->setStatusCode(Constant::CODE_403);
|
|
}
|
|
|
|
return $this->respond($response);
|
|
}
|
|
|
|
/**
|
|
* Display the specified resource.
|
|
*
|
|
* @param \App\Models\ChaturmasReview $chaturmasReview
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function show(ChaturmasReview $chaturmasReview)
|
|
{
|
|
try {
|
|
$response = $this->chaturmasReviewRepository->showChaturmasReview($chaturma);
|
|
$this->updateStatusCode($response);
|
|
$this->setStatusCode($response['status']);
|
|
} catch (Exception $ex) {
|
|
$response['error'] = $ex->getMessage();
|
|
$this->setStatusCode(Constant::CODE_403);
|
|
}
|
|
|
|
return $this->respond($response);
|
|
}
|
|
|
|
/**
|
|
* Update the specified resource in storage.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \App\Models\ChaturmasReview $chaturmasReview
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update(Request $request, ChaturmasReview $chaturmasReview)
|
|
{
|
|
try {
|
|
$response = $this->chaturmasReviewRepository->updateChaturmasReview($request->all(), $chaturma);
|
|
$this->updateStatusCode($response);
|
|
$this->setStatusCode($response['status']);
|
|
} catch (\Exception $ex) {
|
|
$response['error'] = $ex->getMessage();
|
|
$this->setStatusCode(Constant::CODE_403);
|
|
}
|
|
return $this->respond($response);
|
|
}
|
|
|
|
/**
|
|
* Remove the specified resource from storage.
|
|
*
|
|
* @param \App\Models\ChaturmasReview $chaturmasReview
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy(ChaturmasReview $chaturmasReview)
|
|
{
|
|
//
|
|
}
|
|
}
|