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