| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 | <?phpnamespace App\Http\Controllers\Mobile\Ic;use App\Http\Controllers\Mobile\MobileBaseController;use App\Models\Article;use Illuminate\Http\Request;class AttractController extends MobileBaseController{    public function index(Request $request)    {        $size = 5;        $key  = $request->get('key', '');        $where = [            ['is_display','=',1],            ['type_id','=',67],        ];        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.ic.attract.ajax_attract_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.ic.attract.index', $return_data);    }    public function show(Request $request)    {        $id   = $request->get('id', 0);        $info = Article::where('id', $id)->first();        return view('mobile.app.ic.attract.show', ['info' => $info]);    }}
 |