@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public static function models(bool $onlySingles = false, Model $ignoredModel = null, $online = true) |
| 63 | 63 | { |
| 64 | - $models = chiefMemoize('all-online-models', function () use ($onlySingles, $online) { |
|
| 64 | + $models = chiefMemoize('all-online-models', function() use ($onlySingles, $online) { |
|
| 65 | 65 | $builder = UrlRecord::whereNull('redirect_id') |
| 66 | 66 | ->select('model_type', 'model_id') |
| 67 | 67 | ->groupBy('model_type', 'model_id'); |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | $builder->where('model_type', 'singles'); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - return $builder->get()->mapToGroups(function ($record) { |
|
| 73 | + return $builder->get()->mapToGroups(function($record) { |
|
| 74 | 74 | return [$record->model_type => $record->model_id]; |
| 75 | - })->map(function ($record, $key) { |
|
| 75 | + })->map(function($record, $key) { |
|
| 76 | 76 | return Morphables::instance($key)->find($record->toArray()); |
| 77 | - })->map->reject(function ($model) use ($online) { |
|
| 77 | + })->map->reject(function($model) use ($online) { |
|
| 78 | 78 | if ($online) { |
| 79 | 79 | return is_null($model) || !$model->isPublished(); |
| 80 | 80 | } // Invalid references to archived or removed models where url record still exists. |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | }, [$onlySingles]); |
| 85 | 85 | |
| 86 | 86 | if ($ignoredModel) { |
| 87 | - $models = $models->reject(function ($model) use ($ignoredModel) { |
|
| 87 | + $models = $models->reject(function($model) use ($ignoredModel) { |
|
| 88 | 88 | return (get_class($model) === get_class($ignoredModel) && $model->id === $ignoredModel->id); |
| 89 | 89 | }); |
| 90 | 90 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | if ($item->ofType(static::TYPE_INTERNAL) && $page = $item->page) { |
| 103 | 103 | if ($page->isArchived()) { |
| 104 | 104 | unset($items[$k]); |
| 105 | - } else { |
|
| 105 | + }else { |
|
| 106 | 106 | $item->url = self::composePageUrl($item, $page); |
| 107 | 107 | $item->page_label = $page->menuLabel(); |
| 108 | 108 | $item->hidden_in_menu = $page->hidden_in_menu; |
@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public function entry(Node $node) |
| 149 | 149 | { |
| 150 | - return (object) [ |
|
| 150 | + return (object)[ |
|
| 151 | 151 | 'id' => $node->id, |
| 152 | 152 | 'type' => $node->type, |
| 153 | 153 | 'label' => $node->label, |
| 154 | - 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
| 154 | + 'page_label' => $node->page_label, // Extra info when dealing with internal links |
|
| 155 | 155 | 'url' => $node->url, |
| 156 | 156 | 'order' => $node->order, |
| 157 | 157 | 'page_id' => $node->page_id, |
@@ -20,11 +20,11 @@ |
||
| 20 | 20 | return redirect('/'); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if (! $request->user()->hasRole($role)) { |
|
| 23 | + if (!$request->user()->hasRole($role)) { |
|
| 24 | 24 | abort(403); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if (! $request->user()->can($permission)) { |
|
| 27 | + if (!$request->user()->can($permission)) { |
|
| 28 | 28 | abort(403); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | if (!$this->auth->user() || !$this->authorize('update-squanto')) { |
| 42 | 42 | if ($request->ajax()) { |
| 43 | 43 | return response('Unauthorized.', 401); |
| 44 | - } else { |
|
| 44 | + }else { |
|
| 45 | 45 | return redirect()->guest('admin/login'); |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | return redirect('/'); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - if (! $request->user()->can($permission)) { |
|
| 23 | + if (!$request->user()->can($permission)) { |
|
| 24 | 24 | abort(403); |
| 25 | 25 | } |
| 26 | 26 | |
@@ -18,18 +18,18 @@ |
||
| 18 | 18 | public function handle($request, Closure $next) |
| 19 | 19 | { |
| 20 | 20 | // Verifies a valid signature and still outside expiration period |
| 21 | - if (! $request->hasValidSignature()) { |
|
| 21 | + if (!$request->hasValidSignature()) { |
|
| 22 | 22 | return redirect()->route('invite.expired'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if (! $invitation = Invitation::findByToken($request->token)) { |
|
| 25 | + if (!$invitation = Invitation::findByToken($request->token)) { |
|
| 26 | 26 | return redirect()->route('invite.expired'); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if (in_array($invitation->state(), [InvitationState::ACCEPTED, InvitationState::REVOKED])) { |
| 30 | 30 | |
| 31 | 31 | // We allow the user to pass if the invitee is already logged in. Otherwise the invite link cannot be reused. |
| 32 | - if (! auth()->guard('chief')->check() || ! auth()->guard('chief')->user()->is($invitation->invitee)) { |
|
| 32 | + if (!auth()->guard('chief')->check() || !auth()->guard('chief')->user()->is($invitation->invitee)) { |
|
| 33 | 33 | return redirect()->route('invite.expired'); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -12,12 +12,12 @@ |
||
| 12 | 12 | { |
| 13 | 13 | $optimizerChain = app(OptimizerChain::class); |
| 14 | 14 | |
| 15 | - collect($request->allFiles())->each(function ($file) use ($optimizerChain) { |
|
| 15 | + collect($request->allFiles())->each(function($file) use ($optimizerChain) { |
|
| 16 | 16 | if (is_array($file)) { |
| 17 | - collect($file)->each(function ($media) use ($optimizerChain) { |
|
| 17 | + collect($file)->each(function($media) use ($optimizerChain) { |
|
| 18 | 18 | $optimizerChain->optimize($media->getPathname()); |
| 19 | 19 | }); |
| 20 | - } else { |
|
| 20 | + }else { |
|
| 21 | 21 | $optimizerChain->optimize($file->getPathname()); |
| 22 | 22 | } |
| 23 | 23 | }); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | public function handle($request, Closure $next) |
| 20 | 20 | { |
| 21 | - if (! $request->user() || ! $request->session()) { |
|
| 21 | + if (!$request->user() || !$request->session()) { |
|
| 22 | 22 | return $next($request); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - if (! $request->session()->has('password_hash')) { |
|
| 33 | + if (!$request->session()->has('password_hash')) { |
|
| 34 | 34 | $this->storePasswordHashInSession($request); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $this->logout($request); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - return tap($next($request), function () use ($request) { |
|
| 41 | + return tap($next($request), function() use ($request) { |
|
| 42 | 42 | $this->storePasswordHashInSession($request); |
| 43 | 43 | }); |
| 44 | 44 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function storePasswordHashInSession($request) |
| 53 | 53 | { |
| 54 | - if (! $request->user()) { |
|
| 54 | + if (!$request->user()) { |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -19,9 +19,9 @@ |
||
| 19 | 19 | $offset = $request->query()['offset'] ?? $offset; |
| 20 | 20 | $excluded = isset($request->query()['excluded']) ? explode(",", $request->query()['excluded']) : $excluded; |
| 21 | 21 | |
| 22 | - $links = Asset::with('media')->orderBy('created_at', 'DESC')->whereNotIn('id', $excluded)->whereHas('media', function (Builder $query) { |
|
| 22 | + $links = Asset::with('media')->orderBy('created_at', 'DESC')->whereNotIn('id', $excluded)->whereHas('media', function(Builder $query) { |
|
| 23 | 23 | $query->where('mime_type', 'LIKE', '%image%'); |
| 24 | - })->offset($offset)->limit($limit)->get()->map(function ($asset) { |
|
| 24 | + })->offset($offset)->limit($limit)->get()->map(function($asset) { |
|
| 25 | 25 | return [ |
| 26 | 26 | "id" => $asset->id, |
| 27 | 27 | "url" => $asset->url(), |