![]() 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/mcoil.corals.io/app/Shop/Orders/ |
<?php namespace App\Shop\Orders; use App\Shop\Addresses\Address; use App\Shop\Couriers\Courier; use App\Shop\Customers\Customer; use App\Shop\OrderStatuses\OrderStatus; use App\Shop\Products\Product; use Illuminate\Database\Eloquent\Model; use Nicolaslopezj\Searchable\SearchableTrait; class Order extends Model { use SearchableTrait; /** * Searchable rules. * * Columns and their priority in search results. * Columns with higher values are more important. * Columns with equal values have equal importance. * * @var array */ protected $searchable = [ 'columns' => [ 'customers.name' => 10, 'orders.reference' => 8, 'products.name' => 5 ], 'joins' => [ 'customers' => ['customers.id', 'orders.customer_id'], 'order_product' => ['orders.id', 'order_product.order_id'], 'products' => ['products.id', 'order_product.product_id'], 'drivers'=>['customers.id', 'orders.driver_id'] ], 'groupBy' => ['orders.id'] ]; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'id', 'reference', 'courier_id', // @deprecated 'courier', 'customer_id', 'address_id', 'order_status_id', 'payment', 'discounts', 'total_products', 'total', 'tax', 'tax_value', 'total_paid', 'invoice', 'label_url', 'tracking_number', 'total_shipping', 'order_county_id', 'order_town_id', // For discount 'discount_coupon_code', 'discount_coupon_type', 'discount_value', 'discount_amount', 'billing_address_id', 'delivery_address_id', 'delivery_note', // Payment related 'transaction_id', 'stripe_customer_id ', 'transaction_status', 'completed_date' ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = []; /** * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany */ public function products() { return $this->belongsToMany(Product::class) ->withPivot([ 'quantity', 'product_name', 'product_sku', 'product_description', 'product_price', 'product_attribute_id' ]); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function customer() { return $this->belongsTo(Customer::class); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function courier() { return $this->belongsTo(Courier::class); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function address() { return $this->belongsTo(Address::class); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function orderStatus() { return $this->belongsTo(OrderStatus::class); } /** * @param string $term * * @return mixed */ public function searchForOrder(string $term) { return self::search($term); } }