PluginsMealModel.php 808 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\platform\modules\pluginsSetMeal\models;
  3. use app\common\models\BaseModel;
  4. class PluginsMealModel extends BaseModel
  5. {
  6. protected $table = 'yz_plugins_meal';
  7. protected $fillable = ['order_by','name','plugins','state'];
  8. // 获取插件套餐数据,并返回套餐插件的数量
  9. public function getPluginsMealList($id = null)
  10. {
  11. $list = self::select('id', 'name', 'plugins', 'order_by','state');
  12. if ($id){
  13. $list = $list->where('id',$id);
  14. }
  15. $list = $list->orderBy('order_by', 'DESC')
  16. ->get()
  17. ->toArray();
  18. foreach ($list as &$item) {
  19. $item['plugins'] = explode(',', $item['plugins']);
  20. $item['count'] = count($item['plugins']);
  21. }
  22. return $list;
  23. }
  24. }