diff --git a/app/Console/Commands/DemoSeed.php b/app/Console/Commands/DemoSeed.php index 12ae868ce..d3982b407 100644 --- a/app/Console/Commands/DemoSeed.php +++ b/app/Console/Commands/DemoSeed.php @@ -89,7 +89,7 @@ class DemoSeed extends Command 'region_id' => random_int(1, 242), 'distributor_id' => random_int(1, 965), 'free' => $freeleech[$selected], - 'sticky' => 0, + 'sticky' => false, 'mediainfo' => ' Complete name : Double.Impact.1991.1080p.BluRay.DD+5.1.x264-LoRD.mkv Format : Matroska @@ -284,7 +284,8 @@ Menu 'region_id' => random_int(1, 242), 'distributor_id' => random_int(1, 965), 'free' => $freeleech[$selected], - 'sticky' => 0, + 'featured' => false, + 'sticky' => false, 'mediainfo' => ' Complete name : Double.Impact.1991.1080p.BluRay.DD+5.1.x264-LoRD.mkv Format : Matroska diff --git a/app/DTO/TorrentSearchFiltersDTO.php b/app/DTO/TorrentSearchFiltersDTO.php index 45731ea03..dd5485000 100644 --- a/app/DTO/TorrentSearchFiltersDTO.php +++ b/app/DTO/TorrentSearchFiltersDTO.php @@ -358,7 +358,7 @@ readonly class TorrentSearchFiltersDTO ->when($this->userBookmarked, fn ($query) => $query->whereRelation('bookmarks', 'user_id', '=', $this->user->id)) ->when($this->userWished, fn ($query) => $query->whereIn('tmdb', Wish::select('tmdb')->where('user_id', '=', $this->user->id))) ->when($this->internal, fn ($query) => $query->where('internal', '=', 1)) - ->when($this->personalRelease, fn ($query) => $query->where('personal_release', '=', 1)) + ->when($this->personalRelease, fn ($query) => $query->where('personal_release', '=', true)) ->when($this->trumpable, fn ($query) => $query->has('trump')) ->when($this->alive, fn ($query) => $query->where('seeders', '>', 0)) ->when($this->dying, fn ($query) => $query->where('seeders', '=', 1)->where('times_completed', '>=', 3)) diff --git a/app/Helpers/TorrentHelper.php b/app/Helpers/TorrentHelper.php index a29f0d120..958dcc98b 100644 --- a/app/Helpers/TorrentHelper.php +++ b/app/Helpers/TorrentHelper.php @@ -94,7 +94,7 @@ class TorrentHelper break; } - if ($torrent->anon == 0 && $uploader !== null) { + if (!$torrent->anon && $uploader !== null) { foreach ($uploader->followers()->get() as $follower) { if ($follower->acceptsNotification($uploader, $follower, 'following', 'show_following_upload')) { $follower->notify(new NewUpload('follower', $torrent)); @@ -106,7 +106,7 @@ class TorrentHelper $username = $user->username; $anon = $torrent->anon; - if ($anon == 0) { + if (!$anon) { // Achievements $user->unlock(new UserMadeUpload()); $user->addProgress(new UserMade25Uploads(), 1); diff --git a/app/Http/Controllers/API/TorrentController.php b/app/Http/Controllers/API/TorrentController.php index 66aa2a396..d4e3ec220 100644 --- a/app/Http/Controllers/API/TorrentController.php +++ b/app/Http/Controllers/API/TorrentController.php @@ -168,7 +168,7 @@ class TorrentController extends BaseController $torrent->anon = $request->input('anonymous'); $torrent->stream = $request->input('stream'); $torrent->sd = $request->input('sd'); - $torrent->personal_release = $request->input('personal_release') ?? 0; + $torrent->personal_release = $request->input('personal_release') ?? false; $torrent->internal = $user->group->is_modo || $user->group->is_internal ? ($request->input('internal') ?? 0) : 0; $torrent->doubleup = $user->group->is_modo || $user->group->is_internal ? ($request->input('doubleup') ?? 0) : 0; $torrent->refundable = $user->group->is_modo || $user->group->is_internal ? ($request->input('refundable') ?? false) : false; @@ -183,7 +183,7 @@ class TorrentController extends BaseController if (($user->group->is_modo || $user->group->is_internal) && isset($fl_until)) { $torrent->fl_until = Carbon::now()->addDays($request->integer('fl_until')); } - $torrent->sticky = $user->group->is_modo || $user->group->is_internal ? ($request->input('sticky') ?? 0) : 0; + $torrent->sticky = $user->group->is_modo || $user->group->is_internal ? ($request->input('sticky') ?? false) : false; $torrent->moderated_at = Carbon::now(); $torrent->moderated_by = User::SYSTEM_USER_ID; @@ -379,7 +379,7 @@ class TorrentController extends BaseController $doubleup = $torrent->doubleup; // Announce To Shoutbox - if ($anon == 0) { + if (!$anon) { $this->chatRepository->systemMessage( \sprintf('User [url=%s/users/', $appurl).$username.']'.$username.\sprintf('[/url] has uploaded a new '.$torrent->category->name.'. [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url], grab it now!' ); @@ -389,11 +389,11 @@ class TorrentController extends BaseController ); } - if ($anon == 1 && $featured == 1) { + if ($anon && $featured == 1) { $this->chatRepository->systemMessage( \sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url] has been added to the Featured Torrents Slider by an anonymous user! Grab It While You Can!' ); - } elseif ($anon == 0 && $featured == 1) { + } elseif (!$anon && $featured == 1) { $this->chatRepository->systemMessage( \sprintf('Ladies and Gents, [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.\sprintf('[/url] has been added to the Featured Torrents Slider by [url=%s/users/', $appurl).$username.']'.$username.'[/url]! Grab It While You Can!' ); diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 41bd774ea..8b66ead30 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -51,7 +51,7 @@ class ReportController extends Controller 'reported_user' => $reportedUser->id, 'title' => $torrentRequest->name, 'message' => $request->string('message'), - 'solved' => 0, + 'solved' => false, ]); return to_route('requests.show', ['torrentRequest' => $torrentRequest]) @@ -82,7 +82,7 @@ class ReportController extends Controller 'reported_user' => $reportedUser->id, 'title' => $torrent->name, 'message' => $request->string('message'), - 'solved' => 0, + 'solved' => false, ]); return to_route('torrents.show', ['id' => $id]) @@ -112,7 +112,7 @@ class ReportController extends Controller 'reported_user' => $reportedUser->id, 'title' => $reportedUser->username, 'message' => $request->string('message'), - 'solved' => 0, + 'solved' => false, ]); return to_route('users.show', ['user' => $reportedUser]) diff --git a/app/Http/Controllers/RequestController.php b/app/Http/Controllers/RequestController.php index a0d93cb51..675697163 100644 --- a/app/Http/Controllers/RequestController.php +++ b/app/Http/Controllers/RequestController.php @@ -147,7 +147,7 @@ class RequestController extends Controller ]); // Auto Shout - if ($torrentRequest->anon == 0) { + if (!$torrentRequest->anon) { $this->chatRepository->systemMessage( \sprintf('[url=%s]%s[/url] has created a new request [url=%s]%s[/url]', href_profile($user), $user->username, href_request($torrentRequest), $torrentRequest->name) ); diff --git a/app/Http/Controllers/Staff/InternalController.php b/app/Http/Controllers/Staff/InternalController.php index 74098635c..99c1c2124 100644 --- a/app/Http/Controllers/Staff/InternalController.php +++ b/app/Http/Controllers/Staff/InternalController.php @@ -44,11 +44,11 @@ class InternalController extends Controller ]) // Count total personal releases for current user ->withCount(['torrents as total_personal_releases' => fn ($query) => $query - ->where('personal_release', '=', 1) + ->where('personal_release', '=', true) ]) // Count recent personal releases for current user ->withCount(['torrents as recent_personal_releases' => fn ($query) => $query - ->where('personal_release', '=', 1) + ->where('personal_release', '=', true) ->where('created_at', '>', now()->subDays(60)) ]) // Count total internal releases for current user diff --git a/app/Http/Controllers/Staff/ModerationController.php b/app/Http/Controllers/Staff/ModerationController.php index dafb5011f..21d778115 100644 --- a/app/Http/Controllers/Staff/ModerationController.php +++ b/app/Http/Controllers/Staff/ModerationController.php @@ -96,7 +96,7 @@ class ModerationController extends Controller switch ($request->status) { case Torrent::APPROVED: // Announce To Shoutbox - if ($torrent->anon === 0) { + if (!$torrent->anon) { $this->chatRepository->systemMessage( \sprintf('User [url=%s/users/', config('app.url')).$torrent->user->username.']'.$torrent->user->username.\sprintf('[/url] has uploaded a new '.$torrent->category->name.'. [url=%s/torrents/', config('app.url')).$id.']'.$torrent->name.'[/url], grab it now!' ); diff --git a/app/Http/Controllers/Staff/ReportController.php b/app/Http/Controllers/Staff/ReportController.php index ceb26bfa4..e6bb01aa3 100644 --- a/app/Http/Controllers/Staff/ReportController.php +++ b/app/Http/Controllers/Staff/ReportController.php @@ -53,12 +53,12 @@ class ReportController extends Controller { $staff = auth()->user(); - if ($report->solved == 1) { + if ($report->solved) { return to_route('staff.reports.index') ->withErrors('This Report Has Already Been Solved'); } - $report->update(['solved' => 1, 'staff_id' => $staff->id] + $request->validated()); + $report->update(['solved' => true, 'staff_id' => $staff->id] + $request->validated()); $conversation = Conversation::create(['subject' => 'Your Report Has A New Verdict']); diff --git a/app/Http/Controllers/Staff/UploaderController.php b/app/Http/Controllers/Staff/UploaderController.php index 17b8ae319..bd92e9be6 100644 --- a/app/Http/Controllers/Staff/UploaderController.php +++ b/app/Http/Controllers/Staff/UploaderController.php @@ -36,11 +36,11 @@ class UploaderController extends Controller ]) // Count total personal releases for current user ->withCount(['torrents as total_personal_releases' => fn ($query) => $query - ->where('personal_release', '=', 1) + ->where('personal_release', '=', true) ]) // Count recent personal releases for current user ->withCount(['torrents as recent_personal_releases' => fn ($query) => $query - ->where('personal_release', '=', 1) + ->where('personal_release', '=', true) ->where('created_at', '>', now()->subDays(60)) ]) ->orderBy('group_id') diff --git a/app/Http/Controllers/StatsController.php b/app/Http/Controllers/StatsController.php index 85af94599..3a6e236c6 100644 --- a/app/Http/Controllers/StatsController.php +++ b/app/Http/Controllers/StatsController.php @@ -121,7 +121,7 @@ class StatsController extends Controller { return view('stats.users.uploaders', [ 'uploaders' => Torrent::with('user') - ->where('anon', '=', 0) + ->where('anon', '=', false) ->select(DB::raw('user_id, count(*) as value')) ->groupBy('user_id') ->orderByDesc('value') diff --git a/app/Http/Controllers/TicketAssigneeController.php b/app/Http/Controllers/TicketAssigneeController.php index 3aa493854..d6e9c5a5b 100644 --- a/app/Http/Controllers/TicketAssigneeController.php +++ b/app/Http/Controllers/TicketAssigneeController.php @@ -28,7 +28,7 @@ class TicketAssigneeController extends Controller $ticket->update([ 'staff_id' => $request->staff_id, - 'staff_read' => 0, + 'staff_read' => false, ]); return to_route('tickets.show', ['ticket' => $ticket]) diff --git a/app/Http/Controllers/TicketController.php b/app/Http/Controllers/TicketController.php index ce514cf5b..401832591 100644 --- a/app/Http/Controllers/TicketController.php +++ b/app/Http/Controllers/TicketController.php @@ -66,11 +66,11 @@ class TicketController extends Controller abort_unless($request->user()->group->is_modo || $request->user()->id === $ticket->user_id, 403); if ($request->user()->id === $ticket->user_id) { - $ticket->user_read = 1; + $ticket->user_read = true; } if ($request->user()->id === $ticket->staff_id) { - $ticket->staff_read = 1; + $ticket->staff_read = true; } $ticket->save(); diff --git a/app/Http/Controllers/TorrentController.php b/app/Http/Controllers/TorrentController.php index 07273dbc4..9a84cdab4 100644 --- a/app/Http/Controllers/TorrentController.php +++ b/app/Http/Controllers/TorrentController.php @@ -490,7 +490,7 @@ class TorrentController extends Controller $anon = $torrent->anon; // Announce To Shoutbox - if ($anon == 0) { + if (!$anon) { $this->chatRepository->systemMessage( \sprintf('User [url=%s/users/', $appurl).$username.']'.$username.\sprintf('[/url] has uploaded a new '.$torrent->category->name.'. [url=%s/torrents/', $appurl).$torrent->id.']'.$torrent->name.'[/url], grab it now!' ); diff --git a/app/Http/Livewire/Comment.php b/app/Http/Livewire/Comment.php index 7294fe81f..e0325fbb3 100644 --- a/app/Http/Livewire/Comment.php +++ b/app/Http/Livewire/Comment.php @@ -157,10 +157,12 @@ class Comment extends Component if ($this->user->id !== $ticket->staff_id && $ticket->staff_id !== null) { User::find($ticket->staff_id)->notify(new NewComment($this->model, $reply)); + $this->model->update(['staff_read' => false]); } if ($this->user->id !== $ticket->user_id) { User::find($ticket->user_id)->notify(new NewComment($this->model, $reply)); + $this->model->update(['user_read' => false]); } if (!\in_array($this->comment->user_id, [$ticket->staff_id, $ticket->user_id, $this->user->id])) { diff --git a/app/Http/Livewire/TopUsers.php b/app/Http/Livewire/TopUsers.php index 283f049e1..ae7feb8ae 100644 --- a/app/Http/Livewire/TopUsers.php +++ b/app/Http/Livewire/TopUsers.php @@ -184,7 +184,7 @@ class TopUsers extends Component ->select(DB::raw('user_id, COUNT(user_id) as value')) ->where('user_id', '!=', User::SYSTEM_USER_ID) ->where('anon', '=', false) - ->where('personal_release', '=', 1) + ->where('personal_release', '=', true) ->groupBy('user_id') ->orderByDesc('value') ->take(8) diff --git a/app/Http/Livewire/UserUploads.php b/app/Http/Livewire/UserUploads.php index fe39de3af..629e03cff 100644 --- a/app/Http/Livewire/UserUploads.php +++ b/app/Http/Livewire/UserUploads.php @@ -86,8 +86,8 @@ class UserUploads extends Component ->where('name', 'like', '%'.str_replace(' ', '%', $this->name).'%') ) ->when(!empty($this->status), fn ($query) => $query->whereIntegerInRaw('status', $this->status)) - ->when($this->personalRelease === 'include', fn ($query) => $query->where('personal_release', '=', 1)) - ->when($this->personalRelease === 'exclude', fn ($query) => $query->where('personal_release', '=', 0)) + ->when($this->personalRelease === 'include', fn ($query) => $query->where('personal_release', '=', true)) + ->when($this->personalRelease === 'exclude', fn ($query) => $query->where('personal_release', '=', false)) ->orderBy($this->sortField, $this->sortDirection) ->paginate($this->perPage); } diff --git a/app/Models/Report.php b/app/Models/Report.php index a999800b1..175418233 100644 --- a/app/Models/Report.php +++ b/app/Models/Report.php @@ -29,7 +29,7 @@ use Illuminate\Database\Eloquent\Model; * @property int|null $staff_id * @property string $title * @property string $message - * @property int $solved + * @property bool $solved * @property string|null $verdict * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at @@ -55,11 +55,12 @@ class Report extends Model /** * Get the attributes that should be cast. * - * @return array{snoozed_until: 'datetime'} + * @return array{solved: 'bool', snoozed_until: 'datetime'} */ protected function casts(): array { return [ + 'solved' => 'bool', 'snoozed_until' => 'datetime', ]; } diff --git a/app/Models/Subtitle.php b/app/Models/Subtitle.php index a67813af1..a5746af5b 100644 --- a/app/Models/Subtitle.php +++ b/app/Models/Subtitle.php @@ -36,7 +36,7 @@ use Illuminate\Database\Eloquent\Model; * @property int $verified * @property int $user_id * @property int $torrent_id - * @property int $anon + * @property bool $anon * @property int $status * @property \Illuminate\Support\Carbon|null $moderated_at * @property int|null $moderated_by @@ -57,11 +57,12 @@ class Subtitle extends Model /** * Get the attributes that should be cast. * - * @return array{moderated_at: 'datetime'} + * @return array{anon: 'bool', moderated_at: 'datetime'} */ protected function casts(): array { return [ + 'anon' => 'bool', 'moderated_at' => 'datetime', ]; } diff --git a/app/Models/Ticket.php b/app/Models/Ticket.php index b31a5a823..aa78d22ff 100644 --- a/app/Models/Ticket.php +++ b/app/Models/Ticket.php @@ -29,8 +29,8 @@ use Illuminate\Database\Eloquent\Model; * @property int $category_id * @property int $priority_id * @property int|null $staff_id - * @property int|null $user_read - * @property int|null $staff_read + * @property bool $user_read + * @property bool $staff_read * @property string $subject * @property string $body * @property \Illuminate\Support\Carbon|null $closed_at @@ -51,11 +51,13 @@ class Ticket extends Model /** * Get the attributes that should be cast. * - * @return array{closed_at: 'datetime', reminded_at: 'datetime'} + * @return array{user_read: 'bool', staff_read: 'bool', closed_at: 'datetime', reminded_at: 'datetime'} */ protected function casts(): array { return [ + 'user_read' => 'bool', + 'staff_read' => 'bool', 'closed_at' => 'datetime', 'reminded_at' => 'datetime', ]; diff --git a/app/Models/Torrent.php b/app/Models/Torrent.php index b20e6faa1..c56c6689c 100644 --- a/app/Models/Torrent.php +++ b/app/Models/Torrent.php @@ -62,7 +62,7 @@ use Laravel\Scout\Searchable; * @property int $status * @property \Illuminate\Support\Carbon|null $moderated_at * @property int|null $moderated_by - * @property int $anon + * @property bool $anon * @property bool $sticky * @property int $sd * @property int $internal @@ -76,7 +76,7 @@ use Laravel\Scout\Searchable; * @property int|null $resolution_id * @property int|null $distributor_id * @property int|null $region_id - * @property int $personal_release + * @property bool $personal_release * @property int|null $balance * @property int|null $balance_offset */ @@ -95,20 +95,34 @@ class Torrent extends Model /** * Get the attributes that should be cast. * - * @return array{tmdb: 'int', igdb: 'int', bumped_at: 'datetime', fl_until: 'datetime', du_until: 'datetime', doubleup: 'bool', refundable: 'bool', moderated_at: 'datetime', sticky: 'bool'} + * @return array{ + * tmdb: 'int', + * igdb: 'int', + * bumped_at: 'datetime', + * fl_until: 'datetime', + * du_until: 'datetime', + * doubleup: 'bool', + * refundable: 'bool', + * moderated_at: 'datetime', + * anon: 'bool', + * sticky: 'bool', + * personal_release: 'bool' + * } */ protected function casts(): array { return [ - 'tmdb' => 'int', - 'igdb' => 'int', - 'bumped_at' => 'datetime', - 'fl_until' => 'datetime', - 'du_until' => 'datetime', - 'doubleup' => 'bool', - 'refundable' => 'bool', - 'moderated_at' => 'datetime', - 'sticky' => 'bool', + 'tmdb' => 'int', + 'igdb' => 'int', + 'bumped_at' => 'datetime', + 'fl_until' => 'datetime', + 'du_until' => 'datetime', + 'doubleup' => 'bool', + 'refundable' => 'bool', + 'moderated_at' => 'datetime', + 'anon' => 'bool', + 'sticky' => 'bool', + 'personal_release' => 'bool', ]; } diff --git a/app/Models/TorrentRequest.php b/app/Models/TorrentRequest.php index d48c1d726..c62639b32 100644 --- a/app/Models/TorrentRequest.php +++ b/app/Models/TorrentRequest.php @@ -36,7 +36,7 @@ use Illuminate\Database\Eloquent\Model; * @property string $bounty * @property int $votes * @property int|null $claimed - * @property int $anon + * @property bool $anon * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at * @property int|null $filled_by @@ -72,7 +72,7 @@ class TorrentRequest extends Model /** * Get the attributes that should be cast. * - * @return array{filled_when: 'datetime', approved_when: 'datetime', tmdb: 'int', igdb: 'int', bounty: 'decimal:2'} + * @return array{filled_when: 'datetime', approved_when: 'datetime', tmdb: 'int', igdb: 'int', bounty: 'decimal:2', anon: 'bool'} */ protected function casts(): array { @@ -82,6 +82,7 @@ class TorrentRequest extends Model 'tmdb' => 'int', 'igdb' => 'int', 'bounty' => 'decimal:2', + 'anon' => 'bool', ]; } diff --git a/app/Models/TorrentRequestBounty.php b/app/Models/TorrentRequestBounty.php index 1fab9e4eb..ec3537a78 100644 --- a/app/Models/TorrentRequestBounty.php +++ b/app/Models/TorrentRequestBounty.php @@ -27,7 +27,7 @@ use Illuminate\Database\Eloquent\Model; * @property int $user_id * @property string $seedbonus * @property int $requests_id - * @property int $anon + * @property bool $anon * @property \Illuminate\Support\Carbon|null $created_at * @property \Illuminate\Support\Carbon|null $updated_at */ @@ -61,6 +61,7 @@ class TorrentRequestBounty extends Model { return [ 'seedbonus' => 'decimal:2', + 'anon' => 'bool', ]; } diff --git a/app/Models/TorrentRequestClaim.php b/app/Models/TorrentRequestClaim.php index 9de8800b9..efd72af81 100644 --- a/app/Models/TorrentRequestClaim.php +++ b/app/Models/TorrentRequestClaim.php @@ -52,6 +52,18 @@ class TorrentRequestClaim extends Model */ protected $guarded = ['id', 'created_at', 'updated_at']; + /** + * Get the attributes that should be cast. + * + * @return array{anon: 'bool'} + */ + protected function casts(): array + { + return [ + 'anon' => 'bool', + ]; + } + /** * Belongs To A User. * diff --git a/app/Notifications/NewRequestFillApprove.php b/app/Notifications/NewRequestFillApprove.php index 849f69412..1e70ed58c 100644 --- a/app/Notifications/NewRequestFillApprove.php +++ b/app/Notifications/NewRequestFillApprove.php @@ -49,7 +49,7 @@ class NewRequestFillApprove extends Notification implements ShouldQueue */ public function toArray(object $notifiable): array { - if ($this->torrentRequest->anon == 0) { + if (!$this->torrentRequest->anon) { $this->torrentRequest->load('approver'); return [ diff --git a/database/factories/CommentFactory.php b/database/factories/CommentFactory.php index 9c924d09a..59648b88f 100644 --- a/database/factories/CommentFactory.php +++ b/database/factories/CommentFactory.php @@ -35,7 +35,7 @@ class CommentFactory extends Factory { return [ 'content' => $this->faker->text(), - 'anon' => $this->faker->randomNumber(), + 'anon' => $this->faker->boolean(), 'user_id' => User::factory(), 'parent_id' => null, 'commentable_type' => $this->faker->word(), diff --git a/database/factories/ReportFactory.php b/database/factories/ReportFactory.php index c3c4f3cc5..f7648ea81 100644 --- a/database/factories/ReportFactory.php +++ b/database/factories/ReportFactory.php @@ -41,7 +41,7 @@ class ReportFactory extends Factory 'staff_id' => User::factory(), 'title' => $this->faker->sentence(), 'message' => $this->faker->text(), - 'solved' => $this->faker->randomNumber(), + 'solved' => $this->faker->boolean(), 'verdict' => $this->faker->text(), 'reported_user' => User::factory(), 'torrent_id' => Torrent::factory(), diff --git a/database/factories/TorrentRequestClaimFactory.php b/database/factories/TorrentRequestClaimFactory.php index 928fce8d1..ceeebde8c 100644 --- a/database/factories/TorrentRequestClaimFactory.php +++ b/database/factories/TorrentRequestClaimFactory.php @@ -37,7 +37,7 @@ class TorrentRequestClaimFactory extends Factory return [ 'request_id' => TorrentRequest::factory(), 'username' => User::factory(), - 'anon' => $this->faker->randomNumber(), + 'anon' => $this->faker->boolean(), ]; } } diff --git a/database/migrations/2025_02_17_074140_update_columns_to_boolean.php b/database/migrations/2025_02_17_074140_update_columns_to_boolean.php new file mode 100644 index 000000000..552c67136 --- /dev/null +++ b/database/migrations/2025_02_17_074140_update_columns_to_boolean.php @@ -0,0 +1,50 @@ + + * @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 + */ + +use Illuminate\Database\Migrations\Migration; +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\Schema; + +return new class () extends Migration { + /** + * Run the migrations. + */ + public function up(): void + { + Schema::table('tickets', function (Blueprint $table): void { + $table->boolean('user_read')->default(false)->change(); + $table->boolean('staff_read')->default(false)->change(); + }); + + Schema::table('comments', function (Blueprint $table): void { + $table->boolean('anon')->default(false)->change(); + }); + + Schema::table('request_claims', function (Blueprint $table): void { + $table->boolean('anon')->default(false)->change(); + }); + + Schema::table('torrents', function (Blueprint $table): void { + $table->boolean('anon')->default(false)->change(); + $table->boolean('sticky')->default(false)->change(); + $table->boolean('personal_release')->default(false)->change(); + }); + + Schema::table('reports', function (Blueprint $table): void { + $table->boolean('solved')->default(false)->change(); + }); + } +}; diff --git a/resources/views/livewire/ticket-search.blade.php b/resources/views/livewire/ticket-search.blade.php index 85043ecfa..f618aa6e6 100644 --- a/resources/views/livewire/ticket-search.blade.php +++ b/resources/views/livewire/ticket-search.blade.php @@ -116,9 +116,9 @@ {{ $ticket->subject }} @if ((auth()->user()->group->is_modo && - (($ticket->staff_id === auth()->id() && $ticket->staff_read === 0) || + (($ticket->staff_id === auth()->id() && $ticket->staff_read === false) || ($ticket->staff_id === null && $ticket->closed_at === null))) || - ($ticket->user_id === auth()->id() && $ticket->user_read === 0)) + ($ticket->user_id === auth()->id() && $ticket->user_read === false))
  • - @if ($torrent->sticky == 0) + @if (! $torrent->sticky)