@extends("app.layout.base") @section("content")
@foreach(\App\News::query()->orderBy("created_at", "desc")->get() as $new)
@if($new->resource_id !== null)

{{ $new->name }}

{{ $new->subname }}

@else

{{ $new->name }}

{{ $new->subname }}

@endif
@if ($new->type_id == 1 || $new->type_id == 2) {{-- If it's a news or menu then display the whole message --}} {!! $new->content !!} @else {{-- If it's a menu, guide or event. Then display up to 300 characters of text --}} {!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!} @endif @if ($new->type_id == 3) {{-- If it's displaying an event, then show `Tilmeld`, `Læs mere` & `Se deltagere` --}}
@if (count(\App\UserEvent::query()->where('event_id', '=', $new->arrangement_id)->where('user_id', '=', Auth::user()->id)->get()) > 0) {{__('msg.afmeld')}} @else {{-- ^ If you're already participating in the event, then show a ´cancel´ button - v Else show a ´participate´ button --}} {{__('msg.tilmeld')}} @endif $new->arrangement_id ])}}">{{__('msg.læsmere')}} $new->arrangement_id ])}}">{{__('msg.sedeltagere')}}
@elseif ($new->type_id == 4) {{-- Else if's displaying guides, then show `Læs mere` --}} @endif {{-- Else if it's a menu or news, then don't show a button at bottom --}}
@endforeach @if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)

{{__('msg.ingennyheder')}}

@endif
@endsection @section("scripts") @endsection