public function getExternalIssueInfo($id, $name) { $issue = Issue::findOrFail($id); if ($name != Str::slug($issue->name)) { abort(403); } $newsList = $issue->connectedNews()->orderBy('date', 'DESC')->paginate(10); $stakeholdersList = $issue->connectedStakeholders->chunk(10); $initiatorsList = $issue->connectedInitiatorsStakeholders->chunk(10); $dateNow = (new \DateTime())->format('Y-m-d H:i:s'); return view('frontend.external.issue', ['issue' => $issue, 'locations' => Location::all(), 'newsList' => $newsList, 'stakeholdersList' => $stakeholdersList, 'initiatorsList' => $initiatorsList, 'dateNow' => $dateNow]); }
public function getIssueInfo($id, $name) { $issue = Issue::findOrFail($id); $issueDomains = $issue->connectedDomains; if (!$issueDomains || $issueDomains->isEmpty()) { abort(403); } $allowedDomains = Domain::getUserAndPublicDomains(); $intersection = $allowedDomains->intersect($issueDomains); if (!$intersection || $intersection->isEmpty()) { abort(403); } if ($name != Str::slug($issue->name)) { abort(403); } $newsList = $issue->connectedNews()->orderBy('date', 'desc')->paginate(10); $stakeholdersList = $issue->connectedStakeholders->chunk(10); $initiatorsList = $issue->connectedInitiatorsStakeholders->chunk(10); $dateNow = (new \DateTime())->format('Y-m-d H:i:s'); return view('frontend.pages.info-issue', ['issue' => $issue, 'domain' => $issueDomains[0]->id, 'locations' => Location::all(), 'newsList' => $newsList, 'stakeholdersList' => $stakeholdersList, 'initiatorsList' => $initiatorsList, 'dateNow' => $dateNow]); }