@extends('layouts.app') @section('styles') @endsection @section('content')

All Articles

@foreach($articles as $newsArticle) @php preg_match_all('/<([^>]+)>(?:([^<]+))*(?=[^>]*\<)/',$newsArticle->body,$matches); $strings = array_pop($matches); $shortDescription = ''; foreach ($strings as $string) { $string = trim(str_replace(' ', ' ', $string)); if (strlen($string) != 0){ $shortDescription .= $string; } } @endphp @php($id = Crypt::encrypt($newsArticle->id))

{{ ucwords($newsArticle->title) }}

Published: {{ human_date($newsArticle->created_at) }}

{{ ( strlen($shortDescription) > 80 )? substr($shortDescription, 0, 150).'...': $shortDescription }} @if(strlen($shortDescription) > 80 ) ... Read More @endif

@endforeach
@endsection