wip
This commit is contained in:
1 parent
b0a002c7c1
commit
23cf804865
23 files changed
+283
-123
No files matched your search
@@ -10,6 +10,7 @@ use App\Models\Client;
|
||||
use App\Models\ComparingBookmaker;
|
||||
use App\Models\MultilineClient;
|
||||
use App\Models\MultilineSetting;
|
||||
use App\Models\PersonalNotification;
|
||||
use App\Models\Sport;
|
||||
use App\Models\User;
|
||||
use App\Utilities\Notice;
|
||||
@@ -178,5 +179,37 @@ class GenerateSetting
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************
|
||||
* 5) ALARM NOTIFICATION SETTINGS FOR USERS
|
||||
**************************************************/
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('5) ALARM NOTIFICATION SETTINGS FOR USERS', 'p');
|
||||
}
|
||||
|
||||
$users = User::with('client')->get();
|
||||
foreach ($users as $user) {
|
||||
if (in_array($user->id, [1, 2])) {
|
||||
$sports = Sport::where('is_active', 1)->pluck('id')->toArray();
|
||||
} else {
|
||||
$sports = Client::find($user->client_id)->value('sport');
|
||||
}
|
||||
foreach ($sports as $sport_id) {
|
||||
foreach ([2, 3] as $alarm_level_id) {
|
||||
|
||||
PersonalNotification::firstOrCreate(
|
||||
['sport_id' => $sport_id, 'user_id' => $user->id, 'bookmaker_id' => $user->bookmaker_id, 'alarm_level_id' => $alarm_level_id],
|
||||
['notify_by_system' => 0, 'notify_by_email' => 0]
|
||||
);
|
||||
|
||||
if ($user->partner_bookmaker_id) {
|
||||
PersonalNotification::firstOrCreate(
|
||||
['sport_id' => $sport_id, 'user_id' => $user->id, 'bookmaker_id' => $user->partner_bookmaker_id, 'alarm_level_id' => $alarm_level_id],
|
||||
['notify_by_system' => 0, 'notify_by_email' => 0]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user