first commit
This commit is contained in:
43
app/Core/Service/CountryService.php
Normal file
43
app/Core/Service/CountryService.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Core\Service;
|
||||
|
||||
|
||||
use App\Core\Repository\Country\CountryRepository;
|
||||
use App\Exceptions\ApiErrorException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CountryService
|
||||
{
|
||||
private $countryRepository;
|
||||
|
||||
public function __construct ( CountryRepository $countryRepository )
|
||||
{
|
||||
$this->countryRepository = $countryRepository;
|
||||
}
|
||||
|
||||
|
||||
public function getCountryList ( array $criteria = [],$columns = ["*"] )
|
||||
{
|
||||
$response = ['status' => -1, 'message' => '', 'data' => null];
|
||||
try {
|
||||
|
||||
$data = $this->countryRepository->findByCriteria($criteria, $columns);
|
||||
$response = [
|
||||
'status' => true,
|
||||
'data' => $data,
|
||||
];
|
||||
|
||||
} catch (ApiErrorException $e) {
|
||||
$response['message'] = $e->getMessage();
|
||||
} catch (Exception $e) {
|
||||
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
|
||||
Log::error($message);
|
||||
$response['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
return output($response);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user