@@ -41,14 +41,14 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function handle() |
| 43 | 43 | { |
| 44 | - $email = $this->argument('email') ? : null; |
|
| 44 | + $email = $this->argument('email') ?: null; |
|
| 45 | 45 | $code = $this->argument('code'); |
| 46 | 46 | |
| 47 | 47 | try { |
| 48 | 48 | LaravelInvites::check($code, $email); |
| 49 | 49 | $this->info('This code is valid'); |
| 50 | 50 | } |
| 51 | - catch(LaravelInvitesException $e) |
|
| 51 | + catch (LaravelInvitesException $e) |
|
| 52 | 52 | { |
| 53 | 53 | $this->error($e->getMessage()); |
| 54 | 54 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | 'code' => (string) $this->invite->code |
| 40 | 40 | ]; |
| 41 | 41 | |
| 42 | - if($this->invite->valid_upto) |
|
| 42 | + if ($this->invite->valid_upto) |
|
| 43 | 43 | { |
| 44 | 44 | $url = URL::temporarySignedRoute('laravelinvites.routes.follow', $this->invite->valid_upto, $data); |
| 45 | 45 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create(config('laravelinvites.table'), function (Blueprint $table) { |
|
| 16 | + Schema::create(config('laravelinvites.table'), function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->string('email')->nullable()->unique(); |
| 19 | 19 | $table->string('code')->unique(); |
@@ -37,13 +37,13 @@ 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)) |
|
| 40 | + if ($this->used_count >= $this->allowed_count && config('laravelinvites.delete_on_full', true)) |
|
| 41 | 41 | $this->delete(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function scopeValid($query) |
| 45 | 45 | { |
| 46 | - return $query->where('valid_from','<=', now()) |
|
| 46 | + return $query->where('valid_from', '<=', now()) |
|
| 47 | 47 | ->where('valid_upto', '>=', now()) |
| 48 | 48 | ->whereRaw('allowed_count > used_count'); |
| 49 | 49 | } |
@@ -59,13 +59,13 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | private function setDefaultExpiry() |
| 61 | 61 | { |
| 62 | - if(config('laravelinvites.expiry.type')==='none') |
|
| 62 | + if (config('laravelinvites.expiry.type') === 'none') |
|
| 63 | 63 | return null; |
| 64 | 64 | |
| 65 | - if(config('laravelinvites.expiry.type') === 'hours') |
|
| 65 | + if (config('laravelinvites.expiry.type') === 'hours') |
|
| 66 | 66 | return now()->addHours(config('laravelinvites.expiry.value')); |
| 67 | 67 | |
| 68 | - elseif(config('laravelinvites.expiry.type') === "days") |
|
| 68 | + elseif (config('laravelinvites.expiry.type') === "days") |
|
| 69 | 69 | return now()->addDays(config('laravelinvites.expiry.days')); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function __construct($email, $valid_email) |
| 10 | 10 | { |
| 11 | - if($email) |
|
| 11 | + if ($email) |
|
| 12 | 12 | parent::__construct("This invitation code is not valid with this $email"); |
| 13 | 13 | else |
| 14 | 14 | parent::__construct("This invitation code is valid only for $valid_email"); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public function handle() |
| 46 | 46 | { |
| 47 | - $email = $this->argument('email') ? : null; |
|
| 47 | + $email = $this->argument('email') ?: null; |
|
| 48 | 48 | $allow = $this->option('allow'); |
| 49 | 49 | $count = $this->option('count'); |
| 50 | 50 | $hours = (int) $this->option('hours'); |
@@ -52,17 +52,17 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | try |
| 54 | 54 | { |
| 55 | - $invite = LaravelInvites::for($email)->allow($allow); |
|
| 55 | + $invite = LaravelInvites::for ($email)->allow($allow); |
|
| 56 | 56 | |
| 57 | - if($days) |
|
| 57 | + if ($days) |
|
| 58 | 58 | $invite->setExpiry(now()->addDays($days)); |
| 59 | - else if($hours) |
|
| 59 | + else if ($hours) |
|
| 60 | 60 | $invite->setExpiry(now()->addHours($hours)); |
| 61 | 61 | |
| 62 | 62 | $invite->generate($count); |
| 63 | 63 | |
| 64 | 64 | $this->info($count." invitations generated."); |
| 65 | - } catch(\Exception $e) |
|
| 65 | + } catch (\Exception $e) |
|
| 66 | 66 | { |
| 67 | 67 | $this->error($e->getMessage()); |
| 68 | 68 | } |