HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/vhost/disk-apps/agile-selling-wpb/app/Order.php
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use App\User;
use App\OrderState;
use App\Sucursal;
use App\Address;
use App\PaymentType;
use App\OrderType;
use App\SalesChannel;
use App\LineBusiness;
use Illuminate\Database\Eloquent\SoftDeletes;


class Order extends Model
{
    use SoftDeletes;
    protected $guarded  = ['id','deleted_at'];
    public $timestamps = false;

    public function client()
    {
        return $this->belongsTo(User::class, 'client_id')->with("addresses")->with("boPaymentTermType")->withTrashed();
    }

    public function deliveryMan()
    {
        return $this->belongsTo(User::class, 'delivery_man_id')->with('userInfo')->withTrashed();
    }

    public function deliveryManAccepted()
    {
        return $this->belongsTo(User::class, 'accepted_delivery_man_id')->with('userInfo')->withTrashed();
    }

    public function deliveryManCollected()
    {
        return $this->belongsTo(User::class, 'collected_delivery_man_id')->with('userInfo')->withTrashed();
    }

    public function deliveryManDeliver()
    {
        return $this->belongsTo(User::class, 'deliver_delivery_man_id')->with('userInfo')->withTrashed();
    }

    // public function deliveryManInformation(){
    //   return $this->belongsTo(UserInformation::class,'delivery_man_id')->withTrashed();
    // }

    public function admin()
    {
        return $this->belongsTo(User::class, 'admin_id')->withTrashed();
    }

    public function orderState()
    {
        return $this->belongsTo(orderState::class)->select(array('id', 'name'));
    }

    public function sucursal()
    {
        return $this->belongsTo(Sucursal::class, 'sucursal_id')->withTrashed();
    }

    public function sucursalOrigin()
    {
        return $this->belongsTo(Sucursal::class, 'sucursal_origin_id')->withTrashed();
    }

    public function currentSucursal()
    {
        return $this->belongsTo(Sucursal::class, 'current_sucursal_id')->withTrashed();
    }

    public function comment()
    {
        return $this->hasMany(Comment::class);
    }

    public function address()
    {
        return $this->belongsTo(Address::class)->withTrashed();
    }

    public function transferences()
    {
        return $this->hasMany(Transfer::class);
    }

    public function paymentType()
    {
        return $this->belongsTo(PaymentType::class);
    }

    public function orderProducts()
    {
        return $this->hasMany(OrderProduct::class)->with('products','orderProductAttributes','product');
    }

    public function orderType()
    {
        return $this->belongsTo(OrderType::class);
    }

    public function boShippingType()
    {
        return $this->belongsTo(BoShippingType::class);
    }

    public function channel()
    {
        return $this->belongsTo(SalesChannel::class, 'sales_channel_id')->withTrashed();
    }

    public function line()
    {
        return $this->belongsTo(LineBusiness::class, 'line_businesses_id')->withTrashed();
    }

    public function point_sale()
    {
        return $this->belongsTo(PointSale::class);
    }

    public function discountOrderUser()
    {
        return $this->hasMany(DiscountOrderUser::class, 'order_id', 'id')->with('discount');
    }

    public function discountProductUsers()
    {
        return $this->hasMany(DiscountProductUser::class, 'order_id', 'id');
    }
}