12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace Themes\kbgolf\pro\app\Http\Controllers\Post;
- use App\Http\Controllers\Controller;
- use App\Services\CallApiService;
- use App\Services\PostService;
- use Illuminate\Pagination\LengthAwarePaginator;
- class StatusController extends Controller
- {
- private $callApiService;
- public function __construct(CallApiService $callApiService, PostService $iammgoService)
- {
- $this->callApiService = $callApiService;
- $this->iammgoService = $iammgoService;
- }
- public function show($id)
- {
- $limit = (int)request('limit', 10);
- $page = (int)request('page', 1);
- $postDetailsBook = $this->iammgoService->getPostDetailsBook($id, $limit, $page);
- if ($this->callApiService->verifyApiError($postDetailsBook)) {
- notify()->error($postDetailsBook['body'], 'Error', 'bottomRight');
- return redirect()->to('/');
- }
- $event = $postDetailsBook['PostDetailsPage'][0];
- if ($event['AttachedFiles']) {
- $event['AttachedFiles'] = explode('|', $event['AttachedFiles']);
- } else {
- $event['AttachedFiles'] = [];
- }
- $postDetailsBook['PostBdPage'] = new LengthAwarePaginator($postDetailsBook['PostBdPage'], $postDetailsBook['PostBdPageVars']['QueryCnt'],
- $limit, $page, ['path' => request()->url()]);
- // dd($event);
- return view('views.page.status-details', compact('event', 'postDetailsBook'))->with('codeTitle', [
- "status('post-event')",
- ]);
- }
- }
|