Files
hoshal-market/app/Http/Controllers/HomeController.php
Mekan1206 6ea6701963 Refactor and localize settings and resources
- Updated GeneralSettings page to include localized labels and structured sections for better organization.
- Enhanced CarouselSlide, Category, Collection, and Product resources with localized model labels and improved form/table configurations.
- Modified HomeController to utilize query builder for better performance and added collection items retrieval.
- Updated views to reflect localized settings and improved layout for collections and footer.
- Adjusted timezone and locale settings in app configuration for better regional support.
2026-06-04 22:15:18 +05:00

26 lines
882 B
PHP

<?php
namespace App\Http\Controllers;
use App\Models\CarouselSlide;
use App\Models\Category;
use App\Models\Collection;
use App\Models\Product;
use App\Settings\GeneralSettings;
use Illuminate\Http\Request;
class HomeController extends Controller
{
public function __invoke(GeneralSettings $settings)
{
$slides = CarouselSlide::query()->where('is_active', true)->orderBy('order')->get();
$collections = Collection::with(['collectionItems' => function ($query) {
$query->where('is_active', true)->orderBy('order');
}])->where('is_active', true)->orderBy('order')->get();
$categories = Category::query()->orderBy('order')->get();
$products = Product::query()->with('category')->where('is_active', true)->get();
return view('home', compact('slides', 'collections', 'categories', 'products', 'settings'));
}
}