Ordertest.php 953 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Ordertest extends Model
  5. {
  6. protected $table='order_test';
  7. public function get_user(){
  8. return $this->belongsTo(User::class,'user_id')->withTrashed();
  9. }
  10. public function get_order_detail(){
  11. return $this->hasMany(Orderdetail::class,'order_id','id');
  12. }
  13. public function get_address(){
  14. return $this->belongsTo(Address::class,'address_id','id');
  15. }
  16. public function get_order_log(){
  17. return $this->hasMany(Orderlog::class,'order_id','id');
  18. }
  19. public function get_order_gift()
  20. {
  21. return $this->belongsToMany('App\Models\Gifts','order_gift','order_id','gift_id')->withPivot('num');
  22. }
  23. public function get_order_remark(){
  24. return $this->hasMany(OrderRemark::class,'order_id','id');
  25. }
  26. public function get_store(){
  27. return $this->belongsTo(Store::class,'store_id');
  28. }
  29. }