files()->where('id', $fileId)->firstOrFail(); return view('admin.account.file.delete', [ 'account' => $account, 'file' => $file ]); } public function destroy(Request $request, int $accountId, string $fileId) { $account = Account::findOrFail($accountId); $accountFile = $account->files() ->where('id', $fileId) ->firstOrFail(); $accountFile->delete(); return redirect()->route('admin.account.show', $account)->withFragment('#files'); } }