public function getAllApps() { $apps = App::join('categories', 'apps.category_id', '=', 'categories.id')->select('apps.id', 'apps.name', 'apps.category_id', 'apps.logo', 'apps.slogan', 'apps.introduce', 'apps.android', 'apps.ios', 'apps.download', 'apps.is_check', 'apps.created_at', 'apps.updated_at', 'categories.name as class_name')->orderBy('apps.updated_at', 'desc')->get(); foreach ($apps as $app) { $array = array(); $array[] = '<div style="white-space:nowrap;"> <button type="button" class="btn btn-success" data-toggle="modal" data-target="#saveModal" data-remark="edit">编辑</button> <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#delModal">删除</button> <input type="hidden" name="id" value="' . $app->id . '"> </div>'; $src = $app->logo ? config('app.pic_path') . $app->logo : ''; $array[] = '<img style="height:50px;width:50px" class="logo" src="' . $src . '">'; $array[] = '<span style="display:block;overflow:hidden;white-space:nowrap;">' . $app->name . '</span>'; $array[] = $app->class_name; $array[] = $app->download; $array[] = $app->is_check ? '<span style="background-color:green">已审核</span>' : '<span style="background-color:red">未审核</span>'; $array[] = $app->android; $array[] = $app->ios; $array[] = '<span style="display:block;overflow:hidden;white-space:nowrap;">' . $app->slogan . '</span>'; $array[] = '<span style="display:block;overflow:hidden;white-space:nowrap;">' . $app->introduce . '</span>'; $result[] = $array; } echo json_encode(array("success" => true, "data" => $result)); }
public static function findByTelegramUser($telegramUser) { return App::join('auths', 'auths.app_id', '=', 'apps.id')->where('auths.telegram_user_id', '=', $telegramUser->id)->where('auths.active', '=', true)->groupBy('apps.id')->get(array('apps.*')); }