phpcs clean
This commit is contained in:
parent
f4f3256ce5
commit
54ecb00638
68 changed files with 824 additions and 308 deletions
|
|
@ -23,7 +23,7 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// write schedules here
|
||||
// Write schedules here.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
class Page extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
|
|||
*/
|
||||
class Role extends BaseEnumRoutable
|
||||
{
|
||||
/**
|
||||
* Enum values
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function values(): array
|
||||
{
|
||||
return [
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
|||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|
|
@ -18,7 +20,6 @@ class ConfirmPasswordController extends Controller
|
|||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
|||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|
|
@ -17,5 +19,6 @@ class ForgotPasswordController extends Controller
|
|||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
// On fait rien.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
|||
*/
|
||||
class LoginController extends Controller
|
||||
{
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|
|
@ -38,7 +40,6 @@ class LoginController extends Controller
|
|||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ use Illuminate\Support\Facades\Validator;
|
|||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
use RegistersUsers;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|
|
@ -21,7 +23,6 @@ class RegisterController extends Controller
|
|||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use Illuminate\Foundation\Auth\ResetsPasswords;
|
|||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
use ResetsPasswords;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|
|
@ -18,7 +20,6 @@ class ResetPasswordController extends Controller
|
|||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ use Illuminate\Foundation\Auth\VerifiesEmails;
|
|||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
use VerifiesEmails;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|
|
@ -18,7 +20,6 @@ class VerificationController extends Controller
|
|||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ class AdviceController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Advice $advice
|
||||
* @param Advice $advice
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Advice $advice)
|
||||
{
|
||||
return view('back.advice.edit', compact('advice'));
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ class EncartsController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Encart $encart
|
||||
* @param Encart $encart
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Encart $encart)
|
||||
{
|
||||
return view('back.encarts.edit', compact('encart'));
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ class GammesController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Gamme $gamme
|
||||
* @param Gamme $gamme
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Gamme $gamme)
|
||||
{
|
||||
$parentGammes = Gamme::whereNull('parent_gamme_id')
|
||||
|
|
@ -53,7 +55,8 @@ class GammesController extends Controller
|
|||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreGammeRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(StoreGammeRequest $request)
|
||||
{
|
||||
|
|
@ -74,10 +77,12 @@ class GammesController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Gamme $gamme
|
||||
* @param Gamme $gamme
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Gamme $gamme)
|
||||
{
|
||||
$parentGammes = Gamme::whereNull('parent_gamme_id')
|
||||
|
|
@ -90,9 +95,10 @@ class GammesController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\UpdateGammeRequest $request
|
||||
* @param Gamme $gamme
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param \Illuminate\Http\UpdateGammeRequest $request
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Gamme $gamme, UpdateGammeRequest $request)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@ use App\Http\Controllers\Controller;
|
|||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
// BO
|
||||
/**
|
||||
* BO Home View
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function home()
|
||||
{
|
||||
return view('back.home');
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ class MomentsController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Moment $moment
|
||||
* @param Moment $moment
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Moment $moment)
|
||||
{
|
||||
return view('back.moments.edit', compact('moment'));
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@ class PictoBrandsController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param PictoBrand $pictobrand
|
||||
* @param PictoBrand $pictobrand
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(PictoBrand $pictobrand)
|
||||
{
|
||||
return view('back.pictobrands.create', compact('pictobrand'));
|
||||
|
|
@ -58,10 +59,11 @@ class PictoBrandsController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param PictoBrand $pictobrand
|
||||
* @param PictoBrand $pictobrand
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(PictoBrand $pictobrand)
|
||||
{
|
||||
return view('back.pictobrands.edit', compact('pictobrand'));
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ class PictosController extends Controller
|
|||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param Page $page
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Page $page)
|
||||
|
|
@ -26,10 +28,11 @@ class PictosController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Picto $picto
|
||||
* @param Picto $picto
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Picto $picto)
|
||||
{
|
||||
return view('back.pictos.create', compact('picto'));
|
||||
|
|
@ -47,8 +50,8 @@ class PictosController extends Controller
|
|||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
$picto->picture = Utils::storeImage($request->picture, $picto->getTable());
|
||||
}
|
||||
// on ne peut pas arbitrairement créer tous les pictos à cet endroit
|
||||
// j'ai du décommenter cette ligne pour la création picto fonctionne
|
||||
// On ne peut pas arbitrairement créer tous les pictos à cet endroit.
|
||||
// J'ai du décommenter cette ligne pour la création picto fonctionne.
|
||||
$picto->page = Page::marqueBloc2();
|
||||
|
||||
if (!$picto->saveOrFail()) {
|
||||
|
|
@ -60,10 +63,11 @@ class PictosController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Picto $picto
|
||||
* @param Picto $picto
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Picto $picto)
|
||||
{
|
||||
return view('back.pictos.edit', compact('picto'));
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use App\Models\Post;
|
|||
class PostsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* Display the posts view.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
|
@ -25,10 +25,10 @@ class PostsController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Post $post
|
||||
* @param Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Post $post)
|
||||
{
|
||||
return view('back.posts.create', compact('post'));
|
||||
|
|
@ -63,10 +63,11 @@ class PostsController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Post $post
|
||||
* @param Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Post $post)
|
||||
{
|
||||
return view('back.posts.edit', compact('post'));
|
||||
|
|
@ -75,8 +76,8 @@ class PostsController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\UpdatePostRequest $request
|
||||
* @param Post $post
|
||||
* @param \Illuminate\Http\UpdatePostRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Post $post, UpdatePostRequest $request)
|
||||
|
|
|
|||
|
|
@ -26,14 +26,16 @@ class ProductsController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Product $product
|
||||
* @return \Illuminate\Http\Response
|
||||
* @param Product $product
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Product $product)
|
||||
{
|
||||
$gammes = Gamme::all()->sortBy('title');
|
||||
// default structure + produits
|
||||
// Default structure + produits.
|
||||
$tabFour = array(
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
|
|
@ -162,10 +164,11 @@ class ProductsController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Product $product
|
||||
* @param Product $product
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Product $product)
|
||||
{
|
||||
$gammes = Gamme::all()->sortBy('title');
|
||||
|
|
@ -181,9 +184,9 @@ class ProductsController extends Controller
|
|||
*/
|
||||
public function update(Product $product, UpdateProductRequest $request)
|
||||
{
|
||||
// valeurs en base pour garder les anciennes images quand elles ne sont pas updatées
|
||||
// Valeurs en base pour garder les anciennes images quand elles ne sont pas updatées.
|
||||
$dbplusproduit = json_decode($product->plusproduit);
|
||||
// valeurs transmises dans le post
|
||||
// Valeurs transmises dans le post.
|
||||
$plusproduit = json_decode($request->plusproduit);
|
||||
$product->fill($request->validated());
|
||||
if (is_a($request->picture, "SplFileInfo")) {
|
||||
|
|
@ -191,20 +194,20 @@ class ProductsController extends Controller
|
|||
}
|
||||
|
||||
foreach ($plusproduit as $plus) {
|
||||
// boucle pour stockage des images uploadées
|
||||
// Boucle pour stockage des images uploadées.
|
||||
$picto = 'pictogramme' . $plus->id;
|
||||
$uploadfile = $request->$picto;
|
||||
// set de l'url
|
||||
// Set de l'url.
|
||||
if ($uploadfile) {
|
||||
$plus->url = Utils::storeImage($uploadfile, $product->getTable());
|
||||
} else {
|
||||
if (isset($dbplusproduit[$plus->id])) {
|
||||
// reprise de l'ancienne valeur
|
||||
// Reprise de l'ancienne valeur.
|
||||
$plus->url = $dbplusproduit[$plus->id]->url;
|
||||
}
|
||||
}
|
||||
}
|
||||
// encodage avant save
|
||||
// Encodage avant save.
|
||||
$product->plusproduit = json_encode($plusproduit);
|
||||
if (!$product->saveOrFail()) {
|
||||
return redirect()->route('bo.products.edit', $product->id)
|
||||
|
|
|
|||
|
|
@ -11,10 +11,11 @@ class SeoDataController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\SeoDatum $SeoDatum
|
||||
* @param \App\Models\SeoDatum $SeoDatum
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(SeoDatum $SeoDatum)
|
||||
{
|
||||
return view('back.seo_data.edit', compact('SeoDatum'));
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ class SlidersController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Slider $slider
|
||||
* @param Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Slider $slider)
|
||||
{
|
||||
return view('back.sliders.create', compact('slider'));
|
||||
|
|
@ -52,10 +53,11 @@ class SlidersController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Slider $slider
|
||||
* @param Slider $slider
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Slider $slider)
|
||||
{
|
||||
return view('back.sliders.edit', compact('slider'));
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ class SlidesController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Slide $slide
|
||||
* @param Slide $slide
|
||||
* @return \Illuminate\Http\Response
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Slide $slide)
|
||||
{
|
||||
$sliders = Slider::all();
|
||||
|
|
@ -58,10 +58,10 @@ class SlidesController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Slide $slide
|
||||
* @param Slide $slide
|
||||
* @return \Illuminate\Http\Response
|
||||
* phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Slide $slide)
|
||||
{
|
||||
$sliders = Slider::all();
|
||||
|
|
@ -105,7 +105,15 @@ class SlidesController extends Controller
|
|||
return redirect()->route('bo.slides.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
|
||||
public function changeOrder(Slide $slide, $action)
|
||||
/**
|
||||
* change order for a slide
|
||||
*
|
||||
* @param Slide $slide
|
||||
* @param string $action
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function changeOrder(Slide $slide, string $action)
|
||||
{
|
||||
if ($action === 'up') {
|
||||
$tmp = Slide::where('order', '<', $slide->order)->orderBy('order', 'DESC')->first();
|
||||
|
|
@ -126,6 +134,8 @@ class SlidesController extends Controller
|
|||
|
||||
/**
|
||||
* retreive order position to put a new slide to
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
private function getLastOrder()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ class TextsController extends Controller
|
|||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @param Text $text
|
||||
* @param Text $text
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function create(Text $text)
|
||||
{
|
||||
return view('back.texts.create', compact('text'));
|
||||
|
|
@ -57,10 +58,11 @@ class TextsController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Text $text
|
||||
* @param Text $text
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Text $text)
|
||||
{
|
||||
return view('back.texts.edit', compact('text'));
|
||||
|
|
@ -69,8 +71,8 @@ class TextsController extends Controller
|
|||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\StoreTextRequest $request
|
||||
* @param Text $text
|
||||
* @param \Illuminate\Http\StoreTextRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Text $text, StoreTextRequest $request)
|
||||
|
|
|
|||
|
|
@ -11,10 +11,11 @@ class TitlesController extends Controller
|
|||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Title $title
|
||||
* @param Title $title
|
||||
* @return \Illuminate\Http\Response
|
||||
*
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
*/
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass
|
||||
public function edit(Title $title)
|
||||
{
|
||||
return view('back.titles.edit', compact('title'));
|
||||
|
|
|
|||
|
|
@ -8,11 +8,22 @@ use Illuminate\Support\Facades\Mail;
|
|||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the contact view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function contact()
|
||||
{
|
||||
return view('front.contact');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send mail when submit the form.
|
||||
*
|
||||
* @param ContactFormRequest $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function contactSubmit(ContactFormRequest $request)
|
||||
{
|
||||
Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($request->validated()));
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ class Controller extends BaseController
|
|||
use DispatchesJobs;
|
||||
use ValidatesRequests;
|
||||
|
||||
/**
|
||||
* Perform any actions required when creating the object.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
view()->share('availableCountries', Country::toArray());
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@ use App\Models\Title;
|
|||
|
||||
class FoodServiceController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the FoodService view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$page = Page::foodservice();
|
||||
|
|
|
|||
|
|
@ -9,10 +9,15 @@ use App\Models\SeoDatum;
|
|||
|
||||
class GammesController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the Gammes view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$gammes = Gamme::whereNull('parent_gamme_id')->orderBy('title')->get();
|
||||
// remove Food Service from count
|
||||
// Remove Food Service from count.
|
||||
/** @var \Illuminate\Database\Eloquent\Collection $gammes */
|
||||
$gammes = $gammes->whereNotIn('slug', 'food-service');
|
||||
$nb_gammes = $gammes->count();
|
||||
|
|
@ -23,6 +28,13 @@ class GammesController extends Controller
|
|||
return view('front.gammes.index', compact('gammes', 'nb_gammes', 'seoDatum'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show one Gamme
|
||||
*
|
||||
* @param Gamme $gamme
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function show(Gamme $gamme)
|
||||
{
|
||||
$gammes = collect([]);
|
||||
|
|
@ -43,7 +55,7 @@ class GammesController extends Controller
|
|||
->orderBy('name')
|
||||
->get();
|
||||
|
||||
// make ghost seoDatum from the gamme
|
||||
// Make ghost seoDatum from the gamme.
|
||||
$seoDatum = new SeoDatum();
|
||||
$seoDatum->title = $gamme->title;
|
||||
$seoDatum->description = $gamme->text;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ use Illuminate\Support\Carbon;
|
|||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the Homepage view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
|
|
@ -46,7 +51,7 @@ class HomeController extends Controller
|
|||
['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['on_top', true]
|
||||
])->first();
|
||||
// Limitation à 3 produits affichés sur la homepage
|
||||
// Limitation à 3 produits affichés sur la homepage.
|
||||
$products_home = Product::where('is_on_top', true)->take(3)->get();
|
||||
|
||||
return view('front.home', compact('slider', 'slides', 'seoDatum', 'encart_home', 'post_home', 'products_home'));
|
||||
|
|
|
|||
|
|
@ -8,11 +8,16 @@ use App\Models\Text;
|
|||
|
||||
class LegalsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the legal disclaimer view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$mentions_legales = Text::where('page', Page::mentions()->value)->first();
|
||||
|
||||
// make ghost seoDatum from the gamme
|
||||
// Make ghost seoDatum from the gamme.
|
||||
$seoDatum = new SeoDatum();
|
||||
$seoDatum->title = $mentions_legales->title;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ use App\Models\Title;
|
|||
|
||||
class MarqueController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the Marque view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$page = Page::marque();
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ use Illuminate\Support\Carbon;
|
|||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the News view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$page = Page::news();
|
||||
|
|
|
|||
|
|
@ -8,11 +8,16 @@ use App\Models\Text;
|
|||
|
||||
class PolicyController extends Controller
|
||||
{
|
||||
/**
|
||||
* Show the Privacy policy view.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$privacy_policy = Text::where('page', Page::charte()->value)->first();
|
||||
|
||||
// make ghost seoDatum from the gamme
|
||||
// Make ghost seoDatum from the gamme.
|
||||
$seoDatum = new SeoDatum();
|
||||
$seoDatum->title = $privacy_policy->title;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,14 @@ use Illuminate\Http\Request;
|
|||
|
||||
class ProductsController extends Controller
|
||||
{
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
/**
|
||||
* Show one product
|
||||
*
|
||||
* @param Gamme $gamme
|
||||
* @param Product $product
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
|
||||
*/
|
||||
public function show(Gamme $gamme, Product $product)
|
||||
{
|
||||
$seoDatum = new SeoDatum();
|
||||
|
|
@ -19,6 +26,12 @@ class ProductsController extends Controller
|
|||
return view('front.product', compact('product', 'gamme', 'seoDatum'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a list of products resulting from search query
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function search(Request $request)
|
||||
{
|
||||
$filter = $request->query('filter');
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\Lang;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
|
||||
class TranslationController extends Controller
|
||||
{
|
||||
public function switch($locale)
|
||||
{
|
||||
if (! in_array($locale, Lang::toValues())) {
|
||||
abort(400);
|
||||
}
|
||||
|
||||
Cookie::queue(Cookie::forever('language', $locale));
|
||||
|
||||
if (url()->full() !== url()->previous()) {
|
||||
return redirect()->back();
|
||||
}
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
|
|
@ -36,6 +36,7 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
'lang-check',
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Undocumented class
|
||||
|
|
@ -29,11 +30,10 @@ class Authenticate extends Middleware
|
|||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request La requête
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
protected function redirectTo(Request $request)
|
||||
{
|
||||
if (!$request->expectsJson()) {
|
||||
return route('bo.login');
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ class BackEndGlobals
|
|||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request):(\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
|
|
|
|||
|
|
@ -4,21 +4,23 @@ namespace App\Http\Middleware;
|
|||
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Closure;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class FrontEndGlobals
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request):(\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
// header menu
|
||||
// Header menu.
|
||||
$currentRoute = Route::current()->getName();
|
||||
$routeParamsFR = Route::current()->parameters();
|
||||
$routeParamsEN = $routeParamsFR;
|
||||
|
|
@ -46,10 +48,21 @@ class FrontEndGlobals
|
|||
return $next($request);
|
||||
}
|
||||
|
||||
public function unbind(&$item, $k, $lang)
|
||||
/**
|
||||
* Switch locale for translatable models
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $item
|
||||
* @param string $key
|
||||
* @param string $locale
|
||||
* @return void
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
|
||||
*/
|
||||
private function unbind(Model &$item, string $key, string $locale)
|
||||
{
|
||||
if ($k == 'gammeSlug' || $k == 'productSlug') {
|
||||
$item = $item->getTranslation('slug', $lang);
|
||||
// phpcs:enable
|
||||
$classUses = class_uses($item);
|
||||
if ($classUses and (\in_array(HasTranslations::class, $classUses))) {
|
||||
$item = (clone $item)->setLocale($locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,13 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
class LangCheck
|
||||
{
|
||||
/**
|
||||
* The available languages.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $langs = ['fr','en','es'];
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
|
|
@ -22,24 +28,24 @@ class LangCheck
|
|||
|
||||
$routName = $request->route()->getName();
|
||||
if (preg_match('/^bo\./', $routName)) {
|
||||
// Back office
|
||||
// Back office.
|
||||
if ($request->lang) {
|
||||
// within bo we set lang with querystring param
|
||||
// Within bo we set lang with querystring param.
|
||||
$this->saveUserLocale($request->lang, $request);
|
||||
// bonus remove lang parameter from query
|
||||
// Bonus remove lang parameter from query.
|
||||
return redirect()->to($request->fullUrlWithoutQuery('lang'));
|
||||
} else {
|
||||
$this->checkFirstAccess($request);
|
||||
}
|
||||
} else {
|
||||
// FRONT
|
||||
// FRONT.
|
||||
if (preg_match('/^(en|es)\./', $routName)) {
|
||||
// from front use named routes
|
||||
// From front use named routes.
|
||||
$langset = $request->segment(1);
|
||||
|
||||
$this->saveUserLocale($langset, $request);
|
||||
} else {
|
||||
// not specified in route
|
||||
// Not specified in route.
|
||||
if ($this->checkFirstAccess($request)) {
|
||||
$routNameEN = 'en.' . $routName;
|
||||
$routNameES = 'es.' . $routName;
|
||||
|
|
@ -62,49 +68,56 @@ class LangCheck
|
|||
|
||||
$sess_lang = $request->session()->get('lang', config('app.locale'));
|
||||
app()->setLocale($sess_lang);
|
||||
config(['app.locale' => $sess_lang]);
|
||||
$routePrefixer = "";
|
||||
if ($sess_lang != 'fr') {
|
||||
$routePrefixer = $sess_lang . '.';
|
||||
}
|
||||
View::share('routeprefixer', $routePrefixer);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Register Current user choice for language
|
||||
*
|
||||
* @param string $lang
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function saveUserLocale($lang, Request $request)
|
||||
private function saveUserLocale(string $lang, Request $request)
|
||||
{
|
||||
// Set cookie
|
||||
// Set cookie.
|
||||
Cookie::queue(Cookie::forever('language', strtolower($lang)));
|
||||
// set session
|
||||
// Set session.
|
||||
$request->session()->put('lang', strtolower($lang));
|
||||
}
|
||||
|
||||
/**
|
||||
* checks if we have saved locale info for current user
|
||||
* if not find then save that locale
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
private function checkFirstAccess(Request $request)
|
||||
{
|
||||
// do we have session ?
|
||||
// Do we have session ?
|
||||
if (!$request->session()->has('lang')) {
|
||||
$fromC = Cookie::get('language');
|
||||
if (is_null($fromC) || empty($fromC)) {
|
||||
// pas de cookie, recherche sur le navigateur
|
||||
// Pas de cookie, recherche sur le navigateur.
|
||||
$fromC = substr($request->server('HTTP_ACCEPT_LANGUAGE'), 0, 2);
|
||||
if (!in_array($fromC, $this->langs)) {
|
||||
// default other languages to en
|
||||
// Default other languages to en.
|
||||
$fromC = 'en';
|
||||
}
|
||||
}
|
||||
$this->saveUserLocale($fromC, $request);
|
||||
return true;
|
||||
}
|
||||
// we have lang session
|
||||
// We have lang session.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace App\Http\Requests;
|
|||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class StorePostRequest extends FormRequest
|
||||
{
|
||||
|
|
@ -14,6 +15,18 @@ class StorePostRequest extends FormRequest
|
|||
* @return boolean
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws ValidationException When prepare merge fails to parse dates.
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
try {
|
||||
$this->merge([
|
||||
|
|
@ -21,12 +34,13 @@ class StorePostRequest extends FormRequest
|
|||
'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
|
||||
'on_top' => $this->on_top ? true : false,
|
||||
]);
|
||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
} catch (InvalidFormatException $e) {
|
||||
// On fait rien
|
||||
$error = ValidationException::withMessages([
|
||||
'date_start_date' => ['Format de date incorrect'],
|
||||
'date_end_date' => ['Format de date incorrect'],
|
||||
]);
|
||||
throw $error;
|
||||
}
|
||||
|
||||
return auth()->check();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
namespace App\Http\Requests;
|
||||
|
||||
use App\Models\Gamme;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
|
|
@ -23,142 +22,136 @@ class StoreProductRequest extends FormRequest
|
|||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
* @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
*/
|
||||
//phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
try {
|
||||
$tabFour = array(
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/four.png',
|
||||
'time' => $this->time_cook0,
|
||||
'temp' => $this->temp_cook0,
|
||||
'status' => $this->is_activated0 ? true : false
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/friteuse.png',
|
||||
'time' => $this->time_cook1,
|
||||
'temp' => $this->temp_cook1,
|
||||
'status' => $this->is_activated1 ? true : false
|
||||
);
|
||||
$tabPoele = array(
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/poele.png',
|
||||
'time' => $this->time_cook2,
|
||||
'temp' => $this->temp_cook2,
|
||||
'status' => $this->is_activated2 ? true : false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/cocotte.png',
|
||||
'time' => $this->time_cook3,
|
||||
'temp' => $this->temp_cook3,
|
||||
'status' => $this->is_activated3 ? true : false
|
||||
);
|
||||
$tabPlancha = array(
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/plancha.png',
|
||||
'time' => $this->time_cook4,
|
||||
'temp' => $this->temp_cook4,
|
||||
'status' => $this->is_activated4 ? true : false
|
||||
);
|
||||
$tabBainMarie = array(
|
||||
'id' => 5,
|
||||
'name' => 'Bain Marie',
|
||||
'url' => '/assets/images/bainmarie.png',
|
||||
'time' => $this->time_cook5,
|
||||
'temp' => $this->temp_cook5,
|
||||
'status' => $this->is_activated5 ? true : false
|
||||
);
|
||||
$tabBarbecue = array(
|
||||
'id' => 6,
|
||||
'name' => 'Barbecue',
|
||||
'url' => '/assets/images/barbecue.png',
|
||||
'time' => $this->time_cook6,
|
||||
'temp' => $this->temp_cook6,
|
||||
'status' => $this->is_activated6 ? true : false
|
||||
);
|
||||
$tabMicroOndes = array(
|
||||
'id' => 7,
|
||||
'name' => 'Micro Ondes',
|
||||
'url' => '/assets/images/micro-onde.png',
|
||||
'time' => $this->time_cook7,
|
||||
'temp' => $this->temp_cook7,
|
||||
'status' => $this->is_activated7 ? true : false
|
||||
);
|
||||
$tabCasserole = array(
|
||||
'id' => 8,
|
||||
'name' => 'Casserole',
|
||||
'url' => '/assets/images/casserole.png',
|
||||
'time' => $this->time_cook8,
|
||||
'temp' => $this->temp_cook8,
|
||||
'status' => $this->is_activated8 ? true : false
|
||||
);
|
||||
$tabCuisson = json_encode([
|
||||
'four' => $tabFour,
|
||||
'friteuse' => $tabFriteuse,
|
||||
'poele' => $tabPoele,
|
||||
'cocotte' => $tabCocotte,
|
||||
'plancha' => $tabPlancha,
|
||||
'bainmarie' => $tabBainMarie,
|
||||
'barbecue' => $tabBarbecue,
|
||||
'microondes' => $tabMicroOndes,
|
||||
'casserole' => $tabCasserole
|
||||
]);
|
||||
$tabFour = array(
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/four.png',
|
||||
'time' => $this->time_cook0,
|
||||
'temp' => $this->temp_cook0,
|
||||
'status' => $this->is_activated0 ? true : false
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/friteuse.png',
|
||||
'time' => $this->time_cook1,
|
||||
'temp' => $this->temp_cook1,
|
||||
'status' => $this->is_activated1 ? true : false
|
||||
);
|
||||
$tabPoele = array(
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/poele.png',
|
||||
'time' => $this->time_cook2,
|
||||
'temp' => $this->temp_cook2,
|
||||
'status' => $this->is_activated2 ? true : false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/cocotte.png',
|
||||
'time' => $this->time_cook3,
|
||||
'temp' => $this->temp_cook3,
|
||||
'status' => $this->is_activated3 ? true : false
|
||||
);
|
||||
$tabPlancha = array(
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/plancha.png',
|
||||
'time' => $this->time_cook4,
|
||||
'temp' => $this->temp_cook4,
|
||||
'status' => $this->is_activated4 ? true : false
|
||||
);
|
||||
$tabBainMarie = array(
|
||||
'id' => 5,
|
||||
'name' => 'Bain Marie',
|
||||
'url' => '/assets/images/bainmarie.png',
|
||||
'time' => $this->time_cook5,
|
||||
'temp' => $this->temp_cook5,
|
||||
'status' => $this->is_activated5 ? true : false
|
||||
);
|
||||
$tabBarbecue = array(
|
||||
'id' => 6,
|
||||
'name' => 'Barbecue',
|
||||
'url' => '/assets/images/barbecue.png',
|
||||
'time' => $this->time_cook6,
|
||||
'temp' => $this->temp_cook6,
|
||||
'status' => $this->is_activated6 ? true : false
|
||||
);
|
||||
$tabMicroOndes = array(
|
||||
'id' => 7,
|
||||
'name' => 'Micro Ondes',
|
||||
'url' => '/assets/images/micro-onde.png',
|
||||
'time' => $this->time_cook7,
|
||||
'temp' => $this->temp_cook7,
|
||||
'status' => $this->is_activated7 ? true : false
|
||||
);
|
||||
$tabCasserole = array(
|
||||
'id' => 8,
|
||||
'name' => 'Casserole',
|
||||
'url' => '/assets/images/casserole.png',
|
||||
'time' => $this->time_cook8,
|
||||
'temp' => $this->temp_cook8,
|
||||
'status' => $this->is_activated8 ? true : false
|
||||
);
|
||||
$tabCuisson = json_encode([
|
||||
'four' => $tabFour,
|
||||
'friteuse' => $tabFriteuse,
|
||||
'poele' => $tabPoele,
|
||||
'cocotte' => $tabCocotte,
|
||||
'plancha' => $tabPlancha,
|
||||
'bainmarie' => $tabBainMarie,
|
||||
'barbecue' => $tabBarbecue,
|
||||
'microondes' => $tabMicroOndes,
|
||||
'casserole' => $tabCasserole
|
||||
]);
|
||||
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme0) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme0->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit1 = array(
|
||||
'id' => 0,
|
||||
'name' => $this->content0,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme1) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme1->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit2 = array(
|
||||
'id' => 1,
|
||||
'name' => $this->content1,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme2) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme2->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit3 = array(
|
||||
'id' => 2,
|
||||
'name' => $this->content2,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$tabPlusProduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->name),
|
||||
'gamme_id' =>
|
||||
$this->is_food_service ?
|
||||
Gamme::where("slug->fr", "food-service")->firstOrFail()->id :
|
||||
$this->gamme_id,
|
||||
'pictos' => $tabCuisson,
|
||||
'plusproduit' => $tabPlusProduit,
|
||||
'is_published' => $this->is_published ? true : false,
|
||||
'is_on_top' => $this->is_on_top ? true : false,
|
||||
'is_news' => $this->is_news ? true : false,
|
||||
'is_food_service' => $this->is_food_service ? true : false,
|
||||
'is_halal' => $this->is_halal ? true : false,
|
||||
]);
|
||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
} catch (InvalidFormatException $e) {
|
||||
// On fait rien
|
||||
}//end try
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme0) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme0->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit1 = array(
|
||||
'id' => 0,
|
||||
'name' => $this->content0,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme1) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme1->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit2 = array(
|
||||
'id' => 1,
|
||||
'name' => $this->content1,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme2) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme2->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit3 = array(
|
||||
'id' => 2,
|
||||
'name' => $this->content2,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
$tabPlusProduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->name),
|
||||
'gamme_id' =>
|
||||
$this->is_food_service ?
|
||||
Gamme::where("slug->fr", "food-service")->firstOrFail()->id :
|
||||
$this->gamme_id,
|
||||
'pictos' => $tabCuisson,
|
||||
'plusproduit' => $tabPlusProduit,
|
||||
'is_published' => $this->is_published ? true : false,
|
||||
'is_on_top' => $this->is_on_top ? true : false,
|
||||
'is_news' => $this->is_news ? true : false,
|
||||
'is_food_service' => $this->is_food_service ? true : false,
|
||||
'is_halal' => $this->is_halal ? true : false,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ class StoreSlideRequest extends FormRequest
|
|||
* Prepare the data for validation.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws ValidationException When prepare merge fails to parse dates.
|
||||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
|
|
@ -30,9 +32,12 @@ class StoreSlideRequest extends FormRequest
|
|||
'date_start' => Carbon::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
|
||||
'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
|
||||
]);
|
||||
// phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch
|
||||
} catch (InvalidFormatException $e) {
|
||||
// On fait rien
|
||||
$error = \Illuminate\Validation\ValidationException::withMessages([
|
||||
'date_start_date' => ['Format de date incorrect'],
|
||||
'date_end_date' => ['Format de date incorrect'],
|
||||
]);
|
||||
throw $error;
|
||||
}
|
||||
$this->merge([
|
||||
'title' => 'lorem title ' . rand(),
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ class Utils
|
|||
* @param \Illuminate\Http\UploadedFile|\SplFileInfo|string $image
|
||||
* @param string $folderName
|
||||
* @return string The storage path
|
||||
*
|
||||
* @throws \ErrorException If file copy fails.
|
||||
* @throws Exception If didn't manage to return a file path.
|
||||
*/
|
||||
public static function storeImage($image, string $folderName): string
|
||||
{
|
||||
|
|
@ -39,7 +42,7 @@ class Utils
|
|||
$image = $image;
|
||||
$newPath = self::prepareMoveFile($image->getBaseName(), $folderName);
|
||||
if (!File::copy($image->getRealPath(), $newPath)) {
|
||||
throw new \Exception(sprintf(
|
||||
throw new \ErrorException(sprintf(
|
||||
'Failed to copy file %s to %s',
|
||||
$image->getRealPath(),
|
||||
$newPath
|
||||
|
|
@ -52,6 +55,15 @@ class Utils
|
|||
}
|
||||
throw new Exception(sprintf('Cannot handle image %s', \gettype($image)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare storage path and return
|
||||
* the image full path
|
||||
*
|
||||
* @param string $filename The basename for the file.
|
||||
* @param string $folderName Foldername for storage.
|
||||
* @return string
|
||||
*/
|
||||
private static function prepareMoveFile(string $filename, string $folderName): string
|
||||
{
|
||||
$pathFolder = \storage_path("app/public/images/$folderName");
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ class SendContactMail extends Mailable
|
|||
|
||||
/**
|
||||
* The form data.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
|
|
@ -47,9 +49,11 @@ class SendContactMail extends Mailable
|
|||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($data)
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class Advice extends Model
|
|||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title1',
|
||||
'title2',
|
||||
|
|
@ -26,6 +31,11 @@ class Advice extends Model
|
|||
'text2',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title1',
|
||||
'title2',
|
||||
|
|
@ -39,7 +49,12 @@ class Advice extends Model
|
|||
'text2',
|
||||
];
|
||||
|
||||
//phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
* @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Advice $advice) {
|
||||
|
|
|
|||
|
|
@ -14,10 +14,20 @@ class Encart extends Model
|
|||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -26,6 +36,11 @@ class Encart extends Model
|
|||
'alt_text_picture',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -34,6 +49,11 @@ class Encart extends Model
|
|||
'alt_text_picture',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Encart $encart) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class Gamme extends Model
|
|||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'parent_gamme_id',
|
||||
'title',
|
||||
|
|
@ -25,6 +30,11 @@ class Gamme extends Model
|
|||
'alt_text_banner',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'slug',
|
||||
|
|
@ -35,7 +45,12 @@ class Gamme extends Model
|
|||
'alt_text_banner',
|
||||
];
|
||||
|
||||
//phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
* @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Gamme $gamme) {
|
||||
|
|
@ -47,7 +62,7 @@ class Gamme extends Model
|
|||
}
|
||||
|
||||
if ($gamme->parent_gamme_id != null) {
|
||||
// Si Creation gamme enfant sans enfant, alors il faut update sa couleur selon celle du parent
|
||||
// Si Creation gamme enfant sans enfant, alors il faut update sa couleur selon celle du parent.
|
||||
$gamme->color = Gamme::whereId($gamme->parent_gamme_id)->select(['color'])->first()->color;
|
||||
}
|
||||
});
|
||||
|
|
@ -60,7 +75,7 @@ class Gamme extends Model
|
|||
$gamme->banner = Utils::storeImage($gamme->banner, $gamme->getTable());
|
||||
}
|
||||
if ($gamme->parent_gamme_id === null) {
|
||||
// Si Update gamme parente, alors il faut update la couleur des enfants
|
||||
// Si Update gamme parente, alors il faut update la couleur des enfants.
|
||||
Gamme::whereParentGammeId($gamme->id)
|
||||
->update(['color' => $gamme->color]);
|
||||
} elseif ($gamme->childGammes()->exists()) {
|
||||
|
|
@ -73,7 +88,7 @@ class Gamme extends Model
|
|||
Gamme::whereParentGammeId($gamme->id)
|
||||
->update(['parent_gamme_id' => null]);
|
||||
} else {
|
||||
// Si Update gamme enfant sans enfant, alors il faut update sa couleur selon celle du parent
|
||||
// Si Update gamme enfant sans enfant, alors il faut update sa couleur selon celle du parent.
|
||||
$gamme->color = Gamme::whereId($gamme->parent_gamme_id)->select(['color'])->first()->color;
|
||||
}
|
||||
});
|
||||
|
|
@ -106,6 +121,11 @@ class Gamme extends Model
|
|||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* map hex color notation to rgba() syntax
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRgbaColorAttribute()
|
||||
{
|
||||
$color = $this->color;
|
||||
|
|
@ -121,11 +141,21 @@ class Gamme extends Model
|
|||
return "rgba($r,$g,$b,1)";
|
||||
}
|
||||
|
||||
/**
|
||||
* HasMany childGammes relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function childGammes()
|
||||
{
|
||||
return $this->hasMany(Gamme::class, 'parent_gamme_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo parentGamme relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function parentGamme()
|
||||
{
|
||||
return $this->belongsTo(Gamme::class);
|
||||
|
|
@ -133,6 +163,9 @@ class Gamme extends Model
|
|||
|
||||
/**
|
||||
* Get Products for the Range.
|
||||
* HasMany products relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function products()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,10 +14,20 @@ class Moment extends Model
|
|||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -26,6 +36,11 @@ class Moment extends Model
|
|||
'alt_text_picture',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -34,6 +49,11 @@ class Moment extends Model
|
|||
'alt_text_picture',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Moment $moment) {
|
||||
|
|
|
|||
|
|
@ -14,22 +14,42 @@ class Picto extends Model
|
|||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Picto $picto) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class PictoBrand extends Model
|
|||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'picture',
|
||||
|
|
@ -20,6 +25,11 @@ class PictoBrand extends Model
|
|||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'picture',
|
||||
|
|
@ -27,6 +37,11 @@ class PictoBrand extends Model
|
|||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (PictoBrand $pictoBrand) {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ class Post extends Model
|
|||
'date_end' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -35,6 +40,11 @@ class Post extends Model
|
|||
'on_top'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -44,7 +54,12 @@ class Post extends Model
|
|||
'alt_text_picture_news'
|
||||
];
|
||||
|
||||
//phpcs:ignore Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
* @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Post $post) {
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ class Product extends Model
|
|||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'gamme_id',
|
||||
'name',
|
||||
|
|
@ -31,6 +36,11 @@ class Product extends Model
|
|||
'seo_description',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'name',
|
||||
'slug',
|
||||
|
|
@ -43,6 +53,11 @@ class Product extends Model
|
|||
'seo_description',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Product $product) {
|
||||
|
|
@ -66,7 +81,7 @@ class Product extends Model
|
|||
}
|
||||
}
|
||||
}
|
||||
// delete des images de plus produit
|
||||
// Delete des images de plus produit.
|
||||
$plusproduit = json_decode($product->plusproduit);
|
||||
foreach ($plusproduit as $plus) {
|
||||
$urlPicture = public_path() . $plus->url;
|
||||
|
|
@ -82,6 +97,8 @@ class Product extends Model
|
|||
|
||||
/**
|
||||
* Get the Range that owns the product.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function gamme()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ class SeoDatum extends Model
|
|||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
|
@ -47,4 +52,35 @@ class SeoDatum extends Model
|
|||
{
|
||||
return 'page';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Generic attribute value
|
||||
*
|
||||
* @param mixed $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function getAttributeValue($key)
|
||||
{
|
||||
if ($this->hasEnumCast($key)) {
|
||||
$value = parent::getAttributeValue($key);
|
||||
return $this->castToEnum($key, $value);
|
||||
}
|
||||
|
||||
return $this->TransGetAttributeValue($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a given attribute on the model.
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function setAttribute($key, $value)
|
||||
{
|
||||
if ($this->hasEnumCast($key)) {
|
||||
return $this->EnumSetAttribute($key, $value);
|
||||
}
|
||||
return $this->TransSetAttribute($key, $value);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ class Slide extends Model
|
|||
'date_end' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -36,6 +41,11 @@ class Slide extends Model
|
|||
'date_end'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -45,6 +55,11 @@ class Slide extends Model
|
|||
'alt_text_picture'
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Slide $slide) {
|
||||
|
|
@ -72,6 +87,11 @@ class Slide extends Model
|
|||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* BelongsTo slider relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function slider()
|
||||
{
|
||||
return $this->belongsTo(Slider::class);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,11 @@ class Slider extends Model
|
|||
use HasFactory;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'label',
|
||||
'slug',
|
||||
|
|
@ -19,17 +24,32 @@ class Slider extends Model
|
|||
'published'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'label',
|
||||
'slug',
|
||||
'commentaire'
|
||||
];
|
||||
|
||||
/**
|
||||
* HasMany slides relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function slides()
|
||||
{
|
||||
return $this->hasMany(Slide::class, 'slider_id')->orderBy('order', 'ASC');
|
||||
}
|
||||
|
||||
/**
|
||||
* HasMany showable slides relation
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
*/
|
||||
public function showableSlides()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
|
|
|
|||
|
|
@ -3,24 +3,41 @@
|
|||
namespace App\Models;
|
||||
|
||||
use App\Enums\Page;
|
||||
use App\Traits\CastsEnumsHasTranslations;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kwaadpepper\Enum\Traits\CastsEnums;
|
||||
use Spatie\Translatable\HasTranslations;
|
||||
|
||||
class Text extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
use CastsEnums;
|
||||
use HasTranslations;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
|
|||
|
|
@ -12,15 +12,30 @@ class Title extends Model
|
|||
use HasFactory;
|
||||
use CastsEnumsHasTranslations;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $enumCasts = [
|
||||
'page' => Page::class
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that are translatable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $translatable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
|
|||
|
|
@ -15,6 +15,11 @@ class User extends Authenticatable
|
|||
use Notifiable;
|
||||
use CastsEnums;
|
||||
|
||||
/**
|
||||
* Map attribute names to enum classes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $enumCasts = [
|
||||
'role' => Role::class
|
||||
];
|
||||
|
|
@ -49,6 +54,11 @@ class User extends Authenticatable
|
|||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Perform any actions required after the model boots.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (User $user) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Providers;
|
|||
|
||||
use App\Models\Gamme;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
|
|
@ -31,18 +32,45 @@ class RouteServiceProvider extends ServiceProvider
|
|||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
|
||||
//phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassAfterLastUsed
|
||||
Route::bind('gammeSlug', function ($value, $route) {
|
||||
$gamme = Gamme::where('slug', 'LIKE', '%:"' . $value . '"%')->firstOrFail();
|
||||
return $gamme;
|
||||
Route::bind('gammeSlug', function ($value) {
|
||||
/** @var string $locale @var string $defaultLocale @var string $value */
|
||||
$vars = $this->getRouteBinderVars($value);
|
||||
\extract($vars);
|
||||
/** @var \App\Models\Gamme */
|
||||
$gamme = Gamme::where(function (Builder $q) use ($locale, $defaultLocale, $value) {
|
||||
$q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'")
|
||||
->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'");
|
||||
})->firstOrFail();
|
||||
return $gamme->setLocale($locale);
|
||||
});
|
||||
|
||||
Route::bind('productSlug', function ($value, $route) {
|
||||
$gamme = $route->parameter('gammeSlug');
|
||||
$product = Product::where('slug', 'LIKE', '%:"' . $value . '"%')
|
||||
->where('gamme_id', $gamme->id)
|
||||
->firstOrFail();
|
||||
return $product;
|
||||
/** @var \Illuminate\Routing\Route $route */
|
||||
$gamme = $route->parameter('gammeSlug');
|
||||
|
||||
/** @var string $locale @var string $defaultLocale @var string $value */
|
||||
$vars = $this->getRouteBinderVars($value);
|
||||
\extract($vars);
|
||||
/** @var \App\Models\Product */
|
||||
$product = Product::where(function (Builder $q) use ($locale, $defaultLocale, $value) {
|
||||
$q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'")
|
||||
->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'");
|
||||
})->where('gamme_id', $gamme->id)
|
||||
->firstOrFail();
|
||||
return $product->setLocale($locale);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get route binder common
|
||||
* @param string $value
|
||||
* @return string[]
|
||||
*/
|
||||
private function getRouteBinderVars(string $value): array
|
||||
{
|
||||
$locale = \app()->getLocale();
|
||||
$defaultLocale = \config('translatable.fallback_locale');
|
||||
$value = \filter_var($value, \FILTER_SANITIZE_STRING);
|
||||
return compact('locale', 'defaultLocale', 'value');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ trait CastsEnumsHasTranslations
|
|||
|
||||
/**
|
||||
* Manually mix getAttributeValue from CastsEnums and HasTranslations
|
||||
*
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAttributeValue($key)
|
||||
{
|
||||
|
|
@ -28,6 +32,11 @@ trait CastsEnumsHasTranslations
|
|||
|
||||
/**
|
||||
* Manually mix setAttribute from CastsEnums and HasTranslations
|
||||
*
|
||||
* @param mixed $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function setAttribute($key, $value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ return [
|
|||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
|
|
@ -169,6 +170,7 @@ return [
|
|||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
|
|
@ -227,7 +229,7 @@ return [
|
|||
'Validator' => Illuminate\Support\Facades\Validator::class,
|
||||
'View' => Illuminate\Support\Facades\View::class,
|
||||
|
||||
// Enums
|
||||
// Enums.
|
||||
'Page' => \App\Enums\Page::class,
|
||||
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| App parameters
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ return [
|
|||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
// Contacts List
|
||||
// Contacts List.
|
||||
'contactsList' => [
|
||||
'contactform' => explode(",", env('MAIL_LIST_CONTACTFORM', 'equipe.web@ldc.fr'))
|
||||
],
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ return [
|
|||
'settings' => [
|
||||
'default' => [
|
||||
'HTML.SafeIframe' => true,
|
||||
// For iframes
|
||||
// For iframes.
|
||||
'URI.SafeIframeRegexp' => "%^(http://|https://|//)(vimeo.com)%",
|
||||
'HTML.Doctype' => 'HTML 4.01 Transitional',
|
||||
'HTML.Allowed' => 'h1[style],h2[style],h3[style],h4[style],h5[style],h6[style],figure[class],oembed[url],div,b,strong,i,em,u,a[href|title],ul[style],ol[style],dl[style],li,p[style],br,span[style|class],img[width|height|alt|src],iframe[src|width|height|class|frameborder],table,thead,tbody,th,tr,td,hr',
|
||||
|
|
@ -44,7 +44,7 @@ return [
|
|||
'rev' => 1,
|
||||
'debug' => true,
|
||||
'elements' => [
|
||||
// http://developers.whatwg.org/sections.html
|
||||
// See : http://developers.whatwg.org/sections.html .
|
||||
['section', 'Block', 'Flow', 'Common'],
|
||||
['nav', 'Block', 'Flow', 'Common'],
|
||||
['article', 'Block', 'Flow', 'Common'],
|
||||
|
|
@ -52,16 +52,16 @@ return [
|
|||
['header', 'Block', 'Flow', 'Common'],
|
||||
['footer', 'Block', 'Flow', 'Common'],
|
||||
|
||||
// Content model actually excludes several tags, not modelled here
|
||||
// Content model actually excludes several tags, not modelled here.
|
||||
['address', 'Block', 'Flow', 'Common'],
|
||||
['hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common'],
|
||||
|
||||
// http://developers.whatwg.org/grouping-content.html
|
||||
// See : http://developers.whatwg.org/grouping-content.html .
|
||||
['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'],
|
||||
['figcaption', 'Inline', 'Flow', 'Common'],
|
||||
['oembed', 'Inline', 'Flow', 'Common'],
|
||||
|
||||
// http://developers.whatwg.org/the-video-element.html#the-video-element
|
||||
// See : http://developers.whatwg.org/the-video-element.html#the-video-element .
|
||||
['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
|
||||
'src' => 'URI',
|
||||
'type' => 'Text',
|
||||
|
|
@ -76,7 +76,7 @@ return [
|
|||
'type' => 'Text',
|
||||
]],
|
||||
|
||||
// http://developers.whatwg.org/text-level-semantics.html
|
||||
// See : http://developers.whatwg.org/text-level-semantics.html .
|
||||
['s', 'Inline', 'Inline', 'Common'],
|
||||
['var', 'Inline', 'Inline', 'Common'],
|
||||
['sub', 'Inline', 'Inline', 'Common'],
|
||||
|
|
@ -84,7 +84,7 @@ return [
|
|||
['mark', 'Inline', 'Inline', 'Common'],
|
||||
['wbr', 'Inline', 'Empty', 'Core'],
|
||||
|
||||
// http://developers.whatwg.org/edits.html
|
||||
// See : http://developers.whatwg.org/edits.html .
|
||||
['ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
||||
['del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
|
||||
],
|
||||
|
|
|
|||
12
config/translatable.php
Normal file
12
config/translatable.php
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/**
|
||||
* If a translation has not been set for a given locale, use this locale instead.
|
||||
*
|
||||
*
|
||||
*! Les modèles sont d'abord traduits en FR
|
||||
*/
|
||||
'fallback_locale' => 'fr',
|
||||
];
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Package driver
|
||||
|
|
@ -11,6 +12,7 @@ return [
|
|||
| Supported: "file", "database"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'database',
|
||||
|
||||
/*
|
||||
|
|
@ -22,6 +24,7 @@ return [
|
|||
| configuration here to configure the routes with your preferred group options.
|
||||
|
|
||||
*/
|
||||
|
||||
'route_group_config' => [
|
||||
'middleware' => [
|
||||
'web',
|
||||
|
|
@ -38,6 +41,7 @@ return [
|
|||
| when finding missing translations.
|
||||
|
|
||||
*/
|
||||
|
||||
'translation_methods' => ['trans', '__'],
|
||||
|
||||
/*
|
||||
|
|
@ -49,6 +53,7 @@ return [
|
|||
| looking for missing translations.
|
||||
|
|
||||
*/
|
||||
|
||||
'scan_paths' => [
|
||||
resource_path() . '/views/front',
|
||||
resource_path() . '/views/layouts/frontend',
|
||||
|
|
@ -62,6 +67,7 @@ return [
|
|||
| Define the URL used to access the language management too.
|
||||
|
|
||||
*/
|
||||
|
||||
'ui_url' => 'bo/languages',
|
||||
|
||||
/*
|
||||
|
|
@ -72,6 +78,7 @@ return [
|
|||
| Define the settings for the database driver here.
|
||||
|
|
||||
*/
|
||||
|
||||
'database' => [
|
||||
|
||||
'connection' => '',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class UserFactory extends Factory
|
|||
'email' => $this->faker->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi',
|
||||
// password
|
||||
// Password is : password .
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,14 +61,14 @@ Route::prefix('bo')
|
|||
'logout' => true,
|
||||
'register' => false,
|
||||
'reset' => false,
|
||||
// for resetting passwords
|
||||
// For resetting passwords.
|
||||
'confirm' => false,
|
||||
// for additional password confirmations
|
||||
// For additional password confirmations.
|
||||
'verify' => false,
|
||||
// for email verification
|
||||
// For email verification.
|
||||
]
|
||||
);
|
||||
Route::middleware(['auth:web', 'back-end-globals', 'lang-check'])
|
||||
Route::middleware(['auth:web', 'back-end-globals'])
|
||||
->group(
|
||||
function () {
|
||||
Route::get(
|
||||
|
|
@ -117,29 +117,55 @@ Route::prefix('bo')
|
|||
$langs = ['en', 'es', ''];
|
||||
|
||||
foreach ($langs as $lang) {
|
||||
Route::middleware(['front-end-globals', 'lang-check'])
|
||||
Route::middleware(['front-end-globals'])
|
||||
->prefix($lang)
|
||||
->name($lang == '' ? '' : $lang . '.')
|
||||
->group(
|
||||
function () use ($lang) {
|
||||
Route::get('/', [ControllersHomeController::class, 'index'])->name('home');
|
||||
// phpcs:disable Generic.Files.LineLength.TooLong
|
||||
Route::get('/' . Str::slug(Lang::get('urls.marque', [], $lang)), [ControllersMarqueController::class, 'index'])->name('wasup');
|
||||
Route::get('/' . Str::slug(Lang::get('urls.gammes', [], $lang)), [ControllersGammesController::class, 'index'])->name('gammes.index');
|
||||
Route::get('/' . Str::slug(Lang::get('urls.gamme', [], $lang)) . '/{gammeSlug}', [ControllersGammesController::class, 'show'])->name('gammes.show');
|
||||
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.produit', [], $lang)) . '/{gammeSlug}/{productSlug}',
|
||||
'/' . Str::slug(Lang::get('urls.marque', [], $lang)),
|
||||
[ControllersMarqueController::class, 'index']
|
||||
)->name('wasup');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.gammes', [], $lang)),
|
||||
[ControllersGammesController::class, 'index']
|
||||
)->name('gammes.index');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.gamme', [], $lang)) . '/{gammeSlug:slug}',
|
||||
[ControllersGammesController::class, 'show']
|
||||
)->name('gammes.show');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.produit', [], $lang)) . '/{gammeSlug:slug}/{productSlug:slug}',
|
||||
[ControllersProductsController::class, 'show']
|
||||
)->name('product.show');
|
||||
Route::get('/' . Str::slug(Lang::get('urls.news', [], $lang)), [ControllersNewsController::class, 'index'])->name('news');
|
||||
Route::get('/' . Str::slug(Lang::get('urls.food-service', [], $lang)), [ControllersFoodServiceController::class, 'index'])->name('food');
|
||||
Route::get('/' . Str::slug(Lang::get('urls.legals', [], $lang)), [ControllersLegalsController::class, 'index'])->name('cgu');
|
||||
Route::get('/' . Str::slug(Lang::get('urls.policy', [], $lang)), [ControllersPolicyController::class, 'index'])->name('policy');
|
||||
Route::get('/' . Str::slug(Lang::get('urls.search', [], $lang)), [ControllersProductsController::class, 'search'])->name('search');
|
||||
// Classic
|
||||
Route::get('/' . Str::slug(Lang::get('urls.contact', [], $lang)), [ControllersContactController::class, 'contact'])->name('contact');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.news', [], $lang)),
|
||||
[ControllersNewsController::class, 'index']
|
||||
)->name('news');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.food-service', [], $lang)),
|
||||
[ControllersFoodServiceController::class, 'index']
|
||||
)->name('food');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.legals', [], $lang)),
|
||||
[ControllersLegalsController::class, 'index']
|
||||
)->name('cgu');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.policy', [], $lang)),
|
||||
[ControllersPolicyController::class, 'index']
|
||||
)->name('policy');
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.search', [], $lang)),
|
||||
[ControllersProductsController::class, 'search']
|
||||
)->name('search');
|
||||
// Classic.
|
||||
Route::get(
|
||||
'/' . Str::slug(Lang::get('urls.contact', [], $lang)),
|
||||
[ControllersContactController::class, 'contact']
|
||||
)->name('contact');
|
||||
Route::post('/contact', [ControllersContactController::class, 'contactSubmit'])->name('contact.submit');
|
||||
// phpcs:enable
|
||||
}
|
||||
);
|
||||
}//end foreach
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue