Closed zanechua closed 7 years ago
@zanechua
Notice that the above code is not using the facade so kindly confirm your use statement at the head of your class is something like this:
use Edujugon\PushNotification\PushNotification;
And no like this:
use Edujugon\PushNotification\Facades\PushNotification;
@zanechua
If you prefer using Facade, you could do something like this:
PushNotification::setService('fcm')
->setMessage([
'notification' => [
'title'=>'This is the title',
'body'=>'This is the message',
'sound' => 'default'
],
'data' => [
'extraPayLoad1' => 'value1',
'extraPayLoad2' => 'value2'
]
])
->setApiKey('Server-API-Key')
->setDevicesToken(['deviceToken1','deviceToken2','deviceToken3'...])
->send()
->getFeedback();
In that case, yeah, you should use the follow statement:
use Edujugon\PushNotification\Facades\PushNotification;
ah. It needs to import the class directly?
Usually when i import packages, I usually just do
use PushNotification;
Does this not work here?
If you want to use Facade, you should set this statement:
use Edujugon\PushNotification\Facades\PushNotification;
As you already know, Facade provides a "static" interface to the class that is available in the application's service container.
Otherwise, if you prefer no to use Facade, then you have to set the below statement:
use Edujugon\PushNotification\PushNotification;
Let me know if the change made it works
ah I see. Thanks @Edujugon !
I'll stick with the Pure Facade Method. Cheers!
Sorry for having to create another issue so quick but i can't seem to utilise the package if I declare an instance of the facade.
Having the above code will throw the following error: