Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/rentpix.corals.io/Corals/modules/RentPix/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/rentpix.corals.io/Corals/modules/RentPix/Models/Reservation.php
<?php

namespace Corals\Modules\RentPix\Models;

use Corals\Foundation\Models\BaseModel;
use Corals\Foundation\Search\Indexable;
use Corals\Foundation\Transformers\PresentableTrait;
use Corals\Modules\Utility\Traits\Comment\ModelHasComments;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Reservation extends BaseModel
{
    use PresentableTrait, Indexable, ModelHasComments;

    /**
     *  Model configuration.
     *
     * @var string
     */
    public $config = 'rentPix.models.reservation';

    protected $indexTitleColumns = [
        'code',
        'unit.code',
        'unit.vin',
        'unit.license',
    ];

    protected $indexContentColumns = [
        'customer.name',
        'customer.first_name',
        'customer.last_name',
        'customer.email',
        'customer.phone',
    ];

    protected $casts = [
        'properties' => 'json',
        'start_location' => 'json',
        'end_location' => 'json',
    ];

    protected $table = 'pix_reservations';

    protected $guarded = ['id'];

    /**
     * @return BelongsTo
     */
    public function customer()
    {
        return $this->belongsTo(Customer::class);
    }

    /**
     * @return BelongsTo
     */
    public function unit()
    {
        return $this->belongsTo(Unit::class);
    }

    /**
     * @return HasMany
     */
    public function inspections()
    {
        return $this->hasMany(Inspection::class)->latest('inspected_at');
    }

    /**
     * @return BelongsToMany
     */
    public function drivers()
    {
        return $this->belongsToMany(Driver::class, 'pix_driver_reservation')
            ->withTimestamps()
            ->withPivot(['is_primary', 'properties'])
            ->orderBy('is_primary', 'desc');
    }
}

Spamworldpro Mini