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)
30
30
$ this ->slug = $ article ->slug ;
31
31
$ this ->show_toc = $ article ->show_toc ;
32
32
$ this ->submitted_at = $ article ->submitted_at ;
33
+ $ this ->published_at = $ article ->published_at ? $ article ->publishedAt ()->format ('Y-m-d ' ) : null ;
33
34
$ this ->canonical_url = $ article ->originalUrl ();
34
35
$ this ->preview = $ article ->getFirstMediaUrl ('media ' );
35
36
$ this ->associateTags = $ this ->tags_selected = old ('tags ' , $ article ->tags ()->pluck ('id ' )->toArray ());
@@ -66,6 +67,7 @@ public function save()
66
67
'show_toc ' => $ this ->show_toc ,
67
68
'canonical_url ' => $ this ->canonical_url ,
68
69
'submitted_at ' => $ this ->submitted_at ,
70
+ 'published_at ' => $ this ->published_at ,
69
71
]);
70
72
71
73
$ this ->article ->syncTags ($ this ->associateTags );
Original file line number Diff line number Diff line change @@ -199,12 +199,12 @@ public function isNotDeclined(): bool
199
199
200
200
public function isPublished (): bool
201
201
{
202
- return ! $ this ->isNotPublished ();
202
+ return ! $ this ->isNotPublished () && ( $ this -> publishedAt () && $ this -> publishedAt ()-> lessThanOrEqualTo ( now ())) ;
203
203
}
204
204
205
205
public function isNotPublished (): bool
206
206
{
207
- return $ this ->isNotSubmitted () || $ this ->isNotApproved ();
207
+ return ( $ this ->isNotSubmitted () || $ this ->isNotApproved ()) && $ this -> published_at === null ;
208
208
}
209
209
210
210
public function isPinned (): bool
You can’t perform that action at this time.
0 commit comments