Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PHP-LARAVEL be published on this date

I want a share that I created and saved in the database to be activated from passive on a certain date. I couldn’t find the most correct way to do this.

How should I code this?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Set a date in a ‘publish_at’ column on the database.

When you query the database to show items, you can include a where statement so that only items that are publish_at in the past are displayed.

For instance, if this were a Post model;

$posts = Post::where('publish_at', '<', now())->get();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading