new updates
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\StoreContactMessageRequest;
|
||||
use App\Mail\ContactFormSubmission;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\View\View;
|
||||
use Klevze\ControlPanel\Facades\ActiveLanguage;
|
||||
@@ -32,14 +34,33 @@ class PageController extends Controller
|
||||
|
||||
public function about(): View
|
||||
{
|
||||
return $this->render('pages.about', 'About Us', 'about');
|
||||
$aboutPage = DB::table('contents')
|
||||
->where('content_id', 4)
|
||||
->exists()
|
||||
? app(CmsPage::class)->load(4, app()->getLocale())
|
||||
: null;
|
||||
|
||||
$seo = $this->pageSeo($aboutPage, 'About Us');
|
||||
|
||||
return $this->render('pages.about', $seo['title'], 'about', [
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
|
||||
public function work(): View
|
||||
{
|
||||
$workPage = DB::table('contents')
|
||||
->where('content_id', 3)
|
||||
->exists()
|
||||
? app(CmsPage::class)->load(3, app()->getLocale())
|
||||
: null;
|
||||
|
||||
$seo = $this->pageSeo($workPage, 'Works');
|
||||
|
||||
$categoryMap = $this->projectCategoryMap();
|
||||
|
||||
return $this->render('pages.work', 'Works', 'work', [
|
||||
return $this->render('pages.work', $seo['title'], 'work', [
|
||||
'seo' => $seo,
|
||||
'artworks' => $this->portfolioProjects($categoryMap),
|
||||
'categories' => array_values($categoryMap),
|
||||
]);
|
||||
@@ -74,12 +95,34 @@ class PageController extends Controller
|
||||
|
||||
public function contact(): View
|
||||
{
|
||||
return $this->render('pages.contact', 'Contact Us', 'contact');
|
||||
session(['contact_form_started_at' => now()->timestamp]);
|
||||
|
||||
$contactPage = DB::table('contents')
|
||||
->where('content_id', 6)
|
||||
->exists()
|
||||
? app(CmsPage::class)->load(6, app()->getLocale())
|
||||
: null;
|
||||
|
||||
$seo = $this->pageSeo($contactPage, 'Contact Us');
|
||||
|
||||
return $this->render('pages.contact', $seo['title'], 'contact', [
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
|
||||
public function terms(): View
|
||||
{
|
||||
return $this->render('pages.terms', 'Terms', 'terms');
|
||||
$termsPage = DB::table('contents')
|
||||
->where('content_id', 1)
|
||||
->exists()
|
||||
? app(CmsPage::class)->load(1, app()->getLocale())
|
||||
: null;
|
||||
|
||||
$seo = $this->pageSeo($termsPage, 'Terms');
|
||||
|
||||
return $this->render('pages.terms', $seo['title'], 'terms', [
|
||||
'seo' => $seo,
|
||||
]);
|
||||
}
|
||||
|
||||
public function thankyou(): View
|
||||
@@ -89,9 +132,15 @@ class PageController extends Controller
|
||||
|
||||
public function submitContact(StoreContactMessageRequest $request): RedirectResponse
|
||||
{
|
||||
Log::info('Website contact form submission', $request->validated());
|
||||
$contactDetails = $request->validated();
|
||||
|
||||
return redirect()->route('thankyou');
|
||||
Log::info('Website contact form submission', $contactDetails);
|
||||
|
||||
Mail::to('office@aritmija.si')->send(new ContactFormSubmission($contactDetails));
|
||||
|
||||
$request->session()->forget('contact_form_started_at');
|
||||
|
||||
return redirect()->route('thankyou', ['locale' => app()->getLocale()]);
|
||||
}
|
||||
|
||||
private function render(string $view, string $title, string $page, array $data = []): View
|
||||
|
||||
Reference in New Issue
Block a user