ScaleCategory.php 683 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace App\Models;
  3. class ScaleCategory extends SoftBaseModel
  4. {
  5. //是否投放首页
  6. const isIndexYes = 1;
  7. const isIndexNo = 0;
  8. const isIndexMap = array(
  9. self::isIndexYes => "是",
  10. self::isIndexNo => "否"
  11. );
  12. public function getPicAttribute()
  13. {
  14. return isset($this->attributes['pic']) ? config('console.pic_path').$this->attributes['pic'] : NULL;
  15. }
  16. public function getPic2Attribute()
  17. {
  18. return isset($this->attributes['pic2']) ? config('console.pic_path').$this->attributes['pic2'] : NULL;
  19. }
  20. public function Childrens()
  21. {
  22. return $this->hasMany(ScaleCategory::class, 'pid');
  23. }
  24. }