jeudi 20 octobre 2016

Request URL using Laravel Task Scheduling

Environment

  • Laravel Version : 5.1.45 (LTS)

  • PHP Version : 5.6.1


Description

I'm trying to hit a certain route every minute.


Attempt

I've tried

$schedule->exec('curl '.env('APP_URL').'fbwifi/acl_update')->everyMinute()
        ->sendOutputTo(public_path().'/tasks/log.txt');


Kernel.php

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        \App\Console\Commands\Inspire::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->exec('curl '.env('APP_URL').'fbwifi/acl_update')->everyMinute()
        ->sendOutputTo(public_path().'/tasks/log.txt');
    }
}


Is what I did is the best way to make a GET to a route ? or is there a better way I should look into ?


I'm opening to any suggestions at this moment.

Any hints / suggestions / helps on this be will be much appreciated !



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire