nunomaduro / laravel-desktop-notifier

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

Usage instructions not clear #22

Open Echecivuole opened 3 years ago

Echecivuole commented 3 years ago

Hello! Very nice package, but can you better explain in step by step what to do after package is installed? Tutorial with commands and files to be edited will help many developers. thanks!

owenvoke commented 3 years ago

Hmm. I think it's quite clear from the example This package just adds a $this->notify() method to commands, which is demonstrated in the README. Any specific changes you'd like to have?

I guess perhaps a sentence about the $this->notify() command being added might help, and which parameters are available.

Echecivuole commented 3 years ago

Sorry but I am not big expert in Controller. What to do if I want to run the notification into the homepage, through the HomeController? do you have to add any use Notifications/ in the controller file? if I just add $this->notify() code into home function I get error for not defined nofity

thanks

owenvoke commented 3 years ago

You can't use it in a controller, as it's a command macro. 👍🏻 Also, it wouldn't work in a web route as it's designed for command-line usage (in Artisan).

https://github.com/nunomaduro/laravel-desktop-notifier/blob/c0ddf9b187d18efb12869abc0e4f4e86c150e0e6/src/LaravelDesktopNotifierServiceProvider.php#L39

Thanks, I'll update the docs with a better section on usage.

owenvoke commented 3 years ago

I've updated the docs as part of v2.5.1, does that make it clearer?

shailesh-ladumor commented 3 years ago

I install this package and created one command. here is my command

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class Notifying extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'notify:test';

    /**
     * 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()
    {
        $this->notify('Hello Web Artisan', 'Love beautiful code? We do too!');
    }
}

I try to fire command from a terminal. command run successfully but notification is not getting.

Please help if any thing is wrong

owenvoke commented 3 years ago

@shailesh-ladumor, just to check, what OS are you using?

shailesh-ladumor commented 3 years ago

@shailesh-ladumor, just to check, what OS are you using?

OS: Window10

PHP 7.4.9 (cli)

composer

 "require": {
        "php": "^7.2.5|^8.0",
        "fideloper/proxy": "^4.4",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^6.3.1|^7.0.1",
        "lab404/laravel-impersonate": "^1.7",
        "laravel/framework": "^7.29",
        "laravel/tinker": "^2.5",
        "laravel/ui": "^2.4",
        "nunomaduro/laravel-desktop-notifier": "^2.5"
    },

does this help? @owenvoke

owenvoke commented 3 years ago

I wonder if this is related to: https://github.com/jolicode/JoliNotif/issues/70 and https://github.com/jolicode/JoliNotif/issues/45.

IIRC, Toaster doesn't really work on Windows 10, so I was working on a Snoretoast adapter but not much has been done with it.