Hi guys, is there a better way to MarkAsRead laravel database notifications?

|
2019-09-18 00:54:45
not error
2019-09-18 00:54:53
just not send email
daemon_coder 2019-09-18 00:56:09
2019-09-18 00:54:53
just not send email

check ur laravel logs, or jst give it some time,,, it will get dilevered

2019-09-18 00:57:00
this wok
2019-09-18 00:57:14
very thank
2019-09-18 00:57:26
just mument for sending gmail
praneet81 2019-09-18 01:51:23
laravel_discuss-13349.jpg
Can anyone tell why am i getting this error on vscode?
praneet81 2019-09-18 02:14:34
No turns out Try is a reserved keyword it takes it as try and catch i changed the model name and error was gone
skys215 2019-09-18 04:01:55
praneet81 2019-09-18 01:51:23
Can anyone tell why am i getting this error on vscode?

Try is a protected keyword

skys215 2019-09-18 04:02:19
Used in try{ } catch( ){ }
skys215 2019-09-18 04:58:44
Or called reseverd keyword?
I don’t remember what does it call in English
2019-09-18 08:30:24
2019-09-18 00:57:14
very thank

khodeto jer nade inja bia gruh farsi hast
https://t.me/joinchat/AleVnDxDn-zmLCxPyV8UMw

2019-09-18 08:31:02
Hi 🙂
2019-09-18 08:31:24
I don’t have a question
2019-09-18 08:31:36
i’m still learning Laravel,
rebory 2019-09-18 08:39:59
2019-09-17 21:34:14
Hello guys,

How can I push a variable from blade to controller?

Simply put value in hidden input or receive in controller like $request->input_name

2019-09-18 09:06:12
rebory 2019-09-18 08:39:59
Simply put value in hidden input or receive in controller like $request->input_name

That is what I did but it is not working,

Do I have to put a submit button?

2019-09-18 09:32:12
I lnow but I am asking if it is necessary
2019-09-18 09:34:31
No I dont, what I need is to carry a value to the controller
2019-09-18 09:42:07
Let me try to work on your Idea, those I have done the same, may be there is a problem somewhere. I have to review
2019-09-18 09:42:36
But thanks @Rattone
rebory 2019-09-18 09:49:22
2019-09-18 09:42:36
But thanks @Rattone

laravel_discuss-13382.jpg

2019-09-18 09:57:43
laravel_discuss-13383.jpg

2019-09-18 09:58:56
I was trying to see whats wrong here
2019-09-18 10:01:12
No, I have a list of users, so when I click on a user I want to see their details, their IDs can be accessed through the $userView->id variable
2019-09-18 10:02:33
I can see the ID in the blade file and they are displaying correctly, now I want to use the same varible in a different controller
2019-09-18 10:02:55
Ok letme check the docs
2019-09-18 10:29:12
Good idea
2019-09-18 10:41:28
Okay
crazycaw 2019-09-18 10:47:53
its a bad practice to end an ajax php function with die.. no?
crazycaw 2019-09-18 10:48:14
now I need to call an “ajax php function” inside my controller and ends the execution.. so.. I suppose yea
crazycaw 2019-09-18 10:54:29
nothing it’s necessary! 🙂 I ask for the ideal practice
SM_NHosseini 2019-09-18 11:28:20
hi guys, is there a better way to MarkAsRead laravel database notifications ?
SM_NHosseini 2019-09-18 11:28:57
when there are large number of database notification this method crash and server will go away. :
SM_NHosseini 2019-09-18 11:29:10
$user->unreadNotifications->markAsRead();
2019-09-18 11:34:21
SM_NHosseini 2019-09-18 11:28:57
when there are large number of database notification this method crash and server will go away. :

what’s the error ? RAM Exhausted?

2019-09-18 11:35:10
if you get blank page i dont thik it’s a crash
SM_NHosseini 2019-09-18 11:38:28
2019-09-18 11:34:21
what’s the error ? RAM Exhausted?

I think, it says server gone away.

SM_NHosseini 2019-09-18 11:38:45
or sometimes 504 bad gateway
SM_NHosseini 2019-09-18 11:39:36
it’s not logical to MarkAsRead for example 2000 unreadnotification in one request!
2019-09-18 11:40:38
SM_NHosseini 2019-09-18 11:39:36
it’s not logical to MarkAsRead for example 2000 unreadnotification in one request!

make sure the $user point to one user, you trying markAsRead notification for “one” user, how much a user can have notificaiton to crash your server?

2019-09-18 11:42:02
When a user click on notification icon/button you trying to markAs read them right ? why would there is 2000 unread notifcation from one user?
SM_NHosseini 2019-09-18 11:44:40
2019-09-18 11:40:38
make sure the $user point to one user, you trying markAsRead notification for “one” user, how much a user can have notificaiton to crash your server?

it’s single user but because it’s and operator user it get’s lots of notification

SM_NHosseini 2019-09-18 11:45:17
I thought It’s better to use default laravel methods.
SM_NHosseini 2019-09-18 11:47:39
may be I didn’t read carefully, this is what I’ve been using from the docs :

$user = User::find(Auth()->id());
$user->unreadNotifications->markAsRead();

SM_NHosseini 2019-09-18 11:49:45
yeah, I agree 🙏 but still the method you pointed out, takes time to be done. compare to raw query inside mysql
SM_NHosseini 2019-09-18 11:51:18
yeah, I couldn’t find anything about mass MarkAsRead either
SM_NHosseini 2019-09-18 11:52:01
a nice efficient way to mark as read large number of unread database notification
SM_NHosseini 2019-09-18 11:57:41
looks like it is the only way.👍
R_IT_Geek 2019-09-18 13:32:03
hi ✋🏻

my output, in the picture below, how do I read in the Ajax success method?

|