⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
work
/
modules
/
Flight
/
Models
/
Edit File: FlightSeat.php
<?php namespace Modules\Flight\Models; use App\BaseModel; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\SoftDeletes; use Modules\Flight\Factories\FlightSeatFactory; class FlightSeat extends BaseModel { use SoftDeletes; use HasFactory; protected $table = 'bravo_flight_seat'; protected $fillable=['seat_type','flight_id','price','max_passengers','person','baggage_check_in','baggage_cabin']; public function flight() { return $this->belongsTo(Flight::class,'flight_id')->withDefault(); } public function seatType(){ return $this->belongsTo(SeatType::class,'seat_type','code')->withDefault(); } protected static function newFactory() { return FlightSeatFactory::new(); } public function save(array $options = []) { $save = parent::save($options); // TODO: Change the autogenerated stub if($save){ $min_price = self::where('flight_id',$this->flight_id)->get()->min('price'); $flight= $this->flight; if($min_price < $flight->min_price or empty($flight->min_price)){ $flight->min_price = $min_price; $flight->save(); } } return $save; } }
Simpan