| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | <?phpnamespace App\Http\Controllers\Mobile\Health;use App\Http\Controllers\Mobile\MobileBaseController;use App\Models\Article;use Illuminate\Http\Request;class GongzhonghaoController extends MobileBaseController{    public function index(Request $request)    {        $size = 10;        $key  = $request->get('key', '');        $where = [            ['is_display','=',1],            ['type_id','=',66],        ];        if (!empty($key)) {            $where[] = ['title','like','%'.$key.'%'];        }        $rst = Article::where($where)            ->orderBy('list_order', 'desc')            ->orderBy('id', 'desc')            ->paginate($size);        if ($request->ajax()) {            if ($rst->lastPage() < $rst->currentPage()) {                return response()->json(['status' => 0]);            }            return response()->json(['status' => 1, 'data' => view('mobile.app.health.gongzhonghao.ajax_gongzhonghao_list', ['articles' => $rst])->render()]);        }        $mobile_dropload = false;        if ($rst->total() > $size) {            $mobile_dropload = true;        }        $return_data = [            'articles'        => $rst,            'mobile_dropload' => $mobile_dropload,            'key'             => $key,        ];        return view('mobile.app.health.gongzhonghao.index', $return_data);    }}
 |