namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Shop;
use App\Models\Category;
use App\Models\Product;
use Illuminate\Support\Facades\DB;
class ShopController extends Controller
{
public function index(Request $request)
{
$type = $request->query('type', 'grocery'); // ডিফল্ট গ্রোসারি
// ✅ ১. টাইপ অনুযায়ী দোকান ফিল্টার (যেমন: শুধু মুদি দোকান)
$shops = Shop::where('type', $type)
->where('status', 'active')
->latest()
->get();
// ✅ ২. টাইপ অনুযায়ী মেইন ক্যাটাগরি (বাজারের আন্ডারে চাল, ডাল ইত্যাদি)
// তোমার ডাটাবেজে categories টেবিলে 'type' কলাম থাকলে ভালো, না থাকলে parent_id দিয়ে আসবে
$categories = Category::where('status', 1)
->whereNull('parent_id')
->when($type, function($q) use ($type){
return $q->where('type', $type);
})
->get();
return view('shops.index', compact('shops', 'categories', 'type'));
}
public function details($id)
{
$shop = Shop::findOrFail($id);
// দোকানের সব প্রোডাক্ট
$products = Product::where('shop_id', $id)->latest()->get();
// দোকানের প্রোডাক্টগুলো কোন কোন ক্যাটাগরির তা ফিল্টার করা
$cat_ids = $products->pluck('category_id')->unique();
$categories = Category::whereIn('id', $cat_ids)->get();
return view('shops.details', compact('shop', 'products', 'categories'));
}
}namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Shop;
use App\Models\Category;
use App\Models\Product;
use Illuminate\Support\Facades\DB;
class ShopController extends Controller
{
public function index(Request $request)
{
$type = $request->query('type', 'grocery'); // ডিফল্ট গ্রোসারি
// ✅ ১. টাইপ অনুযায়ী দোকান ফিল্টার (যেমন: শুধু মুদি দোকান)
$shops = Shop::where('type', $type)
->where('status', 'active')
->latest()
->get();
// ✅ ২. টাইপ অনুযায়ী মেইন ক্যাটাগরি (বাজারের আন্ডারে চাল, ডাল ইত্যাদি)
// তোমার ডাটাবেজে categories টেবিলে 'type' কলাম থাকলে ভালো, না থাকলে parent_id দিয়ে আসবে
$categories = Category::where('status', 1)
->whereNull('parent_id')
->when($type, function($q) use ($type){
return $q->where('type', $type);
})
->get();
return view('shops.index', compact('shops', 'categories', 'type'));
}
public function details($id)
{
$shop = Shop::findOrFail($id);
// দোকানের সব প্রোডাক্ট
$products = Product::where('shop_id', $id)->latest()->get();
// দোকানের প্রোডাক্টগুলো কোন কোন ক্যাটাগরির তা ফিল্টার করা
$cat_ids = $products->pluck('category_id')->unique();
$categories = Category::whereIn('id', $cat_ids)->get();
return view('shops.details', compact('shop', 'products', 'categories'));
}
}namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Shop;
use App\Models\Category;
use App\Models\Product;
use Illuminate\Support\Facades\DB;
class ShopController extends Controller
{
public function index(Request $request)
{
$type = $request->query('type', 'grocery'); // ডিফল্ট গ্রোসারি
// ✅ ১. টাইপ অনুযায়ী দোকান ফিল্টার (যেমন: শুধু মুদি দোকান)
$shops = Shop::where('type', $type)
->where('status', 'active')
->latest()
->get();
// ✅ ২. টাইপ অনুযায়ী মেইন ক্যাটাগরি (বাজারের আন্ডারে চাল, ডাল ইত্যাদি)
// তোমার ডাটাবেজে categories টেবিলে 'type' কলাম থাকলে ভালো, না থাকলে parent_id দিয়ে আসবে
$categories = Category::where('status', 1)
->whereNull('parent_id')
->when($type, function($q) use ($type){
return $q->where('type', $type);
})
->get();
return view('shops.index', compact('shops', 'categories', 'type'));
}
public function details($id)
{
$shop = Shop::findOrFail($id);
// দোকানের সব প্রোডাক্ট
$products = Product::where('shop_id', $id)->latest()->get();
// দোকানের প্রোডাক্টগুলো কোন কোন ক্যাটাগরির তা ফিল্টার করা
$cat_ids = $products->pluck('category_id')->unique();
$categories = Category::whereIn('id', $cat_ids)->get();
return view('shops.details', compact('shop', 'products', 'categories'));
}
}namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Shop;
use App\Models\Category;
use App\Models\Product;
use Illuminate\Support\Facades\DB;
class ShopController extends Controller
{
public function index(Request $request)
{
$type = $request->query('type', 'grocery'); // ডিফল্ট গ্রোসারি
// ✅ ১. টাইপ অনুযায়ী দোকান ফিল্টার (যেমন: শুধু মুদি দোকান)
$shops = Shop::where('type', $type)
->where('status', 'active')
->latest()
->get();
// ✅ ২. টাইপ অনুযায়ী মেইন ক্যাটাগরি (বাজারের আন্ডারে চাল, ডাল ইত্যাদি)
// তোমার ডাটাবেজে categories টেবিলে 'type' কলাম থাকলে ভালো, না থাকলে parent_id দিয়ে আসবে
$categories = Category::where('status', 1)
->whereNull('parent_id')
->when($type, function($q) use ($type){
return $q->where('type', $type);
})
->get();
return view('shops.index', compact('shops', 'categories', 'type'));
}
public function details($id)
{
$shop = Shop::findOrFail($id);
// দোকানের সব প্রোডাক্ট
$products = Product::where('shop_id', $id)->latest()->get();
// দোকানের প্রোডাক্টগুলো কোন কোন ক্যাটাগরির তা ফিল্টার করা
$cat_ids = $products->pluck('category_id')->unique();
$categories = Category::whereIn('id', $cat_ids)->get();
return view('shops.details', compact('shop', 'products', 'categories'));
}
}namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Shop;
use App\Models\Category;
use App\Models\Product;
use Illuminate\Support\Facades\DB;
class ShopController extends Controller
{
public function index(Request $request)
{
$type = $request->query('type', 'grocery'); // ডিফল্ট গ্রোসারি
// ✅ ১. টাইপ অনুযায়ী দোকান ফিল্টার (যেমন: শুধু মুদি দোকান)
$shops = Shop::where('type', $type)
->where('status', 'active')
->latest()
->get();
// ✅ ২. টাইপ অনুযায়ী মেইন ক্যাটাগরি (বাজারের আন্ডারে চাল, ডাল ইত্যাদি)
// তোমার ডাটাবেজে categories টেবিলে 'type' কলাম থাকলে ভালো, না থাকলে parent_id দিয়ে আসবে
$categories = Category::where('status', 1)
->whereNull('parent_id')
->when($type, function($q) use ($type){
return $q->where('type', $type);
})
->get();
return view('shops.index', compact('shops', 'categories', 'type'));
}
public function details($id)
{
$shop = Shop::findOrFail($id);
// দোকানের সব প্রোডাক্ট
$products = Product::where('shop_id', $id)->latest()->get();
// দোকানের প্রোডাক্টগুলো কোন কোন ক্যাটাগরির তা ফিল্টার করা
$cat_ids = $products->pluck('category_id')->unique();
$categories = Category::whereIn('id', $cat_ids)->get();
return view('shops.details', compact('shop', 'products', 'categories'));
}
}
Target class [App\Http\Controllers\ShopController] does not exist.