nunomaduro / laravel-desktop-notifier

💻 Send notifications to your desktop from your Laravel Artisan Commands. An JoliNotif wrapper for Laravel.
http://nunomaduro.com
MIT License
454 stars 40 forks source link

LogicException in Command.php line 65: The command defined in "App\Http\Controllers\mycontroller" cannot have an empty name. #6

Closed ImmanuelJL closed 7 years ago

ImmanuelJL commented 7 years ago

Hello, i try to install and get this error:

LogicException in Command.php line 65: The command defined in "App\Http\Controllers\mycontroller" cannot have an empty name.

Here my full code:

namespace App\Http\Controllers;

use Illuminate\Console\Command; use NunoMaduro\LaravelDesktopNotifier\Notifications;

class mycontroller extends Command { use Notifications;

public function handle()
{
    $this->notify('Hello Web Artisan', 'Love beautiful code? We do too!');
}

}

Did i do something wrong? Any way thanks for this good package

nunomaduro commented 7 years ago

Hey 👋

Thanks for notice that potencial issue. I will be able to verify it only after my holidays on 20/08!

ImmanuelJL commented 7 years ago

Okayyy bro...

nunomaduro commented 7 years ago

Hey @ImmanuelJL,

On the code you provided you forgot to include the properties signature/name and description.

Example:

class Zonda extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'zonda';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';
nunomaduro commented 7 years ago

Try it and tell me if it works.

nunomaduro commented 7 years ago

@ImmanuelJL I am closing this for lack of response.

bacancy-keyur commented 6 years ago

The "Name" property should be written along with signature like in the extension to the @nunomaduro's sample,

class MergeTable extends Command
{

    /**
     * The console command name.
     *
     * @var string
     */
    protected $name = "merge-table";

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = "merge-table";

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = "Command description";

This solved my problem in Laravel 5.0, Not sure about the above versions.