About.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/3/4
  6. * Time: 上午9:25
  7. */
  8. namespace common\models;
  9. class About extends Common
  10. {
  11. public function rules()
  12. {
  13. return [
  14. [['company','contact'],'required','message'=>'{attribute}不能为空'],
  15. [['aptitude','copyright'],'string']
  16. ];
  17. }
  18. public function attributeLabels()
  19. {
  20. return [
  21. 'company'=>'公司简介',
  22. 'aptitude'=>'资质荣誉',
  23. 'contact'=>'关于我们',
  24. 'copyright'=>'版权声明'
  25. ];
  26. }
  27. public function getList()
  28. {
  29. $query = self::find();
  30. // $query->andWhere(['del'=>$this->setDel]);
  31. $query->orderBy(['create_at'=>SORT_DESC]);
  32. $query->asArray();
  33. return $query->all();
  34. }
  35. /*
  36. * 调用里面的验证,错误返回数组,正确返回对象
  37. * */
  38. public function Authenticator($input)
  39. {
  40. $this->load($input,'');
  41. if(!$this->validate()) return $this->errors;
  42. return $this;
  43. }
  44. public function FindById($id)
  45. {
  46. return self::findOne($id);
  47. }
  48. }