mein-sterntours/app/Models/BookingCountryService.php
2025-04-01 10:40:14 +02:00

77 lines
2.4 KiB
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
/**
* Class BookingCountryService
*
* @property int $id
* @property int $travel_country_service_id
* @property int $booking_id
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Booking $booking
* @property TravelCountryService $travel_country_service
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereBookingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereTravelCountryServiceId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereUpdatedAt($value)
* @property int|null $status
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\BookingCountryService whereStatus($value)
* @mixin \Eloquent
*/
class BookingCountryService extends Model
{
protected $connection = 'mysql';
protected $table = 'booking_country_services';
protected $casts = [
'travel_country_service_id' => 'int',
'booking_id' => 'int',
'status' => 'int'
];
protected $fillable = [
'travel_country_service_id',
'booking_id',
'status'
];
protected $status_type = [
0 => 'offen',
1 => 'erledigt',
];
public function booking()
{
return $this->belongsTo(Booking::class);
}
public function travel_country_service()
{
return $this->belongsTo(TravelCountryService::class);
}
public static function getStatus($travel_country_service_id, $booking_id){
$service = BookingCountryService::where('travel_country_service_id', '=', $travel_country_service_id)
->where('booking_id', '=', $booking_id)->first();
if($service){
return $service->status;
}
return 0;
}
}