%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/forge/api-takeaseat.eco-n-tech.co.uk/app/Models/
Upload File :
Create Path :
Current File : //home/forge/api-takeaseat.eco-n-tech.co.uk/app/Models/Booking.php

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Booking extends Model
{
    use HasFactory;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_id',
        'therapist_id',
        'session_id',
        'address_id',
        'payment_id',
        'is_reminder_sent',
        'status',
        'start_date',
        'end_date'
    ];

    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'start_date' => 'datetime:Y-m-d H:i:s',
        'end_date' => 'datetime:Y-m-d H:i:s',
        'is_reminder_sent' => 'boolean'
    ];

    /**
     * List of statuses
     * 
     * @var array
     */
    const STATUSES = [
        1 => 'Pending',
        2 => 'Cancelled',
        3 => 'Complete'
    ];

    /**
     * Scope a query to only include bookings that are not cancelled
     *
     * @param  \Illuminate\Database\Eloquent\Builder  $query
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function scopeNotCancelled($query)
    {
        return $query->where('status', '!=', 2);
    }

    /**
     * Get the payment made for this booking
     */
    public function payment()
    {
        return $this->belongsTo(Payment::class);
    }

    /**
     * Get the address for this booking
     */
    public function address()
    {
        return $this->belongsTo(UserAddress::class);
    }

    /**
     * Get the user that created this booking
     */
    public function user()
    {
        return $this->belongsTo(User::class);
    }

    /**
     * Get the therapist for this booking
     */
    public function therapist()
    {
        return $this->belongsTo(Therapist::class);
    }

    /**
     * Get the session type for this booking
     */
    public function session()
    {
        return $this->belongsTo(Session::class);
    }
}

Zerion Mini Shell 1.0