Torann / laravel-currency

This provides Laravel with currency functions such as currency formatting and conversion using up-to-date exchange rates.
http://lyften.com/projects/laravel-currency
BSD 2-Clause "Simplified" License
390 stars 137 forks source link

Calling currency:manage from controller not working #106

Closed justin22 closed 5 years ago

justin22 commented 6 years ago

I'm trying to call currency:manage add <currency> from controller but I'm getting the following exception.

Symfony \ Component \ Console \ Exception \ CommandNotFoundException
The command "currency:manage" does not exist.

Controller code Artisan::call('currency:manage', ['action' => 'add', 'currency' => 'EUR']);

dependecies

"torann/currency": "^1.0",
"laravel/framework": "5.6.*",

php artisan help currency:manage

Usage:
currency:manage <action> <currency>

Arguments:
  action                Action to perform (add, update, or delete)
  currency              Code or comma separated list of codes for currencies
semyonchetvertnyh commented 5 years ago

@justin22 You need to add the command to your $commands array in Console/Kernel.php.

Like this:

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Torann\Currency\Console\Manage as CurrencyManage;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

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