Fewo Mails / Booking Country Services
This commit is contained in:
parent
b9c26d06d0
commit
48a6eb2282
154 changed files with 7761 additions and 1643 deletions
|
|
@ -4,6 +4,7 @@ namespace App\Repositories;
|
|||
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\BookingCountryService;
|
||||
|
||||
class BookingRepository extends BaseRepository {
|
||||
|
||||
|
|
@ -18,4 +19,55 @@ class BookingRepository extends BaseRepository {
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateBooking($id, $data){
|
||||
|
||||
$this->model = Booking::findOrFail($id);
|
||||
|
||||
$fill = [
|
||||
'paying_out' => $data['paying_out'],
|
||||
'paying_out_status' => $data['paying_out_status'],
|
||||
'airline_id' => $data['airline_id'],
|
||||
'refund' => $data['refund'],
|
||||
'refund_date' => _reformat_date($data['refund_date']),
|
||||
'lawyer_date' => _reformat_date($data['lawyer_date']),
|
||||
'hold' => $data['hold'],
|
||||
'xx_tkt' => $data['xx_tkt'],
|
||||
'xx_tkt_date' => _reformat_date($data['xx_tkt_date']),
|
||||
'filekey' => $data['filekey'],
|
||||
'is_rail_fly' => isset($data['is_rail_fly']) ? true : false,
|
||||
'notice' => $data['notice'],
|
||||
];
|
||||
|
||||
$this->model->fill($fill);
|
||||
$this->model->save();
|
||||
|
||||
if(isset($data['country_service'])){
|
||||
$this->updateCountryService($data['country_service']);
|
||||
}
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateCountryService($country_services){
|
||||
|
||||
foreach ($country_services as $country_service_id=>$val){
|
||||
$booking_country_service = BookingCountryService::where('travel_country_service_id', '=', $country_service_id)
|
||||
->where('booking_id', '=', $this->model->id)->first();
|
||||
|
||||
if(!$booking_country_service){
|
||||
$booking_country_service = BookingCountryService::create([
|
||||
'travel_country_service_id' => $country_service_id,
|
||||
'booking_id' => $this->model->id,
|
||||
'status' => $val
|
||||
]);
|
||||
}else{
|
||||
$booking_country_service->fill([
|
||||
'status' => $val
|
||||
]);
|
||||
$booking_country_service->save();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue