@@ -8,9 +8,10 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function __construct($email, $valid_email) |
| 10 | 10 | { |
| 11 | - if ($email) |
|
| 12 | - parent::__construct("This invitation code is not valid with this $email"); |
|
| 13 | - else |
|
| 14 | - parent::__construct("This invitation code is valid only for $valid_email"); |
|
| 11 | + if ($email) { |
|
| 12 | + parent::__construct("This invitation code is not valid with this $email"); |
|
| 13 | + } else { |
|
| 14 | + parent::__construct("This invitation code is valid only for $valid_email"); |
|
| 15 | + } |
|
| 15 | 16 | } |
| 16 | 17 | } |
@@ -47,8 +47,7 @@ |
||
| 47 | 47 | try { |
| 48 | 48 | LaravelInvites::check($code, $email); |
| 49 | 49 | $this->info('This code is valid'); |
| 50 | - } |
|
| 51 | - catch (LaravelInvitesException $e) |
|
| 50 | + } catch (LaravelInvitesException $e) |
|
| 52 | 51 | { |
| 53 | 52 | $this->error($e->getMessage()); |
| 54 | 53 | } |
@@ -52,12 +52,15 @@ |
||
| 52 | 52 | |
| 53 | 53 | try |
| 54 | 54 | { |
| 55 | - $invite = LaravelInvites::for ($email)->allow($allow); |
|
| 55 | + $invite = LaravelInvites::for ($email) { |
|
| 56 | + ->allow($allow); |
|
| 57 | + } |
|
| 56 | 58 | |
| 57 | - if ($days) |
|
| 58 | - $invite->setExpiry(now()->addDays($days)); |
|
| 59 | - else if ($hours) |
|
| 60 | - $invite->setExpiry(now()->addHours($hours)); |
|
| 59 | + if ($days) { |
|
| 60 | + $invite->setExpiry(now()->addDays($days)); |
|
| 61 | + } else if ($hours) { |
|
| 62 | + $invite->setExpiry(now()->addHours($hours)); |
|
| 63 | + } |
|
| 61 | 64 | |
| 62 | 65 | $invite->generate($count); |
| 63 | 66 | |
@@ -37,8 +37,9 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $this->increment('used_count'); |
| 39 | 39 | |
| 40 | - if ($this->used_count >= $this->allowed_count && config('laravelinvites.delete_on_full', true)) |
|
| 41 | - $this->delete(); |
|
| 40 | + if ($this->used_count >= $this->allowed_count && config('laravelinvites.delete_on_full', true)) { |
|
| 41 | + $this->delete(); |
|
| 42 | + } |
|
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | public function scopeValid($query) |
@@ -59,13 +60,14 @@ discard block |
||
| 59 | 60 | */ |
| 60 | 61 | private function setDefaultExpiry() |
| 61 | 62 | { |
| 62 | - if (config('laravelinvites.expiry.type') === 'none') |
|
| 63 | - return null; |
|
| 63 | + if (config('laravelinvites.expiry.type') === 'none') { |
|
| 64 | + return null; |
|
| 65 | + } |
|
| 64 | 66 | |
| 65 | - if (config('laravelinvites.expiry.type') === 'hours') |
|
| 66 | - return now()->addHours(config('laravelinvites.expiry.value')); |
|
| 67 | - |
|
| 68 | - elseif (config('laravelinvites.expiry.type') === "days") |
|
| 69 | - return now()->addDays(config('laravelinvites.expiry.days')); |
|
| 67 | + if (config('laravelinvites.expiry.type') === 'hours') { |
|
| 68 | + return now()->addHours(config('laravelinvites.expiry.value')); |
|
| 69 | + } elseif (config('laravelinvites.expiry.type') === "days") { |
|
| 70 | + return now()->addDays(config('laravelinvites.expiry.days')); |
|
| 71 | + } |
|
| 70 | 72 | } |
| 71 | 73 | } |
| 72 | 74 | \ No newline at end of file |