CouponSlideShow.php 973 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: 17812
  5. * Date: 2020/9/16
  6. * Time: 9:48
  7. */
  8. namespace app\common\models\coupon;
  9. use app\common\models\BaseModel;
  10. class CouponSlideShow extends BaseModel
  11. {
  12. /**
  13. * @var string
  14. */
  15. protected $table = "yz_coupon_slide_show";
  16. /**
  17. * @var array
  18. */
  19. protected $guarded = [];
  20. /**
  21. * @var array
  22. */
  23. protected $appends = ['pic_url','status_name'];
  24. public function getPicUrlAttribute()
  25. {
  26. return yz_tomedia($this->attributes['slide_pic']);
  27. }
  28. public function getStatusNameAttribute()
  29. {
  30. return $this->attributes['is_show'] == 1?'显示':'隐藏';
  31. }
  32. public function rules()
  33. {
  34. return [
  35. 'title' => 'required',
  36. 'slide_pic' => 'required',
  37. ];
  38. }
  39. public function atributeNames()
  40. {
  41. return [
  42. 'title' => '标题',
  43. 'slide_pic' => '幻灯片图片',
  44. ];
  45. }
  46. }