2023-12-19 15:09:12 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Fo;
|
|
|
|
|
|
|
|
|
|
|
|
use App\Enums\StaticPageType;
|
|
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
|
|
use App\Http\Requests\Fo\ContactRequest;
|
|
|
|
|
|
use App\Http\Requests\Fo\JoinusRequest;
|
|
|
|
|
|
use App\Mail\SendContactMail;
|
|
|
|
|
|
use App\Mail\SendJoinusMail;
|
|
|
|
|
|
use App\Models\Convictionpage;
|
|
|
|
|
|
use App\Models\Explorerpage;
|
|
|
|
|
|
use App\Models\Homepage;
|
|
|
|
|
|
use App\Models\Joinuspage;
|
|
|
|
|
|
use App\Models\News;
|
|
|
|
|
|
use App\Models\Range;
|
|
|
|
|
|
use App\Models\SeasonalSection;
|
|
|
|
|
|
use App\Models\StaticPage;
|
|
|
|
|
|
use App\Models\Testimonial;
|
|
|
|
|
|
use Illuminate\Support\Facades\Mail;
|
|
|
|
|
|
|
|
|
|
|
|
class StaticPageController extends Controller
|
|
|
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
|
|
|
* About us show
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param \App\Models\StaticPage $aboutUsPage
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function aboutUs(StaticPage $aboutUsPage)
|
|
|
|
|
|
{
|
|
|
|
|
|
$aboutUsPage = StaticPage::query()->where('type', StaticPageType::aboutus)
|
|
|
|
|
|
->get();
|
|
|
|
|
|
return view('fo.pages.about-us', ['staticPageModel' => $aboutUsPage[0]]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Legal show
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param \App\Models\StaticPage $legalPage
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function legals(StaticPage $legalPage)
|
|
|
|
|
|
{
|
|
|
|
|
|
$legalPage = StaticPage::query()->where('type', StaticPageType::legals)->get();
|
|
|
|
|
|
return view('fo.pages.legals', ['staticPageModel' => $legalPage[0]]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Policies show
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param \App\Models\StaticPage $policiesPage
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function policies(StaticPage $policiesPage)
|
|
|
|
|
|
{
|
|
|
|
|
|
$policiesPage = StaticPage::query()->where('type', StaticPageType::confidentiality)->get();
|
|
|
|
|
|
return view('fo.pages.legals', ['staticPageModel' => $policiesPage[0]]);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Display a listing of the resource.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function homepage(): \Illuminate\Contracts\View\View
|
|
|
|
|
|
{
|
|
|
|
|
|
/** @var \App\Models\Homepage $homepageModel */
|
|
|
|
|
|
$homepageModel = Homepage::query()->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\StaticPage $staticPageModel */
|
|
|
|
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::home)->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\SeasonalSection $seasonalSectionsModel */
|
|
|
|
|
|
$seasonalSectionsModel = SeasonalSection::query()->where('published', true)->first();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\News $newsModels */
|
|
|
|
|
|
$newsModels = News::query()->where('published', true)->latest('publish_at')->limit(2)->get();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\Range $rangeModels */
|
|
|
|
|
|
$rangeModels = Range::query()->where('published', true)->orderBy('order')->get();
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.home', compact(
|
|
|
|
|
|
'homepageModel',
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
'seasonalSectionsModel',
|
|
|
|
|
|
'newsModels',
|
|
|
|
|
|
'rangeModels',
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Display a listing of the resource.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function contact(): \Illuminate\Contracts\View\View
|
|
|
|
|
|
{
|
|
|
|
|
|
/** @var \App\Models\StaticPage $contactModel */
|
|
|
|
|
|
$contactModel = StaticPage::query()->where('type', StaticPageType::contact)->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.contact', compact('contactModel'));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Display a listing of the resource.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param \App\Http\Requests\Fo\ContactRequest $request
|
|
|
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function contactForm(ContactRequest $request): \Illuminate\Http\RedirectResponse
|
|
|
|
|
|
{
|
2023-12-19 16:50:48 +01:00
|
|
|
|
$receivers = \config('mail.contactform.receiver');
|
|
|
|
|
|
foreach ($receivers as $email) {
|
|
|
|
|
|
Mail::to($email)->send(new SendContactMail((object)$request->validated()));
|
|
|
|
|
|
}
|
2023-12-19 15:09:12 +00:00
|
|
|
|
|
|
|
|
|
|
return redirect()->route('fo.contact.show')
|
|
|
|
|
|
->with(
|
|
|
|
|
|
'success',
|
|
|
|
|
|
'Bonjour, votre message a bien été transmis. nous vous en remercions. Cordialement, l’équipe Agis.'
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Display the explorer and gastronome page.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function explorer(): \Illuminate\Contracts\View\View
|
|
|
|
|
|
{
|
|
|
|
|
|
/** @var \App\Models\Explorerpage $explorerpageModel */
|
|
|
|
|
|
$explorerpageModel = Explorerpage::query()->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\StaticPage $staticPageModel */
|
|
|
|
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::explorer)->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.explorer-and-gastronome', compact(
|
|
|
|
|
|
'explorerpageModel',
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Display the convictions page.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function convictions(): \Illuminate\Contracts\View\View
|
|
|
|
|
|
{
|
|
|
|
|
|
/** @var \App\Models\Convictionpage $convictionpageModel */
|
|
|
|
|
|
$convictionpageModel = Convictionpage::query()->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\StaticPage $staticPageModel */
|
|
|
|
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::conviction)->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.convictions', compact(
|
|
|
|
|
|
'convictionpageModel',
|
|
|
|
|
|
'staticPageModel',
|
|
|
|
|
|
));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Display the explorer and gastonome page.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @return \Illuminate\Contracts\View\View
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function joinus(): \Illuminate\Contracts\View\View
|
|
|
|
|
|
{
|
|
|
|
|
|
/** @var \App\Models\StaticPage $staticPageModel */
|
|
|
|
|
|
$staticPageModel = StaticPage::query()->where('type', StaticPageType::joinus)->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\Joinuspage $joinuspageModel */
|
|
|
|
|
|
$joinuspageModel = Joinuspage::query()->firstOrFail();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var \App\Models\Testimonial $testimonialModels */
|
|
|
|
|
|
$testimonialModels = Testimonial::query()->get();
|
|
|
|
|
|
|
|
|
|
|
|
return view('fo.pages.join-us', compact('staticPageModel', 'joinuspageModel', 'testimonialModels'));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Display a listing of the resource.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param \App\Http\Requests\Fo\JoinusRequest $request
|
|
|
|
|
|
* @return \Illuminate\Http\RedirectResponse
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function joinusForm(JoinusRequest $request): \Illuminate\Http\RedirectResponse
|
|
|
|
|
|
{
|
2023-12-19 16:50:48 +01:00
|
|
|
|
$receivers = \config('mail.contactform.receiver');
|
|
|
|
|
|
foreach ($receivers as $email) {
|
|
|
|
|
|
Mail::to($email)->send(new SendJoinusMail((object)$request->validated()));
|
|
|
|
|
|
}
|
2023-12-19 15:09:12 +00:00
|
|
|
|
|
|
|
|
|
|
return redirect()->route('fo.joinus.show')
|
|
|
|
|
|
->with(
|
|
|
|
|
|
'success',
|
|
|
|
|
|
'Bonjour, votre candidature a bien été transmise. nous vous en remercions. Cordialement, l’équipe Agis.'
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|