Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined class OneSignal #20

Closed
bardiaabasirad opened this issue Jan 11, 2017 · 16 comments
Closed

Undefined class OneSignal #20

bardiaabasirad opened this issue Jan 11, 2017 · 16 comments

Comments

@bardiaabasirad
Copy link

bardiaabasirad commented Jan 11, 2017

Undefined class OneSignal

OneSignal::sendNotificationToAll("Some Message");

I added this codes to config/app.php

'providers' => [ // ... Berkayk\OneSignal\OneSignalServiceProvider::class, ];

and

'aliases' => [ // ... 'OneSignal' => Berkayk\OneSignal\OneSignalFacade::class, ];

Also i run this command

php artisan config:clear
php artisan config:cache

But Undefined class OneSignal, i run composer dumpauto command and this worked. I use phpStorm, now i must typed methods name full and phpStorm doesn't complete method names.

@berkayk
Copy link
Owner

berkayk commented Jan 31, 2017

I didn't understand your question. Is it working or not?

@kossa
Copy link
Contributor

kossa commented Jan 31, 2017

@ahadabasi , you should add use OneSignal; at the top of your file ;)

@bardiaabasirad
Copy link
Author

Thanks, by add "use OneSignal" this is working.

@kossa
Copy link
Contributor

kossa commented Feb 5, 2017

@ahadabasi you can close the issue :)

@cygelman
Copy link

cygelman commented May 6, 2018

Hi!
Still getting this error.

"use OneSignal" does not work:
The use statement with non-compound name 'OneSignal' has no effect less... (Ctrl+F1)
The use statement with non-compound name has no effect.

@manojrammurthy
Copy link

i am getting Call to undefined function Berkayk\OneSignal\tap()
any reason for this

@jerearaujo03
Copy link

did you solve it?

@kossa
Copy link
Contributor

kossa commented Dec 20, 2018

add "use OneSignal" this is working.

@jerearaujo03
Copy link

Yes, I added, but it's not working!

I'm getting:
[Symfony\Component\Debug\Exception\FatalThrowableError] Call to undefined function Berkayk\OneSignal\tap()

@jerearaujo03
Copy link

I think it's because I'm working on 5.2, and tap helper is included in Laravel 5.4+.
Is there a workaround for 5.3- ?

@jerearaujo03
Copy link

I made a workaround, is making a helper function

function tap($value, $callback)
{
    $callback($value);
 
    return $value;
}

@siddiqdeveloper
Copy link

siddiqdeveloper commented Sep 10, 2019

function tap($value, $callback)
{
$callback($value);
return $value;
}
Add this code in vendor\berkayk\onesignal-laravel\src\OneSignalClient.php line : 86

@Alaa-OmarAlshobaki
Copy link

function tap($value, $callback)
{
$callback($value);
return $value;
}
Add this code in vendor\berkayk\onesignal-laravel\src\OneSignalClient.php line : 86
I added, but it's not working!

@fabioselau077
Copy link

same here... Undefined type 'OneSignal'.

@davide-granello
Copy link

Same here!

I have this error in VSCode: Undefined type 'OneSignal'.intelephense(P1009)

use OneSignal;

class SendPushNotification implements ShouldQueue
{

     // ...

     public function handle(): void
     {
         OneSignal::sendNotificationToSegment(
         "Test message with custom heading and subtitle",
         "Testers",
         null,
         null,
         null,
         null,
         "Custom Heading",
         "Custom subtitle"
         );
     }

}

@berkayk can this issue be reopened? Or can you provide a solution/suggestions?
Thanks

@davide-granello
Copy link

Same here!

I have this error in VSCode: Undefined type 'OneSignal'.intelephense(P1009)

use OneSignal;

class SendPushNotification implements ShouldQueue
{

     // ...

     public function handle(): void
     {
         OneSignal::sendNotificationToSegment(
         "Test message with custom heading and subtitle",
         "Testers",
         null,
         null,
         null,
         null,
         "Custom Heading",
         "Custom subtitle"
         );
     }

}

@berkayk can this issue be reopened? Or can you provide a solution/suggestions? Thanks

Pull request #153 solves this! Please merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants