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.

43 lines
864 B

5 years ago
  1. <?php
  2. namespace App\Model\v3;
  3. use App\Model\Model;
  4. class Order extends Model
  5. {
  6. protected $table = 'lanzu_order';
  7. protected $appends = [
  8. 'created_at_text',
  9. ];
  10. public function getCreatedAtTextAttribute()
  11. {
  12. return date('Y-m-d H:i:s', $this->attributes['created_at']);
  13. }
  14. public function orderGoods()
  15. {
  16. return $this->hasMany(OrderGoods::class, 'order_id', 'id');
  17. }
  18. public function market()
  19. {
  20. return $this->belongsTo(Market::class, 'market_id', 'id');
  21. }
  22. public function orderMain()
  23. {
  24. return $this->belongsTo(OrderMain::class, 'order_main_id', 'id');
  25. }
  26. public function user()
  27. {
  28. return $this->belongsTo(User::class, 'user_id', 'id');
  29. }
  30. public function store()
  31. {
  32. return $this->belongsTo(Store::class, 'store_id', 'id');
  33. }
  34. }