Card + Products
This commit is contained in:
parent
5ff57a21a7
commit
c129a44383
38 changed files with 4489 additions and 1789 deletions
|
|
@ -6,8 +6,6 @@ namespace App\Http\Controllers\Web;
|
|||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Category;
|
||||
use App\Models\Product;
|
||||
use Carbon\Carbon;
|
||||
use Request;
|
||||
use Input;
|
||||
|
||||
class SiteController extends Controller
|
||||
|
|
@ -31,14 +29,14 @@ class SiteController extends Controller
|
|||
{
|
||||
|
||||
if($product_slug){
|
||||
|
||||
$category = Category::where('slug', $subsite)->where('active', true)->first();
|
||||
$product = Product::where('slug', $product_slug)->where('active', true)->first();
|
||||
if ($category && $product) {
|
||||
|
||||
|
||||
$data = [
|
||||
'subsite' => $subsite,
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'DESC')->get(),
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'product' => $product,
|
||||
'p_count' => Product::where('active', true)->count(),
|
||||
|
||||
|
|
@ -54,7 +52,7 @@ class SiteController extends Controller
|
|||
if ($category) {
|
||||
$data = [
|
||||
'subsite' => $subsite,
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'DESC')->get(),
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::whereHas('categories', function ($query) use ($category) {
|
||||
$query->where('category_id', '=', $category->id);
|
||||
|
||||
|
|
@ -68,8 +66,8 @@ class SiteController extends Controller
|
|||
}
|
||||
$data = [
|
||||
'subsite' => 'alle-produkte',
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'DESC')->get(),
|
||||
'products' => Product::where('active', true)->orderBy('pos', 'DESC')->get(),
|
||||
'categories' => Category::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'products' => Product::where('active', true)->orderBy('pos', 'ASC')->get(),
|
||||
'p_count' => Product::where('active', true)->count(),
|
||||
];
|
||||
return view('web.templates.'.$site, $data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue