[ 'name'=>'首页轮播', 'pos'=>'index_top', ], 'index_middle'=>[ 'name'=>'首页中间位置', 'pos'=>'index_middle', ], ]; protected $readonly=[]; public static function getAd($pos=null){ $q=self::order('sort','desc'); if($pos){ $q->where('pos',$pos); } return $q->select(); } protected static function init() { self::beforeInsert(function (self $ad){ $ad['admin_id']=$_SERVER['admin']['id']; }); } /** * @return string[] */ public static function getPos(): array { return self::$pos; } }