94 lines
2.6 KiB
PHP
94 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Client;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Carousel;
|
|
use App\Models\FAQ;
|
|
use App\Models\Product;
|
|
use App\Models\Testimonial;
|
|
use Inertia\Inertia;
|
|
use Storage;
|
|
|
|
class HomeController extends Controller
|
|
{
|
|
public function home()
|
|
{
|
|
$carousel = Carousel::all();
|
|
$testimonail = Testimonial::all();
|
|
|
|
|
|
$response = [
|
|
"carousel" => $carousel->map(function ($item) {
|
|
return [
|
|
"alt" => $item->alt,
|
|
"image_url" => $item->image_url ? asset(Storage::url($item->image_url)) : null,
|
|
];
|
|
}),
|
|
"testimonial" => $testimonail->map(function ($item) {
|
|
return [
|
|
"name" => $item->name,
|
|
"location" => $item->location,
|
|
"image" => $item->image ? asset(Storage::url($item->image)) : null,
|
|
"description" => $item->description
|
|
];
|
|
})
|
|
];
|
|
return Inertia::render('welcome', ['data' => $response]);
|
|
|
|
}
|
|
public function product()
|
|
{
|
|
$product = Product::all();
|
|
$productResponse = $product->map(function ($item) {
|
|
return [
|
|
"id" => $item->id,
|
|
"title" => $item->title,
|
|
"type" => $item->type,
|
|
"image_url" => $item->image_url ? asset(Storage::url($item->image_url)) : null,
|
|
];
|
|
});
|
|
return Inertia::render('product', ['product' => $productResponse]);
|
|
}
|
|
public function art()
|
|
{
|
|
return Inertia::render('art');
|
|
}
|
|
|
|
public function bespoke()
|
|
{
|
|
$product = Product::where("type", "bespoke")->get();
|
|
$productResponse = $product->map(function ($item) {
|
|
return [
|
|
"id" => $item->id,
|
|
"title" => $item->title,
|
|
"type" => $item->type,
|
|
"image_url" => $item->image_url ? asset(Storage::url($item->image_url)) : null,
|
|
];
|
|
})->values();
|
|
return Inertia::render("bespoke", ["product" => $productResponse]);
|
|
}
|
|
public function gallery()
|
|
{
|
|
return Inertia::render("gallery");
|
|
}
|
|
public function contact()
|
|
{
|
|
return Inertia::render('contact');
|
|
}
|
|
|
|
public function faq()
|
|
{
|
|
$faq = FAQ::all();
|
|
$faqResponse = $faq->map(function ($item) {
|
|
return [
|
|
"id" => $item->id,
|
|
"question" => $item->question,
|
|
"answer" => $item->answer,
|
|
];
|
|
});
|
|
return Inertia::render('faq', ['faq' => $faqResponse]);
|
|
}
|
|
|
|
}
|