海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
615 B

  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. class Special extends BaseModel
  5. {
  6. use HasFactory;
  7. protected $casts = ['picture' => 'array'];
  8. //轮播图片
  9. public function getPictureAttribute($value): array
  10. {
  11. $value = json_decode($value, true);
  12. return $value;
  13. }
  14. //代理商产品ID
  15. public function getAgentProductIdAttribute($value)
  16. {
  17. return explode(',', $value);
  18. }
  19. //代理商产品ID
  20. public function setAgentProductIdAttribute($value)
  21. {
  22. if (is_array($value)) {
  23. $this->attributes['agent_product_id'] = join(',', $value);
  24. }
  25. }
  26. }