api code global jain
This commit is contained in:
42
app/Http/Controllers/Api/V1/Access/ReportController.php
Normal file
42
app/Http/Controllers/Api/V1/Access/ReportController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Report\ReportInterface as ReportRepository;
|
||||
|
||||
class ReportController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param ReportRepository $reportRepository
|
||||
* ReportController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(ReportRepository $reportRepository)
|
||||
{
|
||||
$this->reportRepository = $reportRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $request
|
||||
* @return array
|
||||
*/
|
||||
public function storeReport(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->reportRepository->create($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user