-
Notifications
You must be signed in to change notification settings - Fork 4
/
Kernel.php
67 lines (58 loc) · 1.84 KB
/
Kernel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace App\Console;
use App\Mail\NotifyAdminNoDevices;
use App\Notifications\NotifyAdminNoDevices as Mail;
use App\Party;
use App\User;
use Carbon\Carbon;
use App\Helpers\Fixometer;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Notification;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function () {
$parties = Party::doesnthave('devices')
->where('event_date', '>=', date('Y-m-d', strtotime(Carbon::now()->subDays(env('NO_DATA_ENTERED', 5)))))
->where('event_date', '<=', date('Y-m-d', strtotime(Carbon::now())))
->get();
foreach ($parties as $party) {
$all_admins = Fixometer::usersWhoHavePreference('admin-no-devices');
Notification::send($all_admins, new Mail([
'event_venue' => $party->venue,
'event_url' => url('/party/edit/'.$party->idevents),
]));
}
})->cron('0 0 */3 * *');
$schedule->command('sync:discourseusernames')
->daily()
->sendOutputTo(storage_path().'/logs/discourse_usernames.log')
->emailOutputTo(env('SEND_COMMAND_LOGS_TO'), 'tech@therestartproject.org');
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}