You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class ImsCjdcOrder extends Model{ use HasDateTimeFormatter; protected $table = 'lanzu_order as order'; public $timestamps = false;
public function user() { return $this->hasOne('\App\Models\ImsCjdcUser','id','user_id'); }
public function store() { return $this->hasOne('\App\Models\LanzuStore','id','store_id'); }
public static function getOrdersData($oid) { $orders = ImsCjdcOrder::with('user')->with('store') ->where('order_main_id', $oid)->get()->toArray(); if (count($orders)) { foreach ($orders as &$or) { if (substr($or['store']['logo'], 0, 4) != 'http') { $or['store']['logo'] = env('IMG_HOST') . '/' . $or['store']['logo']; } $or['goods'] = LanzuOrderGoods::where('order_id', $or['id'])->get()->toArray(); } } return json_encode($orders); }}
|