davibennun / laravel-push-notification

Laravel package to enable sending push notifications to devices
1.23k stars 260 forks source link

Not found class laravel 5.1 and 5.2 #114

Open elysiopires opened 8 years ago

elysiopires commented 8 years ago

Hello,

I'm trying to install on laravel 5.1 and 5.2 but when I execute php artisan vendor:publish I got error class not defined.

Could you help me?

Thx in advance.

abhijeetnaik commented 8 years ago

Hi,

Please check if you have added the following in config/app.php and then try to execute php artisan vendor:publish :-

PushNotification service provider 'providers' => array( 'Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider' )

AND

PushNotification facade

'aliases' => array( ... 'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification' )

Thanks, Abhijeet Naik Founder, www.pattypets.com

elysiopires commented 8 years ago

Hello I added the lines:

providers' => Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider::class,

AND

PushNotification facade

'aliases' => 'PushNotification' => 'Davibennun\LaravelPushNotification\Facades\PushNotification::class

elysiopires commented 8 years ago

Hello I added the lines:

providers' => [Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider::class,]

AND

PushNotification facade

'aliases' => ['PushNotification' => Davibennun\LaravelPushNotification\Facades\PushNotification::class]

But still not working...

abhijeetnaik commented 8 years ago

Hi, please do a composer update in your command line, and see if there are any errors, if yes please share a screen shot of app.php where you added these lines and composer.json file.

Thanks, if you want we can get on Skype, i would love to help :)

elysiopires commented 8 years ago

Hi,

Here is my app.php: 'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Foundation\Providers\ArtisanServiceProvider::class,
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Routing\ControllerServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    Illuminate\Html\HtmlServiceProvider::class,
    Davibennun\LaravelPushNotification\LaravelPushNotificationServiceProvider::class,
    /*
     * Application Service Providers...
     */
    App\Providers\AppServiceProvider::class,
    App\Providers\AuthServiceProvider::class,
    App\Providers\EventServiceProvider::class,
    App\Providers\RouteServiceProvider::class,
],

/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/

'aliases' => [

    'App'       => Illuminate\Support\Facades\App::class,
    'Artisan'   => Illuminate\Support\Facades\Artisan::class,
    'Auth'      => Illuminate\Support\Facades\Auth::class,
    'Blade'     => Illuminate\Support\Facades\Blade::class,
    'Bus'       => Illuminate\Support\Facades\Bus::class,
    'Cache'     => Illuminate\Support\Facades\Cache::class,
    'Config'    => Illuminate\Support\Facades\Config::class,
    'Cookie'    => Illuminate\Support\Facades\Cookie::class,
    'Crypt'     => Illuminate\Support\Facades\Crypt::class,
    'DB'        => Illuminate\Support\Facades\DB::class,
    'Eloquent'  => Illuminate\Database\Eloquent\Model::class,
    'Event'     => Illuminate\Support\Facades\Event::class,
    'File'      => Illuminate\Support\Facades\File::class,
    'Gate'      => Illuminate\Support\Facades\Gate::class,
    'Hash'      => Illuminate\Support\Facades\Hash::class,
    'Input'     => Illuminate\Support\Facades\Input::class,
    'Inspiring' => Illuminate\Foundation\Inspiring::class,
    'Lang'      => Illuminate\Support\Facades\Lang::class,
    'Log'       => Illuminate\Support\Facades\Log::class,
    'Mail'      => Illuminate\Support\Facades\Mail::class,
    'Password'  => Illuminate\Support\Facades\Password::class,
    'Queue'     => Illuminate\Support\Facades\Queue::class,
    'Redirect'  => Illuminate\Support\Facades\Redirect::class,
    'Redis'     => Illuminate\Support\Facades\Redis::class,
    'Request'   => Illuminate\Support\Facades\Request::class,
    'Response'  => Illuminate\Support\Facades\Response::class,
    'Route'     => Illuminate\Support\Facades\Route::class,
    'Schema'    => Illuminate\Support\Facades\Schema::class,
    'Session'   => Illuminate\Support\Facades\Session::class,
    'Storage'   => Illuminate\Support\Facades\Storage::class,
    'URL'       => Illuminate\Support\Facades\URL::class,
    'Validator' => Illuminate\Support\Facades\Validator::class,
    'View'      => Illuminate\Support\Facades\View::class,
    'Form'      => Illuminate\Html\FormFacade::class,
    'Html'      => Illuminate\Html\HtmlFacade::class,
    'PushNotification' => Davibennun\LaravelPushNotification\Facades\PushNotification::class,
],

