Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pirvanmarian's avatar

Schelduling for Request

Hi , i have a rest api who : take data from Json, put it in DB, display it from DB.

I must scheldul the Request at a interval of x day: If i have a row who updated that 5 days, i must do request and retake request and get json data :

This my Sintax for check if a row is that older that 5 day , in controller : class class MController extends Controller {

  $company = Company::where('NameCompany', $Data['Data']['NameCompany'])
        ->where('updated_at', '<=', Carbon::now()->subDays(1)->toDateString())
        ->first();

In kernel class Kernel extends ConsoleKernel { /** * The Artisan commands provided by your application. * * @var array */ protected $commands = [ //Commands\Inspire::class, // Commands\Custom::class, Commands\Updatedb::class, Commands\saveCompany::class ]; protected function schedule(Schedule $schedule) {

    $schedule->call('App\Http\Controllers\MainController@main')->everyMinute();

in commands i have updatedb.php

0 likes
0 replies

Please or to participate in this conversation.