/
home
/
henzagold
/
server
/
app
/
Models
/
File Upload :
llllll
Current File: /home/henzagold/server/app/Models/SingleCustomerOrders.php
<?php namespace App\Models; use App\DB\Selector; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Support\Arr; use Illuminate\Support\Facades\Hash; class SingleCustomerOrders extends Model { use HasFactory; use SoftDeletes; use Selector; //protected $connection = 'pgsql'; protected $table = 'orders_orders'; public $fillable=[ 'app', 'billing_address', 'browser_ip', 'buyer_accepts_marketing', 'email', 'phone', 'note', 'prcessing_method', 'processed_at', 'shipping_address', 'shipping_line', 'subtotal_price', 'discount_codes', 'total_discount', 'total_price',//قیمت کل بدون تخفیف 'price',//قیمت کل با تخفیف 'total_tax', 'total_weight', 'tags', 'sts', 'is_active', 'canceled_at', 'canceled_reason', 'closed_at', 'send_time_id', 'user_id_id', 'gold_price', 'gold_price_original', 'type', 'reagent_id',//مدیری که سفارش را ثبت کرده است 'use_wallet', 'payment_after_wallet',//مبلغ قابل پرداخت بعد از استفاده از ولت 'branch_id' ]; protected $appends=[ 'sts_str' ]; protected $casts=[ 'shipping_address'=>'array', 'use_wallet'=>'boolean' ]; public static $STS = [ 1 => 'ثبت سفارش', 2 => 'تایید مدیر سیستم', 3 => 'در حال تامین', 4=> 'در حال آماده سازی', 5=> 'خروج از انبار', 6=> 'ارسال', 7=> 'تحویل مشتری' ]; public static $TYPES = [ 1 => 'تلفنی', 2 => 'تلگرام', 3 => 'واتس آپ', 4=> 'اینستا', 5=> 'حضوری', ]; public function items(){ return $this->hasMany('App\Models\SingleCustomerOrderItems','order_id')->with('product'); } public function getStsStrAttribute() { return Arr::get($this::$STS,$this->sts,'نا مشخص'); } public function customer() { return $this->belongsTo('App\Models\SingleCustomer','user_id_id'); } public function user() { return $this->belongsTo('App\Models\User','reagent_id'); } public function branch() { return $this->belongsTo(Branch::class); } public function activity() { return $this->hasMany('App\Models\SingleCustomer\OrderActivity', 'order_id')->select(['*', OrderActivity::$SELECT_CAJ,OrderActivity::$SELECT_UAJ])->orderBy('id'); } }
Copyright ©2k19 -
Hexid
|
Tex7ure