45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Api\V1\Access;
|
||
|
|
|
||
|
|
use App\Constant\Constant;
|
||
|
|
use App\Http\Controllers\Api\ApiController;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use App\Repositories\Api\Access\Profession\ProfessionInterface as ProfessionRepository;
|
||
|
|
use Exception;
|
||
|
|
use Illuminate\Support\Facades\Log;
|
||
|
|
|
||
|
|
class ProfessionController extends ApiController
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @param ProfessionRepository $professionRepository
|
||
|
|
* ProfessionController constructor.
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
public function __construct(ProfessionRepository $professionRepository)
|
||
|
|
{
|
||
|
|
$this->professionRepository = $professionRepository;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Display a listing of the resource.
|
||
|
|
*
|
||
|
|
* @return \Illuminate\Http\Response
|
||
|
|
*/
|
||
|
|
public function index(Request $request)
|
||
|
|
{
|
||
|
|
$response = [];
|
||
|
|
|
||
|
|
try {
|
||
|
|
$response = $this->professionRepository->index($request->all());
|
||
|
|
$this->setStatusCode($response['status']);
|
||
|
|
|
||
|
|
} catch (Exception $ex) {
|
||
|
|
Log::error($ex);
|
||
|
|
$this->setStatusCode(Constant::CODE_403);
|
||
|
|
}
|
||
|
|
|
||
|
|
return $this->respond($response);
|
||
|
|
}
|
||
|
|
}
|