diff --git a/app/Console/Commands/GoldPriceUpdate.php b/app/Console/Commands/GoldPriceUpdate.php index 86f1b3c..3f216d4 100644 --- a/app/Console/Commands/GoldPriceUpdate.php +++ b/app/Console/Commands/GoldPriceUpdate.php @@ -31,14 +31,11 @@ class GoldPriceUpdate extends Command public function handle() { // - - echo 'start'; $client = new Client(); $response = $client->request('GET', $this->api); $data = json_decode($response->getBody()->getContents()); - print_r($data); +// print_r($data); if (isset($data->gold)) { - $s = Setting::where('key', 'gold')->first(); $s->value = $data->gold; $s->save(); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f5c6967..55c1c49 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; use App\Console\Commands\AssetsBuild; +use App\Console\Commands\GoldPriceUpdate; use App\Helpers\TDate; use App\Http\Middleware\Acl; use App\Models\Area; @@ -24,6 +25,7 @@ class AppServiceProvider extends ServiceProvider $this->commands([ TranslatorCommand::class, AssetsBuild::class, + GoldPriceUpdate::class, ]); foreach (config('xshop.payment.gateways') as $gateway){ /** @var \App\Contracts\Payment $gateway */ diff --git a/routes/console.php b/routes/console.php index 97980bd..f465b57 100644 --- a/routes/console.php +++ b/routes/console.php @@ -2,10 +2,10 @@ use Illuminate\Foundation\Inspiring; use Illuminate\Support\Facades\Artisan; - +use \Illuminate\Support\Facades\Schedule; Artisan::command('inspire', function () { $this->comment(Inspiring::quote()); })->purpose('Display an inspiring quote')->hourly(); -Artisan::command('gold', function () {})->everyFiveMinutes(); +Schedule::command('gold')->everyFiveMinutes();