@@ -13,7 +13,7 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('invites', function (Blueprint $table) { |
|
16 | + Schema::create('invites', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('code')->unique(); |
19 | 19 | $table->string('for')->nullable(); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return $this; |
29 | 29 | } |
30 | 30 | |
31 | - public function for(string $email) |
|
31 | + public function for (string $email) |
|
32 | 32 | { |
33 | 33 | $this->email = $email; |
34 | 34 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | public function make() |
64 | 64 | { |
65 | - for($i = 0; $i < $this->amount; $i++) { |
|
65 | + for ($i = 0; $i < $this->amount; $i++) { |
|
66 | 66 | $this->build()->save(); |
67 | 67 | } |
68 | 68 | } |
@@ -6,5 +6,5 @@ |
||
6 | 6 | |
7 | 7 | class Invite extends Model |
8 | 8 | { |
9 | - protected $dates = ['valid_until']; |
|
9 | + protected $dates = [ 'valid_until' ]; |
|
10 | 10 | } |
@@ -32,15 +32,15 @@ |
||
32 | 32 | |
33 | 33 | protected function validateInvite(Invite $invite, $email = null) |
34 | 34 | { |
35 | - if($invite->max != 0 && $invite->uses >= $invite->max) { |
|
35 | + if ($invite->max != 0 && $invite->uses >= $invite->max) { |
|
36 | 36 | throw new MaxUsesReached; |
37 | 37 | } |
38 | 38 | |
39 | - if(!is_null($invite->valid_until) && $invite->valid_until->isPast()) { |
|
39 | + if (!is_null($invite->valid_until) && $invite->valid_until->isPast()) { |
|
40 | 40 | throw new ExpiredInviteCode; |
41 | 41 | } |
42 | 42 | |
43 | - if(!is_null($invite->for) && $invite->for != $email) { |
|
43 | + if (!is_null($invite->for) && $invite->for != $email) { |
|
44 | 44 | throw new NotYourInviteCode; |
45 | 45 | } |
46 | 46 | } |