55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Repositories\Api\Access\Dharma;
|
|
|
|
use App\Models\Dharma;
|
|
use App\Constant\Constant;
|
|
use Illuminate\Support\Facades\Log;
|
|
use App\Repositories\Api\Access\Dharma\DharmaInterface;
|
|
|
|
class DharmaRepository implements DharmaInterface
|
|
{
|
|
/**
|
|
* @var Dharma
|
|
*/
|
|
protected $dharma;
|
|
|
|
/**
|
|
* @param Dharma $dharma
|
|
* DharmaRepository constructor.
|
|
*
|
|
*/
|
|
public function __construct(Dharma $dharma)
|
|
{
|
|
$this->dharma = $dharma;
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getDharmaDetail()
|
|
{
|
|
$response = [];
|
|
|
|
try {
|
|
$dharmaData = $this->dharma->get()->toArray();
|
|
|
|
if ($dharmaData) {
|
|
$response['data'] = $dharmaData;
|
|
$response['status'] = Constant::CODE_200;
|
|
} else {
|
|
$response['data'] = [];
|
|
$response['status'] = Constant::CODE_401;
|
|
}
|
|
|
|
} catch (\Exception $ex) {
|
|
Log::error($ex);
|
|
$response['message'] = trans('auth.something_went_wrong');
|
|
$response['status'] = Constant::CODE_403;
|
|
}
|
|
|
|
return $response;
|
|
}
|
|
}
|
|
|