123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace Themes\kbgolf\pro\app\Http\Controllers\MyPage;
- use App\Http\Controllers\Controller;
- use App\Services\CallApiService;
- use Illuminate\Pagination\LengthAwarePaginator;
- class QnaController extends Controller
- {
- private $callApiService;
- public function __construct(CallApiService $callApiService)
- {
- $this->callApiService = $callApiService;
- }
- public function list()
- {
- $limit = (int)request('limit', 12);
- $page = (int)request('page', 1);
- $qnaPage = $this->callApiService->callApi([
- 'url' => 'list-type1-page',
- 'data' => [
- 'QueryVars' => [
- 'QueryName' => 'pro:my-page/post-list',
- 'SimpleFilter' => "post_code='faq' and mx.status != '0'",
- 'SubSimpleFilter' => "image_type = 'thumb'",
- 'IsntPagination' => false
- ],
- 'ListType1Vars' => [
- 'OrderBy' => request('sort', 'mx.created_on desc')
- ],
- 'PageVars' => [
- 'Limit' => $limit,
- 'Offset' => ($page - 1) * $limit
- ]
- ]
- ]);
- // dd($qnaPage);
- if ($this->callApiService->verifyApiError($qnaPage)) {
- notify()->error($qnaPage['body'], 'Error', 'bottomRight');
- return redirect()->back();
- }
- // dump($qnaPage);
- $qnaPage['Page'] = new LengthAwarePaginator($qnaPage['Page'], $qnaPage['PageVars']['QueryCnt'],
- $limit, $page, ['path' => request()->url()]);
- return view('views.etc.paq', compact('qnaPage'));
- }
- }
|