coinwind/app/Console/Commands/CoinInit.php

51 lines
977 B
PHP

<?php
namespace App\Console\Commands;
use App\Http\Controllers\ApiV1Controller;
use Illuminate\Support\Facades\Log;
use Illuminate\Console\Command;
class CoinInit extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'coin:init';
/**
* The console command description.
*
* @var string
*/
protected $description = 'init every thing need by this project.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// insert ETH price
$this->refresh_eth_cache();
$price = (new ApiV1Controller())->get_cache_eth_price();
if ($price <= 0) {
Log::warning("cache ETH price failed.");
}
}
}