Slide.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace app\common\models;
  3. use Illuminate\Database\Eloquent\SoftDeletes;
  4. /**
  5. * Created by PhpStorm.
  6. * Author: 芸众商城 www.yunzshop.com
  7. * Date: 2017/2/27
  8. * Time: 上午9:11
  9. */
  10. class Slide extends BaseModel
  11. {
  12. use SoftDeletes;
  13. public $table = 'yz_slide';
  14. public $attributes = ['display_order' => 0];
  15. protected $guarded = [''];
  16. protected $fillable = [''];
  17. public static function getSlidesIsEnabled()
  18. {
  19. return self::uniacid()
  20. ->where('enabled','1');
  21. }
  22. /**
  23. * 定义字段名
  24. * 可使
  25. * @return array */
  26. public function atributeNames() {
  27. return [
  28. 'slide_name'=> '幻灯片名称',
  29. 'display_order'=> '排序',
  30. 'thumb'=> '幻灯片图片',
  31. ];
  32. }
  33. /**
  34. * 字段规则
  35. * @return array */
  36. public function rules() {
  37. return [
  38. 'slide_name' => 'required',
  39. 'display_order' => 'required',
  40. 'thumb' => 'required',
  41. ];
  42. }
  43. }