@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\Testimonial;
|
||||
use Illuminate\Support\Collection;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
/**
|
||||
* Public company-profile pages. Page copy lives in the frontend content
|
||||
* files; editable data (portfolio, testimonials) comes from the database.
|
||||
*/
|
||||
class SitePageController extends Controller
|
||||
{
|
||||
public function home(): Response
|
||||
{
|
||||
return Inertia::render('site/home', ['projects' => $this->projects()]);
|
||||
}
|
||||
|
||||
public function about(): Response
|
||||
{
|
||||
return Inertia::render('site/about', ['projects' => $this->projects()]);
|
||||
}
|
||||
|
||||
public function services(): Response
|
||||
{
|
||||
return Inertia::render('site/services');
|
||||
}
|
||||
|
||||
public function clients(): Response
|
||||
{
|
||||
$locale = app()->getLocale();
|
||||
|
||||
return Inertia::render('site/clients', [
|
||||
'projects' => $this->projects(),
|
||||
'testimonials' => Testimonial::query()
|
||||
->published()
|
||||
->get()
|
||||
->map(fn (Testimonial $testimonial) => $testimonial->localized($locale)),
|
||||
]);
|
||||
}
|
||||
|
||||
public function contact(): Response
|
||||
{
|
||||
return Inertia::render('site/contact');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Project>
|
||||
*/
|
||||
private function projects(): Collection
|
||||
{
|
||||
return Project::query()
|
||||
->latestFirst()
|
||||
->get(['id', 'title', 'client', 'year', 'sector', 'program', 'scope']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user