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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -