refactor: remove global RateCardProfile singleton usage from controllers and delete unused welcome view

This commit is contained in:
I-Fun
2026-04-06 09:33:43 +07:00
parent a72eec3ead
commit 737ba24293
9 changed files with 155 additions and 268 deletions

View File

@@ -17,8 +17,7 @@ class RateCardController extends Controller
public function index(): View
{
$rateCards = RateCard::orderBy('sort_order')->orderBy('platform')->get();
$profile = RateCardProfile::getSingleton();
return view('rate-cards.index', compact('rateCards', 'profile'));
return view('rate-cards.index', compact('rateCards'));
}
public function create(): View
@@ -88,23 +87,21 @@ class RateCardController extends Controller
public function public(): View
{
$profile = RateCardProfile::getSingleton();
$rateCards = RateCard::where('is_active', true)
->orderBy('sort_order')
->orderBy('platform')
->get()
->groupBy('platform');
return view('rate-cards.public', compact('rateCards', 'profile'));
return view('rate-cards.public', compact('rateCards'));
}
// ── Profile Settings ─────────────────────────────────────────
public function profilePage(): View
{
$profile = RateCardProfile::getSingleton();
$mediaFiles = \App\Models\MediaFile::latest()->get();
return view('rate-cards.profile', compact('profile', 'mediaFiles'));
return view('rate-cards.profile', compact('mediaFiles'));
}
public function profileUpdate(Request $request): RedirectResponse
@@ -143,7 +140,7 @@ class RateCardController extends Controller
}
$validated['show_prices'] = $request->has('show_prices');
$contentShowcase = $request->input('content_showcase', []);
$contentShowcase = $validated['content_showcase'] ?? [];
foreach ($contentShowcase as &$item) {
$item['show_on_public'] = filter_var($item['show_on_public'] ?? true, FILTER_VALIDATE_BOOLEAN);
$item['show_on_pdf'] = filter_var($item['show_on_pdf'] ?? true, FILTER_VALIDATE_BOOLEAN);
@@ -206,6 +203,7 @@ class RateCardController extends Controller
public function deleteBrandLogo(Request $request)
{
$request->validate(['path' => 'required|string']);
$path = $request->input('path');
$profile = RateCardProfile::getSingleton();
$brands = $profile->past_brands ?? [];