diff --git a/app/Console/Commands/AutoStats.php b/app/Console/Commands/AutoStats.php index 5cfba35..a166ab8 100644 --- a/app/Console/Commands/AutoStats.php +++ b/app/Console/Commands/AutoStats.php @@ -30,9 +30,9 @@ class AutoStats extends Command */ public function handle() { - PopularDaily::where('created_at', '<=', Carbon::now()->subMinutes(1440))->forceDelete(); - PopularWeekly::where('created_at', '<=', Carbon::now()->subMinutes(10080))->forceDelete(); - PopularMonthly::where('created_at', '<=', Carbon::now()->subMinutes(43200))->forceDelete(); + PopularDaily::where('created_at', '<=', Carbon::now()->subMinutes(1440))->delete(); + PopularWeekly::where('created_at', '<=', Carbon::now()->subMinutes(10080))->delete(); + PopularMonthly::where('created_at', '<=', Carbon::now()->subMinutes(43200))->delete(); $this->comment('Automated Purge Stats Complete'); } diff --git a/app/Console/Commands/ResetUserDownloads.php b/app/Console/Commands/ResetUserDownloads.php index 7516122..b60c826 100644 --- a/app/Console/Commands/ResetUserDownloads.php +++ b/app/Console/Commands/ResetUserDownloads.php @@ -35,6 +35,6 @@ class ResetUserDownloads extends Command // Clear old downloads which have expired UserDownload::where('created_at', '<=', Carbon::now()->subHour(6)) - ->forceDelete(); + ->delete(); } } diff --git a/app/Http/Controllers/Admin/AlertController.php b/app/Http/Controllers/Admin/AlertController.php index b2018cd..50f5bc9 100644 --- a/app/Http/Controllers/Admin/AlertController.php +++ b/app/Http/Controllers/Admin/AlertController.php @@ -41,7 +41,7 @@ class AlertController extends Controller */ public function delete(int $alert_id): \Illuminate\Http\RedirectResponse { - Alert::where('id', $alert_id)->forceDelete(); + Alert::where('id', $alert_id)->delete(); cache()->forget('alerts'); diff --git a/app/Http/Controllers/Admin/SiteBackgroundController.php b/app/Http/Controllers/Admin/SiteBackgroundController.php index 86ab94d..134de2a 100644 --- a/app/Http/Controllers/Admin/SiteBackgroundController.php +++ b/app/Http/Controllers/Admin/SiteBackgroundController.php @@ -105,7 +105,7 @@ class SiteBackgroundController extends Controller DB::beginTransaction(); $bg = SiteBackground::where('id', $id)->firstOrFail(); - $bg->forceDelete(); + $bg->delete(); $resolutions = [1440, 1080, 720, 640]; try { diff --git a/app/Http/Controllers/Admin/SubtitleController.php b/app/Http/Controllers/Admin/SubtitleController.php index 5f04705..86a57a9 100644 --- a/app/Http/Controllers/Admin/SubtitleController.php +++ b/app/Http/Controllers/Admin/SubtitleController.php @@ -38,7 +38,7 @@ class SubtitleController extends Controller // Clear everything foreach($episode->subtitles as $sub) { - $sub->forceDelete(); + $sub->delete(); } if (! $request->input('subtitles')) { diff --git a/app/Http/Controllers/NotificationController.php b/app/Http/Controllers/NotificationController.php index 5bd3bb9..78ed78a 100644 --- a/app/Http/Controllers/NotificationController.php +++ b/app/Http/Controllers/NotificationController.php @@ -32,7 +32,7 @@ class NotificationController extends Controller ->where('id', $request->input('id')) ->firstOrFail(); - $notification->forceDelete(); + $notification->delete(); return redirect()->back(); } diff --git a/app/Http/Controllers/PlaylistController.php b/app/Http/Controllers/PlaylistController.php index 941b552..7bc1916 100644 --- a/app/Http/Controllers/PlaylistController.php +++ b/app/Http/Controllers/PlaylistController.php @@ -105,13 +105,11 @@ class PlaylistController extends Controller $user = $request->user(); - $playlist = Playlist::where('user_id', $user->id)->where('id', $playlist_id)->firstOrFail(); + $playlist = Playlist::where('user_id', $user->id) + ->where('id', $playlist_id) + ->firstOrFail(); - // Delete Playlist Episodes - PlaylistEpisode::where('playlist_id', $playlist->id)->forceDelete(); - - // Delete Playlist - $playlist->forceDelete(); + $playlist->delete(); return to_route('profile.playlists'); } @@ -128,8 +126,14 @@ class PlaylistController extends Controller ], 404); } - $playlist = Playlist::where('user_id', $request->user()->id)->where('id', (int) $request->input('playlist'))->firstOrFail(); - PlaylistEpisode::where('playlist_id', $playlist->id)->where('episode_id', (int) $request->input('episode'))->forceDelete(); + $playlist = Playlist::where('user_id', $request->user()->id) + ->where('id', (int) $request->input('playlist')) + ->firstOrFail(); + + PlaylistEpisode::where('playlist_id', $playlist->id) + ->where('episode_id', (int) $request->input('episode')) + ->delete(); + $this->playlistService->reorderPositions($playlist); return response()->json([ diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 2edd555..4d77ea2 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -152,13 +152,6 @@ class ProfileController extends Controller ]); } - // Delete Playlist - $playlists = Playlist::where('user_id', $user->id)->get(); - foreach($playlists as $playlist) { - PlaylistEpisode::where('playlist_id', $playlist->id)->forceDelete(); - $playlist->forceDelete(); - } - // Update comments to deleted user DB::table('comments')->where('commenter_id', '=', $user->id)->update(['commenter_id' => 1]); @@ -169,7 +162,7 @@ class ProfileController extends Controller Auth::logout(); - $user->forceDelete(); + $user->delete(); $request->session()->invalidate(); diff --git a/app/Livewire/DownloadsFree.php b/app/Livewire/DownloadsFree.php index 92cd648..a27a385 100644 --- a/app/Livewire/DownloadsFree.php +++ b/app/Livewire/DownloadsFree.php @@ -10,7 +10,6 @@ use Livewire\Component; use Illuminate\Support\Carbon; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Cache; class DownloadsFree extends Component { @@ -51,7 +50,7 @@ class DownloadsFree extends Component // Check timestamp if (Carbon::parse($alreadyDownloaded->created_at)->addHours(6) <= Carbon::now()) { // Already expired - $alreadyDownloaded->forceDelete(); + $alreadyDownloaded->delete(); return; } diff --git a/app/Models/User.php b/app/Models/User.php index 69c60ea..e2c7754 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -103,7 +103,7 @@ class User extends Authenticatable { if ($this->discord_id && $this->discord_avatar && !$this->avatar) { - return $this->discord_avatar; + return "https://external-content.duckduckgo.com/iu/?u={$this->discord_avatar}"; } if ($this->avatar) diff --git a/app/Override/Comments/CommentService.php b/app/Override/Comments/CommentService.php index 72cb389..b72f260 100644 --- a/app/Override/Comments/CommentService.php +++ b/app/Override/Comments/CommentService.php @@ -91,7 +91,7 @@ class CommentService if (Config::get('comments.soft_deletes') == true) { $comment->delete(); } else { - $comment->forceDelete(); + $comment->delete(); } } diff --git a/app/Services/GalleryService.php b/app/Services/GalleryService.php index 8e40073..50af35c 100644 --- a/app/Services/GalleryService.php +++ b/app/Services/GalleryService.php @@ -74,7 +74,7 @@ class GalleryService foreach ($oldGallery as $oldImage) { Storage::disk('public')->delete($oldImage->image_url); Storage::disk('public')->delete($oldImage->thumbnail_url); - $oldImage->forceDelete(); + $oldImage->delete(); } } } diff --git a/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php b/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php index 9d7eac1..f62f990 100644 --- a/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php +++ b/database/migrations/2025_09_21_215923_add_unique_constraint_to_downloads_table.php @@ -15,7 +15,7 @@ return new class extends Migration public function up(): void { # Delete entries with "#" as URL - Downloads::where('url', '#')->forceDelete(); + Downloads::where('url', '#')->delete(); # Remove duplicate entries $duplicates = DB::table('downloads') diff --git a/database/migrations/2026_01_08_213625_fix_database_structure.php b/database/migrations/2026_01_08_213625_fix_database_structure.php index b512360..304c3c7 100644 --- a/database/migrations/2026_01_08_213625_fix_database_structure.php +++ b/database/migrations/2026_01_08_213625_fix_database_structure.php @@ -155,7 +155,7 @@ return new class extends Migration ->where('playlist_id', '=', $playlist->id) ->delete(); - $playlist->forceDelete(); + $playlist->delete(); } }