Closed diadal closed 4 years ago
$messaging = app('firebase.messaging');
not working Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App\Http\Controllers\CloudMessage' not found
$messaging = app('firebase.messaging');
$message = CloudMessage::withTarget('token', $id)
->withNotification(Notification::create('testing', 'working ok'))
->withData(['test' => 'value']);
$m = $messaging->send($message);
return [$m];
``
You didn‘t
use Kreait\Firebase\Messaging\CloudMessage;
no am only following the readme file try make some little samples for laravel like this use Kreait\Firebase\Messaging\CloudMessage;
now this Symfony\Component\Debug\Exception\FatalThrowableError: Class 'App\Http\Controllers\Notification' not found
please which of the Notification needed
Please read the documentation at https://firebase-php.readthedocs.io/
How to create notifications (includes the use statement): https://firebase-php.readthedocs.io/en/stable/cloud-messaging.html#adding-a-notification
How to create cloud messages (includes the use statement): https://firebase-php.readthedocs.io/en/stable/cloud-messaging.html#getting-started
The only difference between the direct usage of the SDK and this package is that you don‘t need to invoke the SDK‘s factory to instantiate the components.
So, instead of writing
$messaging = (new Factory)->withServiceAccount('...')->createMessaging();
you can write
$messaging = app('firebase.messaging');
The same with all other components. After that, you‘ll find everything you need in the docs linked above.
working now use Kreait\Firebase\Messaging\Notification;
thanks for your time
try to make samples of Laravel calls none of this working
ymfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method Kreait\Firebase\Messaging::createMessaging()