first commit
This commit is contained in:
115
app/Core/Service/PropertyRoomRatePriceQueueService.php
Normal file
115
app/Core/Service/PropertyRoomRatePriceQueueService.php
Normal file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Service;
|
||||
|
||||
use App\Core\Repository\PropertyRoomRatePrice\PropertyRoomRatePriceQueueRepository;
|
||||
|
||||
|
||||
use App;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Exception;
|
||||
use App\Exceptions\ApiErrorException;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class PropertyRoomRatePriceQueueService
|
||||
{
|
||||
|
||||
private $propertyRoomRatePriceQueueRepository;
|
||||
|
||||
|
||||
public function __construct(
|
||||
|
||||
PropertyRoomRatePriceQueueRepository $propertyRoomRatePriceQueueRepository
|
||||
)
|
||||
{
|
||||
|
||||
$this->propertyRoomRatePriceQueueRepository = $propertyRoomRatePriceQueueRepository;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function select($param = [], $column = ['*'])
|
||||
{
|
||||
|
||||
$response = ['status' => -1, 'message' => '', 'data' => null];
|
||||
|
||||
try {
|
||||
|
||||
$data = $this->propertyRoomRatePriceQueueRepository->findByCriteria($param, $column);
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
public function update($id, $param = [])
|
||||
{
|
||||
|
||||
|
||||
$response = ['status' => -1, 'message' => '', 'data' => null];
|
||||
try {
|
||||
|
||||
|
||||
$updateResult = $this->propertyRoomRatePriceQueueRepository->update($id, $param);
|
||||
if ($updateResult['status'] != 'success') {
|
||||
throw new Exception('api-unknown_error');
|
||||
}
|
||||
$updateData = $updateResult["data"];
|
||||
$response = [
|
||||
'status' => true,
|
||||
'data' => $updateData,
|
||||
];
|
||||
|
||||
} catch (ApiErrorException $e) {
|
||||
$response['message'] = implode(', ', $e->getMessageArr());
|
||||
} catch (Exception $e) {
|
||||
$message = $e->getFile() . " " . $e->getLine() . " " . $e->getMessage();
|
||||
Log::error($message);
|
||||
$response['message'] = $e->getMessage();
|
||||
}
|
||||
|
||||
return output($response);
|
||||
}
|
||||
|
||||
public function delete($ids = []){
|
||||
|
||||
$response = ['status' => -1, 'message' => '', 'data' => null];
|
||||
try {
|
||||
|
||||
|
||||
$deleteResult = $this->propertyRoomRatePriceQueueRepository->destroy($ids);
|
||||
|
||||
if ($deleteResult['status'] != 'success') {
|
||||
throw new ApiErrorException('api-unknown_error');
|
||||
}
|
||||
|
||||
$response = [
|
||||
'status' => true,
|
||||
'data' => $deleteResult['data'] // affected row count
|
||||
];
|
||||
|
||||
} catch (ApiErrorException $e) {
|
||||
$response['message'] = implode(', ', $e->getMessageArr());
|
||||
} 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