56 lines
1.3 KiB
PHP
56 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Repositories\Api\Access\BloodGroup;
|
||
|
|
|
||
|
|
use App\Models\Country;
|
||
|
|
use App\Constant\Constant;
|
||
|
|
use App\Models\BloodGroup;
|
||
|
|
use Illuminate\Support\Facades\Log;
|
||
|
|
use App\Repositories\Api\Access\BloodGroup\BloodGroupInterface;
|
||
|
|
|
||
|
|
class BloodGroupRepository implements BloodGroupInterface
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* @var BloodGroup
|
||
|
|
*/
|
||
|
|
protected $bloodGroup;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param BloodGroup $bloodGroup
|
||
|
|
* BloodGroupRepository constructor.
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
public function __construct(BloodGroup $bloodGroup)
|
||
|
|
{
|
||
|
|
$this->bloodGroup = $bloodGroup;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
public function getBloodGroupList()
|
||
|
|
{
|
||
|
|
$response = [];
|
||
|
|
|
||
|
|
try {
|
||
|
|
$bloodGroupData = $this->bloodGroup->get()->toArray();
|
||
|
|
|
||
|
|
if ($bloodGroupData) {
|
||
|
|
$response['data'] = $bloodGroupData;
|
||
|
|
$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;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|