1234567891011121314151617181920212223 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class Inventory extends Model
- {
- //定义表
- protected $table = "goods_sku_agent_total";
- //定义主键
- protected $primaryKey = "id";
- protected $fillable = ['user_id','goods_id','sku_id','total'];
- public $timestamps = false;
- public function user()
- {
- return $this->hasOne('App\Models\User','id','user_id');
- }
- public function goods()
- {
- return $this->hasOne('App\Models\Goods','id','goods_id')->withTrashed();
- }
- }
|