예제 #1
0
 public function handle(Login $login)
 {
     // skip when an admin is logging in as this user
     if (!Session::canSwitchToAdmin()) {
         $login->user->updateLastLogin();
     }
     // current session is the most recent
     Session::setSeason(Season::current()->first());
     // if user is a coach set current "Group" upon login
     if ($login->user->isA(Role::HEAD_COACH) && $login->user->groups->count() > 0) {
         Session::setGroup($login->user->groups->first());
     }
 }
예제 #2
0
 /**
  * @test
  */
 public function guardianCantAlwaysEditBirthday()
 {
     /** @var Player $player */
     $player = $this->guardian->players()->first();
     $player->birthday = Carbon::now()->format('m/d/Y');
     $this->assertTrue($player->seasons()->count() == 0);
     // admins can edit
     $user = Mockery::mock(User::class);
     $user->shouldReceive('isA')->andReturn(true);
     $this->assertTrue($player->isBirthdayEditable($user));
     $user = Mockery::mock(User::class);
     $user->shouldReceive('isA')->andReturn(false);
     // can't edit after a few months
     $player->created_at = Carbon::now()->subMonths(4)->subDays(2);
     $this->assertFalse($player->isBirthdayEditable($user));
     // can't edit after first season
     $player->created_at = Carbon::now();
     Season::current()->first()->players()->attach($player->id, ['grade' => '11', 'shirt_size' => 'M', 'group_id' => 1]);
     $this->assertTrue($player->isBirthdayEditable($user));
 }
@extends('emails.simple')

@section('body')
    <?php 
// Serialized objects need to be re-instantiated in order
// to have a successful database connection
$group = \BibleBowl\Group::findOrFail($groupId);
$season = \BibleBowl\Season::current()->first();
$players = $group->players()->pendingRegistrationPayment($season)->get();
$bulletedList = '';
foreach ($players as $player) {
    $bulletedList .= '<li>' . $player->full_name . '</li>';
}
?>

    @include('emails.theme.header', [
        'header' => 'Registration Fee Reminder'
    ])

    @include('emails.theme.text-block', [
        'body' => '<p><strong>'.$group->name.'</strong> has <strong>'.count($players).'</strong> player(s) with outstanding '.$group->program->name.' registration fees.  Please '.EmailTemplate::link(url('/'), 'login to your Bible Bowl account').' and click "Pay Now" to pay their fees.</p>'
    ])

    @include('emails.theme.text-block', [
        'body' => '<p>Players are more than welcome to try out Bible Bowl for a brief period.  If they try it out and decide not to play, please login and mark them as "Inactive" in your '.EmailTemplate::link(url('/roster'), 'player roster').' to avoid future emails.</p>'
    ])

    @include('emails.theme.text-block', [
        'body' => "<p>Here's a list of players with outstanding fees:</p><ul>".$bulletedList.'</ul>'
    ])
@endsection
예제 #4
0
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(User::class, function (Generator $faker) {
    return ['status' => User::STATUS_CONFIRMED, 'first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => $faker->email, 'phone' => $faker->phoneNumber, 'password' => str_random(10), 'remember_token' => str_random(10)];
});
$factory->define(Player::class, function (Generator $faker) {
    return ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'gender' => rand(0, 1) ? 'M' : 'F', 'birthday' => $faker->dateTimeBetween('-18 years', '-9 years')->format('m/d/Y')];
});
$factory->define(Address::class, function (Generator $faker) {
    return ['name' => 'Home', 'address_one' => $faker->buildingNumber . ' ' . $faker->streetName . ' ' . $faker->streetSuffix, 'address_two' => rand(0, 5) ? $faker->secondaryAddress : null, 'latitude' => $faker->latitude, 'longitude' => $faker->longitude, 'city' => $faker->city, 'state' => $faker->stateAbbr, 'zip_code' => $faker->postcode];
});
$factory->define(Tournament::class, function (Generator $faker) {
    return ['name' => $faker->word, 'program_id' => Program::TEEN, 'season_id' => Season::current()->id, 'start' => Carbon::now()->addMonth(1), 'end' => Carbon::now()->addDays(14), 'registration_start' => Carbon::now()->subMonth(1), 'registration_end' => Carbon::now()->subDays(14), 'creator_id' => User::where('email', DatabaseSeeder::DIRECTOR_EMAIL)->first()->id];
});
/**
 * @return User
 */
function seedGuardian($attrs = [], $addressAttrs = [])
{
    $address = factory(Address::class)->create($addressAttrs);
    $attrs['primary_address_id'] = $address->id;
    $user = factory(User::class)->create($attrs);
    $address->user_id = $user->id;
    $address->save();
    $role = Role::where('name', Role::GUARDIAN)->firstOrFail();
    $user->assign($role);
    return $user;
}
 /**
  * Show the parent/guardian a summary of their registration.
  *
  * @return \Illuminate\View\View
  */
 public function summary()
 {
     return view('seasons.registration.summary')->withSeason(Season::current()->first())->withRegistration(Session::seasonalGroupRegistration());
 }