Skip to content

Commit

Permalink
Lägg till vma-länkar på vma-faq
Browse files Browse the repository at this point in the history
  • Loading branch information
bonny committed Jul 2, 2024
1 parent 539faf0 commit 5581c7a
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions app/Http/Controllers/VMAAlertsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
use Illuminate\Contracts\View;
use \Illuminate\Contracts\View\Factory as ViewFactory;

class VMAAlertsController extends Controller
{
function exampleAlerts(Request $request)
{
class VMAAlertsController extends Controller {
function exampleAlerts(Request $request) {

$json_data = '
{
Expand Down Expand Up @@ -146,13 +144,12 @@ function exampleAlerts(Request $request)
*
* @return void
*/
public static function import()
{
public static function import() {
$response = Http::get(config('app.vma_alerts_url'));
$json = $response->json();
$alerts = collect($json['alerts']);
$importedAlerts = collect();

$alerts->each(function ($alert) use ($importedAlerts) {
$alertCollection = collect($alert);

Expand Down Expand Up @@ -188,8 +185,7 @@ public static function import()
return ['importedAlerts' => $importedAlerts];
}

public function index()
{
public function index() {
$alerts = \App\Helper::getVMAAlerts();
$currentAlerts = \App\Helper::getCurrentVMAAlerts();

Expand All @@ -199,17 +195,16 @@ public function index()
$breadcrumbs->addCrumb('VMA', route("vma-overview"));

return view(
'vma-overview',
'vma-overview',
[
'alerts' => $alerts,
'alerts' => $alerts,
'currentAlerts' => $currentAlerts,
'breadcrumbs' => $breadcrumbs,
]
);
}

public function single(Request $request, string $slug)
{
public function single(Request $request, string $slug) {
$id = Str::of($slug)->explode('-')->last();
$alert = VMAAlert::findOrFail($id);
$title = $alert->getShortDescription() . " " . $alert->getDescriptionSecondLine();
Expand All @@ -218,7 +213,7 @@ public function single(Request $request, string $slug)
$breadcrumbs->setDivider('');
$breadcrumbs->addCrumb('Hem', '/');
$breadcrumbs->addCrumb('VMA', route("vma-overview"));
$breadcrumbs->addCrumb( $alert->getHumanSentDateTime() . ': ' . $alert->getDescriptionSecondLine() );
$breadcrumbs->addCrumb($alert->getHumanSentDateTime() . ': ' . $alert->getDescriptionSecondLine());

return view(
'vma-single',
Expand All @@ -231,8 +226,7 @@ public function single(Request $request, string $slug)
);
}

public function text(Request $request, string $slug)
{
public function text(Request $request, string $slug) {

$breadcrumbs = new \Creitive\Breadcrumbs\Breadcrumbs();
$breadcrumbs->setDivider('');
Expand Down Expand Up @@ -314,6 +308,14 @@ public function text(Request $request, string $slug)
- Regeringen med regeringskansliet. Alla bevakningsansvariga myndigheter. Kommuner och landsting.
- Försvarsmakten
## Var kan jag läsa eller höra mer om pågående viktiga meddelanden?
Det finns flera platser där du kan läsa eller lyssna på mer information om ett pågående VMA:
- På [Text TV sid 599](https://texttv.nu/599).
- På https://brottsplatskartan.se/vma/
- På https://sverigesradio.se/
## När testas VMA?
Signalerna **Viktigt Meddelande** och **Faran över**
Expand Down Expand Up @@ -342,10 +344,10 @@ public function text(Request $request, string $slug)
$text = Str::markdown($text ?? '');

return view(
'vma-text',
'vma-text',
[
'slug' => $slug,
'title' => $title,
'slug' => $slug,
'title' => $title,
'text' => $text,
'breadcrumbs' => $breadcrumbs,
]
Expand Down

0 comments on commit 5581c7a

Please sign in to comment.