@extends("app.layout.base") @section("content")
@foreach($news as $new) @if($new->type == 'News')
News:
{{ $new->subname }}
@if($new->resource_id !== null)
@endif
{!! $new->content !!}
@elseif($new->type == 'Menu')
Menuplan:
{{ $new->subname }}
@if($new->resource_id !== null)
@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
@elseif($new->type == 'Activity')
Aktiviteter:
{{ $new->subname }}
@if($new->resource_id !== null)
@endif
{{ \Illuminate\Support\Facades\Date::createFromTimeStamp(strtotime(\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->date))->format('d/m/Y \k\l\. H:i') }} | {{\App\Event::query()->where('id', '=', $new->arrangement_id)->first()->accountable}}
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!}
@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')}}
@else
Vejledninger:
{{ $new->subname }}
@if($new->resource_id !== null)
@endif
{!! \App\Helpers::closetags(substr($new->content, 0, 300) ) !!} @if ($new->type == 'Guide') {{-- 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 --}}
@endif @endforeach @if(count(\App\News::query()->orderBy("created_at", "desc")->get()) == 0)

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

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