✏️ Edit: Delivery.php
Path:
/home/thiqat5/dex.thiqatech.com/model/Delivery.php
Size: 1.57 KB · Modified: 2021-11-03 20:28:12 · Perm: 0644 · Writable
← Back to directory
👁 View
⬇ Download
<?php namespace App\model; use Illuminate\Database\Eloquent\Model; class Delivery extends Model { // protected $hidden = ['Orders','order_id','Drivers','driver_id','customer_id']; protected $appends = ['DriverInfo','OrderInfo','Shops'];//'CustomerInfo' public function getShopsAttribute() { // return null ; // return $this->shopId; // $Shop = Shop::where('id', $this->order_id )->get(); // return $Shop; $orderShops = OrdersShop:: where('orderId', $this->order_id)-> get(); return $orderShops; } public function Orders() { // return $this->belongsToMany('\Products', 'ordersprpductlists'); return $this->hasOne('App\model\Orders', 'id', 'order_id'); } public function getOrderInfoAttribute() { return $this->Orders; if ( $this->Orders != null){ return $this->Orders->first(); } } public function Drivers() { // return $this->belongsToMany('\Products', 'ordersprpductlists'); return $this->hasOne('App\model\Customer', 'id', 'driver_id'); } public function getDriverInfoAttribute() { return $this->Drivers; } // public function Customers() // { // // return $this->belongsToMany('\Products', 'ordersprpductlists'); // return $this->hasOne('App\model\Customer', 'id', 'customer_id'); // } // public function getCustomerInfoAttribute() // { // return $this->Customers; // } }
💾 Save
Cancel
Save as UTF-8, newlines normalized to LF