Here is my composer.json: { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "type": "project", "require": { "php": ">=5.5.9", "laravel/framework": "5.1.", "jacopo/laravel-authentication-acl": "1.3.", "laravelcollective/html": "5.1.", "illuminate/html": "^5.0", "league/flysystem-aws-s3-v3": "^1.0", "davibennun/laravel-push-notification": "dev-laravel5" }, "require-dev": { "fzaninotto/faker": "~1.4", "mockery/mockery": "0.9.", "phpunit/phpunit": "~4.0", "phpspec/phpspec": "~2.1" },

My Skype is elysio.pires14

I like to talk to solve this problem.

Thank you, Elysio

Afhzal commented 8 years ago

I am having the same issue...

feber commented 8 years ago

solved it by adding

use PushNotification;
pankajthakur007 commented 8 years ago

Which file i can add use PushNotification;

feber commented 8 years ago

Just add use PushNotification because it's already registered in aliases.

webpriest commented 8 years ago

Laravel 5.3 has just been released, but has also withdrawn my sleep. PushNotifications has been my obstacle after running 'composer update' to update all dependencies. The alias and provider are set in 'config/app.php'. In which file could I place the use PushNotification ?

davibennun commented 8 years ago

@webpriest Does Laravel 5.3 changes something on how service providers are loaded?

webpriest commented 8 years ago

I suppose, because I get this error each time [Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Illuminate\Notifications\NotificationServiceProvider' not found Last I checked, I found that LaravelPushNotification is required, so I used composer to require it, but still didn't work. But @feber mentioned that he solve it by adding use PushNotification, so I'm wondering where to put that. Thanks davidbennun

davibennun commented 8 years ago

Have you added the correct paths to providers and alias array? Once that is one you can you the facade normally

anilkumar201241 commented 7 years ago

Hello I am Anil, I am getting the same issue "davibennun/laravel-push-notification class not found". Can anybody help me

ajaykucse commented 7 years ago

which file edit, where i put use PushNotification;

feber commented 7 years ago

@webpriest @anilkumar201241 @ajaykucse11 my apologize for the slow response. I put use PushNotification; in controller which responsible to send the messages.

ajaykucse commented 7 years ago

@feber not fixed error
[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Illuminate\Notifications\NotificationServiceProvider' not found

ajaykucse commented 7 years ago

[Symfony\Component\Debug\Exception\FatalThrowableError] Class 'Illuminate\Notifications\NotificationServiceProvider' not found how to fixed it anyone plz help me i did everything given here but i don't fixed it.

kevosomi commented 6 years ago

@ajaykucse11 Did you find a solution? Stuck with that problem too

ghost commented 6 years ago

Have the same problem here... Want to upgrade from V.3 to V.4

This is what I get:

<MyDevice>:/var/snipeit# php artisan migrate
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Illuminate\Notifications\NotificationServiceProvider' not found

PLEASE HELP...

PortionLK commented 5 years ago

This is because the upgraded version has no notification package included in framework.

So there are two ways you can fix this:

  1. If your project doesnt need it or you still have not used that in any controller, just remove Illuminate\Notifications\NotificationServiceProvider::class, line in your providers array in config/app.php file
  2. If you have used it or you think you will need it, then copy and paste Notification folder from old laravel framework to new framework: vendor/laravel/framework/src/ is the location where Notification folder exist.