Scale.php 542 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Models;
  3. class Scale extends SoftBaseModel
  4. {
  5. protected $casts = ['comment_tag'=>'array'];
  6. protected $fillable = [
  7. 'title',
  8. 'pic',
  9. 'third_id',
  10. 'comment_tag',
  11. 'rank',
  12. 'second_id'
  13. ];
  14. public function getPicAttribute()
  15. {
  16. return isset($this->attributes['pic']) ? config('console.pic_path').$this->attributes['pic'] : NULL;
  17. }
  18. public function thirdScale(){
  19. return $this->belongsTo(ThirdScale::class, 'third_id', 'id');
  20. }
  21. }