StoreGoods.php 843 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class StoreGoods extends Model{
  5. protected $connection = 'mysql_w';
  6. protected $table='goods';
  7. protected $guarded = [];
  8. public function goodSku(){
  9. return $this->hasMany(StoreGoodsSku::class,'goods_id');
  10. }
  11. public function orderDetails(){
  12. return $this->hasMany(OrderDetailW::class,'goods_id');
  13. }
  14. public function getVipPriceAttribute($value){
  15. return round($value);
  16. }
  17. public function getPriceAttribute($value){
  18. return round($value);
  19. }
  20. public function getSuperPriceAttribute($value){
  21. return round($value);
  22. }
  23. public function getTopPriceAttribute($value){
  24. return round($value);
  25. }
  26. public function getCrownPriceAttribute($value){
  27. return round($value);
  28. }
  29. }