1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class Ordertest extends Model
- {
- protected $table='order_test';
- public function get_user(){
- return $this->belongsTo(User::class,'user_id')->withTrashed();
- }
- public function get_order_detail(){
- return $this->hasMany(Orderdetail::class,'order_id','id');
- }
- public function get_address(){
- return $this->belongsTo(Address::class,'address_id','id');
- }
- public function get_order_log(){
- return $this->hasMany(Orderlog::class,'order_id','id');
- }
- public function get_order_gift()
- {
- return $this->belongsToMany('App\Models\Gifts','order_gift','order_id','gift_id')->withPivot('num');
- }
- public function get_order_remark(){
- return $this->hasMany(OrderRemark::class,'order_id','id');
- }
- public function get_store(){
- return $this->belongsTo(Store::class,'store_id');
- }
- public function get_order_good()
- {
- return $this->belongsToMany(Goodtest::class,'order_detail','order_id','goods_id')->withPivot('num');
- }
- public function belong_user(){
- return $this->belongsTo(User::class,'good_user_id')->withTrashed();
- }
- }
|