Cupara
Well-known member
Here is my route:
When I click the link from the Tips page, it redirects back to the main Tips page. When it was working, when I clicked a sport it would go to tips/bysport/2/ but would give an error that the action Bysport2 doesn't exist which doesn't make sense.
Here is my actionTips:
When I click the link from the Tips page, it redirects back to the main Tips page. When it was working, when I clicked a sport it would go to tips/bysport/2/ but would give an error that the action Bysport2 doesn't exist which doesn't make sense.
Here is my actionTips:
PHP:
public function actionBySport(ParameterBag $params)
{
$options = \XF::options();
$db = \XF::db();
$visitor = \XF::visitor();
$app = \XF::app();
$sportsFinder = \XF::finder('BetClever\Tipsters:Sports');
$tipsFinder = \XF::finder('BetClever\Tipsters:Tips');
$sportId = $this->assertSportExists($params->sport_id);
$page = $params->page;
$perPage = 10;
$sport = $tipsFinder->order('match_date', 'DESC')->limitByPage($page, $perPage)->where('sport_id', $sportId)->with('Events', 'User', 'Sports', 'Leagues')->fetch();
$total = $tipsFinder->total();
$maxPage = ceil($total / $perPage);
$this->assertCanonicalUrl($this->buildLink('tips/bysport', '', ['page' => $page]));
$this->assertValidPage($page, $perPage, $total, 'tips/bysport');
$sports = $sportsFinder->fetch();
$viewParams = [
'perPage' => $perPage,
'page' => $page,
'sport' => $sport,
'total' => $total,
'maxPage' => $maxPage,
'sports' => $sports
];
return $this->view('BetClever\Tipsters:View', 'bc_tips_bysport_view', $viewParams);
}