hot_spot.php 525 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App;
  3. use Illuminate\Database\Eloquent\Model;
  4. class hot_spot extends Model
  5. {
  6. //图片序列化
  7. public function setPicsAttribute($pics)
  8. {
  9. if (is_array($pics)) {
  10. $this->attributes['pics'] = json_encode($pics);
  11. }
  12. }
  13. //图片序列化
  14. public function getPicsAttribute($pics)
  15. {
  16. return json_decode($pics, true);
  17. }
  18. //与商家管理表关联
  19. // public function business()
  20. // {
  21. // return $this->hasOne(business::class);
  22. // }
  23. }