GoodSku.php 484 B

123456789101112131415161718192021
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Illuminate\Database\Eloquent\SoftDeletes;
  5. class GoodSku extends Model
  6. {
  7. use SoftDeletes;
  8. protected $table='goods_sku';
  9. protected $fillable=['user_id','goods_id','price','num','amount','size','type','is_true','sort'];
  10. public function goods(){
  11. return $this->belongsTo(Goods::class,'goods_id');
  12. }
  13. public function getPriceAttribute($value){
  14. return round($value);
  15. }
  16. }