Esempio n. 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire(AutomatedGroupDeactivator $groupDeactivator)
 {
     /** @var Carbon $endDate */
     $endDate = Setting::seasonEnd();
     /** @var Carbon $startDate */
     $startDate = Setting::seasonStart();
     $nextSeasonName = $startDate->format('Y-') . $startDate->addYear()->format('y');
     // notify the office before the season rotates
     $rotateInDays = 7;
     if ($endDate->isBirthday(Carbon::now()->addDays($rotateInDays))) {
         Mail::queue('emails.season-rotate-notification', ['willRotateOn' => $endDate->toFormattedDateString(), 'nextSeasonName' => $nextSeasonName, 'programs' => Program::orderBy('name', 'ASC')->get()], function (Message $message) use($nextSeasonName, $rotateInDays) {
             $message->to(config('biblebowl.officeEmail'))->subject('The ' . $nextSeasonName . ' season begins in ' . $rotateInDays . ' days');
         });
     }
     // rotate the season
     if ($endDate->isBirthday()) {
         /* @var Season $season */
         Season::firstOrCreate(['name' => $nextSeasonName]);
         // since the season rotated today, deactivate inactive groups from last season
         $lastSeason = Season::orderBy('id', 'DESC')->skip(1)->first();
         $groupDeactivator->deactivateInactiveGroups($lastSeason);
     }
 }
@extends('emails.simple')

@section('body')
    <?php 
// Serialized objects need to be re-instantiated in order
// to have a successful database connection
$programs = \BibleBowl\Program::orderBy('name', 'ASC')->get();
?>

    @include('emails.theme.header', [
        'header' => 'Automatically Deactivated Groups'
    ])

    @include('emails.theme.text-block', [
        'body' => '<p>Groups automatically become inactive when they end a season without any active players.  This time, <strong>'.count($groupIds).'</strong> met the criteria.  They have already been notified as well as provided instructions on how to reactivate their group or transfer the group ownership to another individual.  There\'s nothing you need to do, this is merely a notification that the following groups are now inactive.</p>'
    ])

    @foreach($programs as $program)
        <?php 
$groups = \BibleBowl\Group::whereIn('id', $groupIds)->where('program_id', $program->id)->with('owner')->get();
?>
        @if($groups->count() > 0)
            <?php 
$bulletedList = '';
foreach ($groups as $group) {
    $bulletedList .= '<li>' . $group->name . ' (' . $group->owner->full_name . ')</li>';
}
?>
            @include('emails.theme.text-block', [
                'body' => "<h4>".$program->name."</h4><ul>".$bulletedList.'</ul>'
            ])
Esempio n. 3
0
 /**
  * @param Request $request
  *
  * @return \Illuminate\View\View
  */
 public function edit(Request $request)
 {
     return view('admin.settings')->with('seasonEnd', Setting::seasonEnd())->with('programs', Program::orderBy('name', 'ASC')->get());
 }