GoodsDivFrom.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /****************************************************************
  3. * Author: libaojia
  4. * Date: 2017/8/24 下午2:50
  5. * Email: livsyitian@163.com
  6. * QQ: 995265288
  7. * User: 芸众商城 www.yunzshop.com
  8. ****************************************************************/
  9. namespace app\common\models;
  10. use app\common\scopes\UniacidScope;
  11. class GoodsDivFrom extends BaseModel
  12. {
  13. protected $table = 'yz_goods_div_from';
  14. protected $guarded = [''];
  15. public $timestamps = false;
  16. public static function boot()
  17. {
  18. parent::boot();
  19. static::addGlobalScope(new UniacidScope);
  20. }
  21. public function scopeOfGoodsId($query,$goodsId)
  22. {
  23. return $query->where('goods_id',$goodsId);
  24. }
  25. /**
  26. * 字段验证规则
  27. * @return array
  28. */
  29. public function rules()
  30. {
  31. return [
  32. //'uniacid' => 'numeric|integer',
  33. //'goods_id' => 'numeric|integer',
  34. 'status' => 'regex:/^[01]$/',
  35. 'explain_title' => 'max:45/',
  36. 'explain_content' => '',
  37. ];
  38. }
  39. /**
  40. * 字段名称
  41. * @return array
  42. */
  43. public function atributeNames()
  44. {
  45. return [
  46. //'uniacid' => '',
  47. //'goods_id' => 'numeric|integer',
  48. 'status' => '表单状态',
  49. 'explain_title' => '表单规则标题',
  50. 'explain_content' => '表单规则内容',
  51. ];
  52. }
  53. }