php - Send notification from laravel store function -


i have notification system send posts telegram channel created.

this source: https://github.com/laravel-notification-channels/telegram

my notification system works fine , issue have cannot correct post link, send notification once post has created postcontroller under store function.

i have code after $post->save();

$post = \app\post::first(); $post->notify(new \app\notifications\postpublished($post)); 

as can see send post id 1 telegram channel tried find(1) , got same result.

my question now: how same post created send channel?

code: $post = \app\post::first(); first row in posts table

it means first row in table

you dont need use after $post->save();

just send notification without using $post = \app\post::first(); after save

for example:

$post->save(); $post->notify(new \app\notifications\postpublished($post)); 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -