File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ public function mount(Article $article)
3030 $ this ->slug = $ article ->slug ;
3131 $ this ->show_toc = $ article ->show_toc ;
3232 $ this ->submitted_at = $ article ->submitted_at ;
33+ $ this ->published_at = $ article ->published_at ? $ article ->publishedAt ()->format ('Y-m-d ' ) : null ;
3334 $ this ->canonical_url = $ article ->originalUrl ();
3435 $ this ->preview = $ article ->getFirstMediaUrl ('media ' );
3536 $ this ->associateTags = $ this ->tags_selected = old ('tags ' , $ article ->tags ()->pluck ('id ' )->toArray ());
@@ -66,6 +67,7 @@ public function save()
6667 'show_toc ' => $ this ->show_toc ,
6768 'canonical_url ' => $ this ->canonical_url ,
6869 'submitted_at ' => $ this ->submitted_at ,
70+ 'published_at ' => $ this ->published_at ,
6971 ]);
7072
7173 $ this ->article ->syncTags ($ this ->associateTags );
Original file line number Diff line number Diff line change @@ -199,12 +199,12 @@ public function isNotDeclined(): bool
199199
200200 public function isPublished (): bool
201201 {
202- return ! $ this ->isNotPublished ();
202+ return ! $ this ->isNotPublished () && ( $ this -> publishedAt () && $ this -> publishedAt ()-> lessThanOrEqualTo ( now ())) ;
203203 }
204204
205205 public function isNotPublished (): bool
206206 {
207- return $ this ->isNotSubmitted () || $ this ->isNotApproved ();
207+ return ( $ this ->isNotSubmitted () || $ this ->isNotApproved ()) && $ this -> published_at === null ;
208208 }
209209
210210 public function isPinned (): bool
You can’t perform that action at this time.
0 commit comments