From d19bb4f2ea06ecb37157b47f116cbb85fe17e0a3 Mon Sep 17 00:00:00 2001 From: Roardom Date: Thu, 22 Jun 2023 09:49:25 +0000 Subject: [PATCH] refactor: swap `auth()->user()->id` to `auth()->id()` --- app/Http/Controllers/SimilarTorrentController.php | 2 +- app/Http/Livewire/Comment.php | 4 ++-- app/Http/Livewire/NotificationSearch.php | 2 +- app/Http/Livewire/SimilarTorrent.php | 2 +- app/Http/Livewire/Top10.php | 2 +- app/Http/Livewire/TorrentSearch.php | 4 ++-- resources/views/blocks/poll.blade.php | 2 +- resources/views/components/forum/post.blade.php | 2 +- .../views/components/partials/_torrent-group-row.blade.php | 2 +- resources/views/components/torrent/row.blade.php | 2 +- resources/views/forum/topic/show.blade.php | 2 +- resources/views/livewire/comment.blade.php | 2 +- resources/views/livewire/ticket-search.blade.php | 4 ++-- resources/views/partials/top_nav.blade.php | 6 +++--- resources/views/playlist/show.blade.php | 4 ++-- resources/views/rss/index.blade.php | 2 +- resources/views/torrent/edit.blade.php | 4 ++-- resources/views/torrent/partials/subtitles.blade.php | 2 +- resources/views/torrent/partials/tools.blade.php | 4 ++-- resources/views/torrent/peers.blade.php | 2 +- resources/views/torrent/show.blade.php | 2 +- resources/views/user/profile/show.blade.php | 6 +++--- 22 files changed, 32 insertions(+), 32 deletions(-) diff --git a/app/Http/Controllers/SimilarTorrentController.php b/app/Http/Controllers/SimilarTorrentController.php index 09178facf..4ff533343 100644 --- a/app/Http/Controllers/SimilarTorrentController.php +++ b/app/Http/Controllers/SimilarTorrentController.php @@ -88,7 +88,7 @@ class SimilarTorrentController extends Controller break; } - $personalFreeleech = cache()->get('personal_freeleech:'.auth()->user()->id); + $personalFreeleech = cache()->get('personal_freeleech:'.auth()->id()); return view('torrent.similar', [ 'meta' => $meta, diff --git a/app/Http/Livewire/Comment.php b/app/Http/Livewire/Comment.php index 8dae740c4..f70f38759 100644 --- a/app/Http/Livewire/Comment.php +++ b/app/Http/Livewire/Comment.php @@ -93,7 +93,7 @@ class Comment extends Component final public function editComment(): void { - if (auth()->user()->id == $this->comment->user_id || auth()->user()->group->is_modo) { + if (auth()->id() == $this->comment->user_id || auth()->user()->group->is_modo) { $this->comment->update((new AntiXSS())->xss_clean($this->editState)); $this->isEditing = false; } else { @@ -103,7 +103,7 @@ class Comment extends Component final public function deleteComment(): void { - if (auth()->user()->id == $this->comment->user_id || auth()->user()->group->is_modo) { + if (auth()->id() == $this->comment->user_id || auth()->user()->group->is_modo) { $this->comment->delete(); $this->emitUp('refresh'); } else { diff --git a/app/Http/Livewire/NotificationSearch.php b/app/Http/Livewire/NotificationSearch.php index 08da62d13..2203b9413 100644 --- a/app/Http/Livewire/NotificationSearch.php +++ b/app/Http/Livewire/NotificationSearch.php @@ -152,7 +152,7 @@ class NotificationSearch extends Component final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application { return view('livewire.notification-search', [ - 'user' => User::with(['group'])->findOrFail(auth()->user()->id), + 'user' => User::with(['group'])->findOrFail(auth()->id()), 'notifications' => $this->notifications, ]); } diff --git a/app/Http/Livewire/SimilarTorrent.php b/app/Http/Livewire/SimilarTorrent.php index d2195e3c0..c40177de7 100644 --- a/app/Http/Livewire/SimilarTorrent.php +++ b/app/Http/Livewire/SimilarTorrent.php @@ -225,7 +225,7 @@ class SimilarTorrent extends Component final public function getPersonalFreeleechProperty() { - return cache()->get('personal_freeleech:'.auth()->user()->id); + return cache()->get('personal_freeleech:'.auth()->id()); } final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application diff --git a/app/Http/Livewire/Top10.php b/app/Http/Livewire/Top10.php index fb4a63a61..c10e226f7 100644 --- a/app/Http/Livewire/Top10.php +++ b/app/Http/Livewire/Top10.php @@ -67,7 +67,7 @@ class Top10 extends Component final public function getPersonalFreeleechProperty() { - return cache()->get('personal_freeleech:'.auth()->user()->id); + return cache()->get('personal_freeleech:'.auth()->id()); } final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application diff --git a/app/Http/Livewire/TorrentSearch.php b/app/Http/Livewire/TorrentSearch.php index 200c8faed..a2c103167 100644 --- a/app/Http/Livewire/TorrentSearch.php +++ b/app/Http/Livewire/TorrentSearch.php @@ -175,7 +175,7 @@ class TorrentSearch extends Component final public function getPersonalFreeleechProperty() { - return cache()->get('personal_freeleech:'.auth()->user()->id); + return cache()->get('personal_freeleech:'.auth()->id()); } final public function getTorrentsProperty(): \Illuminate\Contracts\Pagination\LengthAwarePaginator @@ -608,7 +608,7 @@ class TorrentSearch extends Component final public function render(): \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|\Illuminate\Contracts\Foundation\Application { return view('livewire.torrent-search', [ - 'user' => User::with(['group'])->findOrFail(auth()->user()->id), + 'user' => User::with(['group'])->findOrFail(auth()->id()), 'personalFreeleech' => $this->personalFreeleech, 'torrents' => $this->view === 'group' ? $this->groupedTorrents : $this->torrents, ]); diff --git a/resources/views/blocks/poll.blade.php b/resources/views/blocks/poll.blade.php index 64f4734e3..5fdc5c09d 100644 --- a/resources/views/blocks/poll.blade.php +++ b/resources/views/blocks/poll.blade.php @@ -1,4 +1,4 @@ -@if ($poll && $poll->voters->where('user_id', '=', auth()->user()->id)->isEmpty()) +@if ($poll && $poll->voters->where('user_id', '=', auth()->id())->isEmpty())

{{ __('poll.poll') }}: {{ $poll->title }}

diff --git a/resources/views/components/forum/post.blade.php b/resources/views/components/forum/post.blade.php index bd3070ed9..64431cce3 100644 --- a/resources/views/components/forum/post.blade.php +++ b/resources/views/components/forum/post.blade.php @@ -87,7 +87,7 @@ @endif - @if (auth()->user()->group->is_modo || ($post->user->id === auth()->user()->id && $post->topic->state === 'open')) + @if (auth()->user()->group->is_modo || ($post->user->id === auth()->id() && $post->topic->state === 'open'))
  • - @if(auth()->user()->group->is_modo || auth()->user()->id === $torrent->user_id) + @if(auth()->user()->group->is_modo || auth()->id() === $torrent->user_id)
  • - @if (auth()->user()->group->is_modo || $topic->first_post_user_id == auth()->user()->id) + @if (auth()->user()->group->is_modo || $topic->first_post_user_id == auth()->id())

    {{ __('forum.topic') }} {{ __('user.settings') }}

    diff --git a/resources/views/livewire/comment.blade.php b/resources/views/livewire/comment.blade.php index a664a1659..d7de6819d 100644 --- a/resources/views/livewire/comment.blade.php +++ b/resources/views/livewire/comment.blade.php @@ -19,7 +19,7 @@ @endif - @if ($comment->user_id === auth()->user()->id || auth()->user()->group->is_modo) + @if ($comment->user_id === auth()->id() || auth()->user()->group->is_modo)
  • @endif - @if (auth()->user()->id !== $user->id) + @if (auth()->id() !== $user->id)