Skip to content

Instantly share code, notes, and snippets.

@edgrosvenor
Created January 30, 2021 16:15
Show Gist options
  • Save edgrosvenor/7d3b8cf264dfd1bfe4139cceaef47775 to your computer and use it in GitHub Desktop.
Save edgrosvenor/7d3b8cf264dfd1bfe4139cceaef47775 to your computer and use it in GitHub Desktop.
oku yen to usd artisan command
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class OkuCalculator extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'oku:usd {oku} {exchange?}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$exchange = $this->argument('exchange') ?? 0.0096; // As of 1/30/21
$yen = 100 * 1000 * 1000 * $this->argument('oku');
$dollars = $exchange * $yen;
$this->info($this->argument('oku') . ' OKU YEN is equal to ' . number_format($dollars, 2). ' dollars.');
return 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment