Esempio n. 1
0
 public function outstandingRegistrationFees()
 {
     $outstandingAtLeast = Config::get('biblebowl.reminders.notify-office-of-outstanding-registration-payments-after');
     $relativeTime = $outstandingAtLeast . ' ago';
     $playersRegistrationUnpaidSince = new \Carbon\Carbon($relativeTime);
     return view('admin.groups.outstanding-registration-fees', ['unpaidSince' => $relativeTime, 'groups' => Group::hasPendingRegistrationPayments($playersRegistrationUnpaidSince)->with(['owner', 'program', 'players' => function ($q) {
         $q->orderBy('player_season.created_at', 'DESC');
         $q->limit(1);
     }])->orderBy('name', 'ASC')->get()]);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $notifyOfficeOfOutstandingPaymentsAfter = config('biblebowl.reminders.notify-office-of-outstanding-registration-payments-after');
     $relativeTime = $notifyOfficeOfOutstandingPaymentsAfter . ' ago';
     $playersRegistrationUnpaidSince = new Carbon($relativeTime);
     if (Group::hasPendingRegistrationPayments($playersRegistrationUnpaidSince)->count() > 0) {
         Mail::queue('emails.notify-office-of-outstanding-pending-payments', [], function (Message $message) {
             $message->to(Config::get('biblebowl.officeEmail'))->subject('Outstanding Registration Fees');
         });
     } else {
         Log::info('No groups have registration fees older than ' . $relativeTime);
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $remindGroupsOfPendingPaymentsAfter = config('biblebowl.reminders.remind-groups-of-pending-payments-after');
     $playersRegistrationUnpaidSince = new Carbon($remindGroupsOfPendingPaymentsAfter . ' ago');
     $groups = Group::hasPendingRegistrationPayments($playersRegistrationUnpaidSince)->get();
     foreach ($groups as $group) {
         foreach ($group->users as $user) {
             Mail::queue('emails.remind-groups-of-pending-payments', ['groupId' => $group->id], function (Message $message) use($group, $user) {
                 $message->to($user->email, $user->full_name)->subject('Registration Fee Reminder');
             });
         }
     }
 }
@extends('emails.simple')

@section('body')
    <?php 
// Serialized objects need to be re-instantiated in order
// to have a successful database connection
$outstandingAtLeast = Config::get('biblebowl.reminders.notify-office-of-outstanding-registration-payments-after');
$relativeTime = $outstandingAtLeast . ' ago';
$playersRegistrationUnpaidSince = new \Carbon\Carbon($relativeTime);
$groupCount = \BibleBowl\Group::hasPendingRegistrationPayments($playersRegistrationUnpaidSince)->count();
?>

    @include('emails.theme.header', [
        'header' => 'Outstanding Registration Fees'
    ])

    <?php 
$text = 'is <strong>' . EmailTemplate::link(url('/admin/groups/outstanding-registration-fees'), number_format($groupCount) . '</strong> group');
if ($groupCount > 1) {
    $text = 'are <strong>' . EmailTemplate::link(url('/admin/groups/outstanding-registration-fees'), number_format($groupCount) . '</strong> groups');
}
?>
    @include('emails.theme.text-block', [
        'body' => 'There '.$text.' with outstanding registration fees of at least <strong>'.$outstandingAtLeast.'</strong>.  The system has already sent several payment reminders so they may require further followup.  To avoid future notifications, they must either pay their registration fees or flag their players as "Inactive" within their player roster.'
    ])

@endsection