From a0cb23668c7cba0b676f36de4b934352c9526396 Mon Sep 17 00:00:00 2001 From: Mohamed Jinas Date: Fri, 14 Aug 2020 03:31:57 +0500 Subject: [PATCH] Date Parse --- app/Article.php | 9 +++++++++ resources/views/articles/show.blade.php | 2 +- resources/views/topics/show.blade.php | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/Article.php b/app/Article.php index 1bf6314..20f99f8 100644 --- a/app/Article.php +++ b/app/Article.php @@ -32,6 +32,15 @@ class Article extends Model */ protected $guarded = []; + /** + * The attributes that should be mutated to dates. + * + * @var array + */ + protected $dates = [ + 'published_date', + ]; + /** * The attributes that should be cast. diff --git a/resources/views/articles/show.blade.php b/resources/views/articles/show.blade.php index deca654..b11dadf 100644 --- a/resources/views/articles/show.blade.php +++ b/resources/views/articles/show.blade.php @@ -29,7 +29,7 @@

{{$article->source->name}}

-

{{$article->published_date}}

+

{{$article->published_date->locale('dv')->isoFormat('Do MMMM YYYY | dddd | h:mm')}}

diff --git a/resources/views/topics/show.blade.php b/resources/views/topics/show.blade.php index 993f516..76ce795 100644 --- a/resources/views/topics/show.blade.php +++ b/resources/views/topics/show.blade.php @@ -3,7 +3,7 @@ @section('content')
-
+