Answer the question
In order to leave comments, you need to log in
How to make a loop execute when a user enters the site?
Good evening,
I want to implement a cycle, if a registered person visits the site, and his registration date is greater than Carbon::now() , then he will receive 10 rubles on his balance.
The bottom line is that the laravel debugger crawls out if the person is not registered, and if he is registered, then no cycle is performed.
Here is the code for demonstration:
$today = Carbon::now();
$User = Auth::user();
$information = DB::table('role_user')->where('user_id', $User->id)->first();
if($information->times >= $today)
{
DB::table('users')->where('name', $User)->update(['money' => 10]);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question