first commit

This commit is contained in:
ExtraNetwork
2026-05-12 17:04:54 +03:00
commit e5c4b6aa13
1425 changed files with 284735 additions and 0 deletions

View File

@@ -0,0 +1,131 @@
<?php
namespace App\Core\Service;
use App\Core\Repository\Booking\BookingRoomPaxRepository;
use App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Config;
use Exception;
use App\Exceptions\ApiErrorException;
class BookingRoomPaxService
{
private $bookingRoomPaxRepository;
public function __construct(
BookingRoomPaxRepository $bookingRoomPaxRepository
)
{
$this->bookingRoomPaxRepository = $bookingRoomPaxRepository;
}
public function create($params = [])
{
$response = ['status' => -1, 'message' => '', 'data' => null];
try {
/*$validationResult = $this->propertyChannelAddValidator->validate($params);
if ($validationResult->errors()->first()) {
$errors = $validationResult->errors()->all();
throw new ApiErrorException($errors);
}*/
$insertData = [
'booking_id' => fillOnUndefined($params, 'booking_id'),
'booking_room_id' => fillOnUndefined($params, 'booking_room_id'),
'type' => fillOnUndefined($params, 'type'),
'name' => fillOnUndefined($params, 'name'),
'surname' => fillOnUndefined($params, 'surname'),
'gender' => fillOnUndefined($params, 'gender'),
'citizen' => fillOnUndefined($params, 'citizen'),
'birth_date' => fillOnUndefined($params, 'birth_date'),
'status' => fillOnUndefined($params, 'status', 1),
];
$userCreateResult = $this->bookingRoomPaxRepository->create($insertData);
if ($userCreateResult['status'] != 'success') {
throw new Exception('api-unknown_error');
}
$userData = $userCreateResult["data"];
$response = [
'status' => true,
'data' => $userData,
];
} 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 select($param = [], $column = ['*'])
{
$response = ['status' => -1, 'message' => '', 'data' => null];
try {
$data = $this->bookingRoomPaxRepository->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->bookingRoomPaxRepository->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);
}
}