79681732

Date: 2025-06-27 09:49:33
Score: 1
Natty:
Report link

I know it's been a while since the original question was asked, but I spent more time than I probably should have figuring this out myself... so I thought I'd share.

Task scheduling really is the way to go here, but you might have trouble when you play things out on production – because Laravel throws a confirmation warning when you run db:seed in production environments:

A screenshot of the command line with a warning reading "APPLICATION IN PRODUCTION." and a confirmation prompt of yes / no to the question, "Are you sure you want to run this command?"

That throws a wrench in things when you try to run it via the scheduler.

The trick is to use --force, but obviously, make sure you really want to do this on production — the confirmation's there for a reason, after all:

use Illuminate\Support\Facades\Schedule;

Schedule::command('db:seed ApiPlayerStatisticsSeeder --force')
    ->daily();

(And by the way, logging the output can be really helpful when you're debugging.)

Reasons:
  • Blacklisted phrase (1): I know it's been
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
Posted by: Justin Russell