Goods.php 554 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Goods extends Model
  5. {
  6. protected $table='goods';
  7. protected $guarded=[];
  8. protected $fillable=['name','vip_price','price','sale_num','content','banner','img','main_attr','is_delete','is_shelves'];
  9. public function goodSku(){
  10. return $this->hasMany(GoodSku::class,'goods_id');
  11. }
  12. public function getVipPriceAttribute($value){
  13. return round($value);
  14. }
  15. public function getPriceAttribute($value){
  16. return round($value);
  17. }
  18. }