Fewo Mails / Booking Country Services

This commit is contained in:
Kevin Adametz 2020-05-28 19:03:42 +02:00
parent b9c26d06d0
commit 48a6eb2282
154 changed files with 7761 additions and 1643 deletions

View file

@ -0,0 +1,75 @@
<?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)
* @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){
$booking_country_service = BookingCountryService::where('travel_country_service_id', '=', $travel_country_service_id)
->where('booking_id', '=', $booking_id)->first();
if($booking_country_service){
return $booking_country_service->status;
}
return 0;
}
}