@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create(config('magiclink.magiclink_table', 'magic_links'), function (Blueprint $table) { |
|
| 16 | + Schema::create(config('magiclink.magiclink_table', 'magic_links'), function(Blueprint $table) { |
|
| 17 | 17 | $table->uuid('id')->primary(); |
| 18 | 18 | $table->string('token', 255); |
| 19 | 19 | $table->text('action'); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::table('magic_links', function (Blueprint $table) { |
|
| 16 | + Schema::table('magic_links', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('access_code')->nullable(); |
| 18 | 18 | }); |
| 19 | 19 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | public function down() |
| 27 | 27 | { |
| 28 | 28 | if (Schema::hasColumn('magic_links', 'access_code')) { |
| 29 | - Schema::table('magic_links', function (Blueprint $table) { |
|
| 29 | + Schema::table('magic_links', function(Blueprint $table) { |
|
| 30 | 30 | $table->dropColumn('access_code'); |
| 31 | 31 | }); |
| 32 | 32 | } |
@@ -85,7 +85,7 @@ |
||
| 85 | 85 | { |
| 86 | 86 | $accessCodeCookies = request()->cookie($this->cookieName); |
| 87 | 87 | |
| 88 | - if (! $accessCodeCookies) { |
|
| 88 | + if ( ! $accessCodeCookies) { |
|
| 89 | 89 | return null; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | public function __construct(string $path, ?string $name = null, array $headers = []) |
| 23 | 23 | { |
| 24 | 24 | $this->path = $path; |
| 25 | - if (! is_null($name)) { |
|
| 25 | + if ( ! is_null($name)) { |
|
| 26 | 26 | $this->name($name); |
| 27 | 27 | } |
| 28 | 28 | $this->headers($headers); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::table('magic_links', function (Blueprint $table) { |
|
| 16 | + Schema::table('magic_links', function(Blueprint $table) { |
|
| 17 | 17 | $table->index('available_at'); |
| 18 | 18 | $table->index('max_visits'); |
| 19 | 19 | }); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function down() |
| 28 | 28 | { |
| 29 | - Schema::table('magic_links', function (Blueprint $table) { |
|
| 29 | + Schema::table('magic_links', function(Blueprint $table) { |
|
| 30 | 30 | $table->dropIndex('magic_links_available_at_index'); |
| 31 | 31 | $table->dropIndex('magic_links_max_visits_index'); |
| 32 | 32 | }); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | return response()->noContent($magicLink ? 200 : 404); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if (! $magicLink) { |
|
| 22 | + if ( ! $magicLink) { |
|
| 23 | 23 | return $this->badResponse(); |
| 24 | 24 | } |
| 25 | 25 | |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | [ |
| 7 | 7 | 'middleware' => config('magiclink.middlewares'), |
| 8 | 8 | ], |
| 9 | - function () { |
|
| 9 | + function() { |
|
| 10 | 10 | Route::get( |
| 11 | 11 | config('magiclink.url.validate_path', 'magiclink').'/{token}', |
| 12 | 12 | 'MagicLink\Controllers\MagicLinkController@access' |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $rateLimit = config('magiclink.rate_limit', 100); |
| 30 | 30 | |
| 31 | - RateLimiter::for( |
|
| 31 | + RateLimiter::for ( |
|
| 32 | 32 | 'magiclink', |
| 33 | 33 | fn () => $rateLimit === 'none' |
| 34 | 34 | ? Limit::none() |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | private function offerPublishing(): void |
| 56 | 56 | { |
| 57 | - if (! $this->app->runningInConsole()) { |
|
| 57 | + if ( ! $this->app->runningInConsole()) { |
|
| 58 | 58 | return; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | parent::boot(); |
| 46 | 46 | |
| 47 | - static::creating(function ($model) { |
|
| 47 | + static::creating(function($model) { |
|
| 48 | 48 | $model->id = Str::uuid(); |
| 49 | 49 | }); |
| 50 | 50 | } |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | public function baseUrl(?string $baseUrl): self |
| 76 | 76 | { |
| 77 | - $this->attributes['base_url'] = rtrim($baseUrl, '/') . '/'; |
|
| 77 | + $this->attributes['base_url'] = rtrim($baseUrl, '/').'/'; |
|
| 78 | 78 | |
| 79 | 79 | return $this; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function getUrlAttribute(): string |
| 83 | 83 | { |
| 84 | - $baseUrl = rtrim($this->attributes['base_url'] ?? '', '/') . '/'; // Use the stored base_url or an empty string |
|
| 84 | + $baseUrl = rtrim($this->attributes['base_url'] ?? '', '/').'/'; // Use the stored base_url or an empty string |
|
| 85 | 85 | |
| 86 | 86 | return url(sprintf( |
| 87 | 87 | '%s%s/%s%s%s', |
@@ -176,12 +176,12 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | return static::where('id', $tokenId) |
| 178 | 178 | ->where('token', $tokenSecret) |
| 179 | - ->where(function ($query) { |
|
| 179 | + ->where(function($query) { |
|
| 180 | 180 | $query |
| 181 | 181 | ->whereNull('available_at') |
| 182 | 182 | ->orWhere('available_at', '>=', Carbon::now()); |
| 183 | 183 | }) |
| 184 | - ->where(function ($query) { |
|
| 184 | + ->where(function($query) { |
|
| 185 | 185 | $query |
| 186 | 186 | ->whereNull('max_visits') |
| 187 | 187 | ->orWhereRaw('max_visits > num_visits'); |
@@ -215,10 +215,10 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public static function deleteMagicLinkExpired() |
| 217 | 217 | { |
| 218 | - $query = MagicLink::where(function ($query) { |
|
| 218 | + $query = MagicLink::where(function($query) { |
|
| 219 | 219 | $query |
| 220 | 220 | ->where('available_at', '<', Carbon::now()) |
| 221 | - ->orWhere(function ($query) { |
|
| 221 | + ->orWhere(function($query) { |
|
| 222 | 222 | $query |
| 223 | 223 | ->whereNotNull('max_visits') |
| 224 | 224 | ->whereRaw('max_visits <= num_visits'); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | |
| 235 | - $query->get()->each(function (MagicLink $magiclink) { |
|
| 235 | + $query->get()->each(function(MagicLink $magiclink) { |
|
| 236 | 236 | $magiclink->delete(); |
| 237 | 237 | |
| 238 | 238 | event(new MagicLinkWasDeleted($magiclink)); |