refactor: remove global RateCardProfile singleton usage from controllers and delete unused welcome view
This commit is contained in:
@@ -94,13 +94,11 @@ class ClientController extends Controller
|
||||
|
||||
public function show(Client $client): View
|
||||
{
|
||||
$client->load([
|
||||
'category',
|
||||
'events' => fn ($q) => $q->latest()->limit(5),
|
||||
'invoices' => fn ($q) => $q->latest()->limit(5),
|
||||
'contentBriefs'=> fn ($q) => $q->latest()->limit(5),
|
||||
'mediaFiles' => fn ($q) => $q->latest()->limit(10),
|
||||
]);
|
||||
$client->load('category');
|
||||
$client->setRelation('events', $client->events()->latest()->limit(5)->get());
|
||||
$client->setRelation('invoices', $client->invoices()->latest()->limit(5)->get());
|
||||
$client->setRelation('contentBriefs', $client->contentBriefs()->latest()->limit(5)->get());
|
||||
$client->setRelation('mediaFiles', $client->mediaFiles()->latest()->limit(10)->get());
|
||||
|
||||
return view('clients.show', compact('client'));
|
||||
}
|
||||
|
||||
@@ -28,10 +28,9 @@ class InvoiceController extends Controller
|
||||
|
||||
public function create(): View
|
||||
{
|
||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||
$statuses = InvoiceStatus::cases();
|
||||
$invoiceSettings = InvoiceSettings::instance();
|
||||
return view('invoices.create', compact('clients', 'statuses', 'invoiceSettings'));
|
||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||
$statuses = InvoiceStatus::cases();
|
||||
return view('invoices.create', compact('clients', 'statuses'));
|
||||
}
|
||||
|
||||
public function store(Request $request): RedirectResponse
|
||||
@@ -84,17 +83,15 @@ class InvoiceController extends Controller
|
||||
public function show(Invoice $invoice): View
|
||||
{
|
||||
$invoice->load('client', 'items');
|
||||
$invoiceSettings = InvoiceSettings::instance();
|
||||
return view('invoices.show', compact('invoice', 'invoiceSettings'));
|
||||
return view('invoices.show', compact('invoice'));
|
||||
}
|
||||
|
||||
public function edit(Invoice $invoice): View
|
||||
{
|
||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||
$statuses = InvoiceStatus::cases();
|
||||
$invoiceSettings = InvoiceSettings::instance();
|
||||
$clients = Client::where('status', 'active')->orderBy('name')->get();
|
||||
$statuses = InvoiceStatus::cases();
|
||||
$invoice->load('client', 'items');
|
||||
return view('invoices.edit', compact('invoice', 'clients', 'statuses', 'invoiceSettings'));
|
||||
return view('invoices.edit', compact('invoice', 'clients', 'statuses'));
|
||||
}
|
||||
|
||||
public function update(Request $request, Invoice $invoice): RedirectResponse
|
||||
|
||||
@@ -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 ?? [];
|
||||
|
||||
Reference in New Issue
Block a user