Inventory.php 544 B

1234567891011121314151617181920212223
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Inventory extends Model
  5. {
  6. //定义表
  7. protected $table = "goods_sku_agent_total";
  8. //定义主键
  9. protected $primaryKey = "id";
  10. protected $fillable = ['user_id','goods_id','sku_id','total'];
  11. public $timestamps = false;
  12. public function user()
  13. {
  14. return $this->hasOne('App\Models\User','id','user_id');
  15. }
  16. public function goods()
  17. {
  18. return $this->hasOne('App\Models\Goods','id','goods_id')->withTrashed();
  19. }
  20. }