Merge branch 'trunk'

This commit is contained in:
Olivier Legat 2022-09-15 11:45:35 +02:00
commit c415db569e
136 changed files with 3426 additions and 2473 deletions

View file

@ -29,6 +29,7 @@ npm-security:
phpcs:
stage: CodingStandards
before_script:
- composer config gitlab-token.gitlab.com $CI_DEPLOY_USER $CI_DEPLOY_PASSWORD
- composer install
cache:
paths:
@ -42,4 +43,4 @@ phpcs:
- phpcs-report.xml
reports:
junit: phpcs-report.xml
allow_failure: false
allow_failure: false

View file

@ -6,7 +6,6 @@ php artisan storage:link
cp .env.example .env
php artisan key:generate
composer install
php artisan vendor:publish --provider="JoeDixon\Translation\TranslationServiceProvider"
```
- Créez la base de données
- Éditez le .env
@ -23,4 +22,4 @@ npm run prod
Put every min in PROD :
```
php artisan schedule:run
```
```

View file

@ -22,26 +22,16 @@ class AdminCreate extends Command
*/
protected $description = 'Create Admin User';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
* @return integer
*/
public function handle()
{
$role = 0;
$name = $this->ask('Name ?');
$email = $this->ask('Email ?');
$role = 0;
$name = $this->ask('Name ?');
$email = $this->ask('Email ?');
$password = $this->secret('What is the password?');
$user = new User([

View file

@ -13,18 +13,17 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
//
];
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
// Write schedules here.
}
/**
@ -34,7 +33,7 @@ class Kernel extends ConsoleKernel
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
$this->load(__DIR__ . '/Commands');
require base_path('routes/console.php');
}

View file

@ -31,6 +31,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
*/
class Page extends BaseEnumRoutable
{
/**
* Enum values
*
* @return array
*/
protected static function values(): array
{
return [

View file

@ -10,6 +10,11 @@ use Kwaadpepper\Enum\BaseEnumRoutable;
*/
class Role extends BaseEnumRoutable
{
/**
* Enum values
*
* @return array
*/
protected static function values(): array
{
return [

View file

@ -2,7 +2,7 @@
/**
* Undocumented class
*
*
* @category Description
* @package Category
* @author Name <email@email.com>
@ -17,7 +17,7 @@ use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler;
/**
* Undocumented class
*
*
* @category Description
* @package Category
* @author Name <email@email.com>

View file

@ -8,18 +8,19 @@ use Illuminate\Foundation\Auth\ConfirmsPasswords;
class ConfirmPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
use ConfirmsPasswords;
/*
|--------------------------------------------------------------------------
| Confirm Password Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password confirmations and
| uses a simple trait to include the behavior. You're free to explore
| this trait and override any functions that require customization.
|
*/
/**
* Where to redirect users when the intended url fails.
*

View file

@ -7,15 +7,18 @@ use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
// On fait rien.
}

View file

@ -2,7 +2,7 @@
/**
* Controller pour le login
*
*
* @category Description
* @package Category
* @author Name <email@email.com>
@ -19,7 +19,7 @@ use Illuminate\Foundation\Auth\AuthenticatesUsers;
/**
* Undocumented class
*
*
* @category Description
* @package Category
* @author Name <email@email.com>
@ -28,18 +28,19 @@ use Illuminate\Foundation\Auth\AuthenticatesUsers;
*/
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
/**
* Where to redirect users after login.
*

View file

@ -11,18 +11,19 @@ use Illuminate\Support\Facades\Validator;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
/**
* Where to redirect users after registration.
*
@ -43,7 +44,7 @@ class RegisterController extends Controller
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
@ -58,7 +59,7 @@ class RegisterController extends Controller
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @param array $data
* @return \App\Models\User
*/
protected function create(array $data)

View file

@ -8,18 +8,19 @@ use Illuminate\Foundation\Auth\ResetsPasswords;
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
/**
* Where to redirect users after resetting their password.
*

View file

@ -8,18 +8,19 @@ use Illuminate\Foundation\Auth\VerifiesEmails;
class VerificationController extends Controller
{
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
use VerifiesEmails;
/*
|--------------------------------------------------------------------------
| Email Verification Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling email verification for any
| user that recently registered with the application. Emails may also
| be re-sent if the user didn't receive the original email message.
|
*/
/**
* Where to redirect users after verification.
*

View file

@ -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'));
@ -24,20 +25,20 @@ class AdviceController extends Controller
/**
* Update the specified resource in storage.
*
* @param Advice $advice
* @param \Illuminate\Http\UpdateAdviceRequest $request
* @param Advice $advice
* @param \Illuminate\Http\UpdateAdviceRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Advice $advice, UpdateAdviceRequest $request)
{
$advice->fill($request->validated());
if (is_a($request->picture1,"SplFileInfo")) {
if (is_a($request->picture1, "SplFileInfo")) {
$advice->picture1 = Utils::storeImage($request->picture1, $advice->getTable());
}
if (is_a($request->picture2,"SplFileInfo")) {
if (is_a($request->picture2, "SplFileInfo")) {
$advice->picture2 = Utils::storeImage($request->picture2, $advice->getTable());
}
if (is_a($request->picture3,"SplFileInfo")) {
if (is_a($request->picture3, "SplFileInfo")) {
$advice->picture3 = Utils::storeImage($request->picture3, $advice->getTable());
}

View file

@ -12,8 +12,10 @@ 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
*/
public function edit(Encart $encart)
{
@ -23,14 +25,14 @@ class EncartsController extends Controller
/**
* Update the specified resource in storage.
*
* @param Encart $encart
* @param \Illuminate\Http\UpdateEncartRequest $request
* @param Encart $encart
* @param \Illuminate\Http\UpdateEncartRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Encart $encart, UpdateEncartRequest $request)
{
$encart->fill($request->validated());
if (is_a($request->picture,"SplFileInfo")) {
if (is_a($request->picture, "SplFileInfo")) {
$encart->picture = Utils::storeImage($request->picture, $encart->getTable());
}

View file

@ -17,7 +17,7 @@ class GammesController extends Controller
*/
public function index()
{
$gammes = collect([]);
$gammes = collect([]);
$dbGammes = Gamme::orderBy('title')->whereNull('parent_gamme_id')
->with('childGammes')->get();
@ -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')
@ -52,8 +54,9 @@ class GammesController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StoreGammeRequest $request
* @return \Illuminate\Http\Response
* @param \Illuminate\Http\StoreGammeRequest $request
*
* @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 Gamme $gamme
* @param \Illuminate\Http\UpdateGammeRequest $request
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(Gamme $gamme, UpdateGammeRequest $request)
{
@ -116,7 +122,7 @@ class GammesController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Gamme $gamme
* @param Gamme $gamme
* @return \Illuminate\Http\Response
*/
public function destroy(Gamme $gamme)

View file

@ -6,8 +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');

View file

@ -9,7 +9,6 @@ use App\Models\Moment;
class MomentsController extends Controller
{
/**
* Display a listing of the resource.
*
@ -25,8 +24,10 @@ 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
*/
public function edit(Moment $moment)
{
@ -36,8 +37,8 @@ class MomentsController extends Controller
/**
* Update the specified resource in storage.
*
* @param Moment $moment
* @param \Illuminate\Http\UpdateMomentRequest $request
* @param Moment $moment
* @param \Illuminate\Http\UpdateMomentRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Moment $moment, UpdateMomentRequest $request)

View file

@ -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'));
@ -37,29 +38,32 @@ class PictoBrandsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StorePictoBrandRequest $request
* @param \Illuminate\Http\StorePictoBrandRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StorePictoBrandRequest $request)
{
$pictobrand = new PictoBrand($request->validated());
if (is_a($request->picture,"SplFileInfo")) {
if (is_a($request->picture, "SplFileInfo")) {
$pictobrand->picture = Utils::storeImage($request->picture, $pictobrand->getTable());
}
if (!$pictobrand->saveOrFail()) {
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)->with('error', 'Le pictogramme n\'a pas été crée');
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
->with('error', 'Le pictogramme n\'a pas été crée');
}
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)->with('success', 'Pictogramme créé !');
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
->with('success', 'Pictogramme créé !');
}
/**
* 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'));
@ -68,14 +72,14 @@ class PictoBrandsController extends Controller
/**
* Update the specified resource in storage.
*
* @param PictoBrand $pictobrand
* @param \Illuminate\Http\UpdatePictoBrandRequest $request
* @param PictoBrand $pictobrand
* @param \Illuminate\Http\UpdatePictoBrandRequest $request
* @return \Illuminate\Http\Response
*/
public function update(PictoBrand $pictobrand, UpdatePictoBrandRequest $request)
{
$pictobrand->fill($request->validated());
if (is_a($request->picture,"SplFileInfo")) {
if (is_a($request->picture, "SplFileInfo")) {
$pictobrand->picture = Utils::storeImage($request->picture, $pictobrand->getTable());
}
@ -91,7 +95,7 @@ class PictoBrandsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param PictoBrand $pictobrand
* @param PictoBrand $pictobrand
* @return \Illuminate\Http\Response
*/
public function destroy(PictoBrand $pictobrand)

View file

@ -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'));
@ -38,7 +41,7 @@ class PictosController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StorePictoRequest $request
* @param \Illuminate\Http\StorePictoRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StorePictoRequest $request)
@ -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'));
@ -72,8 +76,8 @@ class PictosController extends Controller
/**
* Update the specified resource in storage.
*
* @param Picto $picto
* @param \Illuminate\Http\UpdatePictoRequest $request
* @param Picto $picto
* @param \Illuminate\Http\UpdatePictoRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Picto $picto, UpdatePictoRequest $request)
@ -95,15 +99,17 @@ class PictosController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Picto $picto
* @param Picto $picto
* @return \Illuminate\Http\Response
*/
public function destroy(Picto $picto)
{
if (!$picto->delete()) {
return redirect()->route('bo.pictos.content', $picto->page)->with('error', trans('La suppression a échoué'));
return redirect()->route('bo.pictos.content', $picto->page)
->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.pictos.content', $picto->page)->with('success', trans('Suppression faite avec succès'));
return redirect()->route('bo.pictos.content', $picto->page)
->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -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'));
@ -37,16 +37,16 @@ class PostsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StorePostRequest $request
* @param \Illuminate\Http\StorePostRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StorePostRequest $request)
{
$post = new Post($request->validated());
if (is_a($request->picture_home,"SplFileInfo")) {
if (is_a($request->picture_home, "SplFileInfo")) {
$post->picture_home = Utils::storeImage($request->picture_home, $post->getTable());
}
if (is_a($request->picture_news,"SplFileInfo")) {
if (is_a($request->picture_news, "SplFileInfo")) {
$post->picture_news = Utils::storeImage($request->picture_news, $post->getTable());
}
$response = $this->changeUniquePostOnTop($post->on_top);
@ -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,17 +76,17 @@ class PostsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\UpdatePostRequest $request
* @param Post $post
* @param Post $post
* @param \Illuminate\Http\UpdatePostRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Post $post, UpdatePostRequest $request)
{
$post->fill($request->validated());
if (is_a($request->picture_home,"SplFileInfo")) {
if (is_a($request->picture_home, "SplFileInfo")) {
$post->picture_home = Utils::storeImage($request->picture_home, $post->getTable());
}
if (is_a($request->picture_news,"SplFileInfo")) {
if (is_a($request->picture_news, "SplFileInfo")) {
$post->picture_news = Utils::storeImage($request->picture_news, $post->getTable());
}
$response = $this->changeUniquePostOnTop($post->on_top);
@ -105,7 +106,7 @@ class PostsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Post $post
* @param Post $post
* @return \Illuminate\Http\Response
*/
public function destroy(Post $post)
@ -120,8 +121,8 @@ class PostsController extends Controller
/**
* Change on_top column to a post if necessary
*
* @param Boolean $isCurrentPostOnTop
* @return Boolean response
* @param boolean $isCurrentPostOnTop
* @return boolean response
*/
private function changeUniquePostOnTop(bool $isCurrentPostOnTop): bool
{

View file

@ -26,15 +26,17 @@ 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
$tabFour = array(
// Default structure + produits.
$tabFour = array(
'id' => 0,
'name' => 'Four',
'url' => '/assets/images/four.png',
@ -42,7 +44,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabFriteuse = array(
$tabFriteuse = array(
'id' => 1,
'name' => 'Friteuse',
'url' => '/assets/images/friteuse.png',
@ -50,7 +52,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabPoele = array(
$tabPoele = array(
'id' => 2,
'name' => 'Poêle',
'url' => '/assets/images/poele.png',
@ -58,7 +60,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabCocotte = array(
$tabCocotte = array(
'id' => 3,
'name' => 'Cocotte',
'url' => '/assets/images/cocotte.png',
@ -66,7 +68,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabPlancha = array(
$tabPlancha = array(
'id' => 4,
'name' => 'Plancha',
'url' => '/assets/images/plancha.png',
@ -74,7 +76,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabBainMarie = array(
$tabBainMarie = array(
'id' => 5,
'name' => 'Bain Marie',
'url' => '/assets/images/bainmarie.png',
@ -82,7 +84,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabBarbecue = array(
$tabBarbecue = array(
'id' => 6,
'name' => 'Barbecue',
'url' => '/assets/images/barbecue.png',
@ -90,7 +92,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabMicroOndes = array(
$tabMicroOndes = array(
'id' => 7,
'name' => 'Micro Ondes',
'url' => '/assets/images/microondes.png',
@ -98,7 +100,7 @@ class ProductsController extends Controller
'temp' => '',
'status' => false
);
$tabCasserole = array(
$tabCasserole = array(
'id' => 8,
'name' => 'Casserole',
'url' => '/assets/images/casserole.png',
@ -121,7 +123,8 @@ class ProductsController extends Controller
'name' => '',
'url' => '',
);
$product->pictos = json_encode([$tabFour, $tabFriteuse, $tabPoele, $tabCocotte, $tabPlancha, $tabBainMarie, $tabBarbecue, $tabMicroOndes, $tabCasserole]);
//phpcs:ignore Generic.Files.LineLength.TooLong
$product->pictos = json_encode([$tabFour, $tabFriteuse, $tabPoele, $tabCocotte, $tabPlancha, $tabBainMarie, $tabBarbecue, $tabMicroOndes, $tabCasserole]);
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
return view('back.products.create', compact('product', 'gammes'));
}
@ -129,19 +132,19 @@ class ProductsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StoreProductRequest $request
* @param \Illuminate\Http\StoreProductRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StoreProductRequest $request)
{
$plusproduit = json_decode($request->plusproduit);
$product = new Product($request->validated());
$product = new Product($request->validated());
if (is_a($request->picture, "SplFileInfo")) {
$product->picture = Utils::storeImage($request->picture, $product->getTable());
}
foreach ($plusproduit as $plus) {
$picto = 'pictogramme' . $plus->id;
$picto = 'pictogramme' . $plus->id;
$uploadfile = $request->$picto;
if ($uploadfile) {
$plus->url = Utils::storeImage($uploadfile, $product->getTable());
@ -161,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');
@ -174,15 +178,15 @@ class ProductsController extends Controller
/**
* Update the specified resource in storage.
*
* @param Product $product
* @param \Illuminate\Http\UpdateProductRequest $request
* @param Product $product
* @param \Illuminate\Http\UpdateProductRequest $request
* @return \Illuminate\Http\Response
*/
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")) {
@ -190,20 +194,20 @@ class ProductsController extends Controller
}
foreach ($plusproduit as $plus) {
//boucle pour stockage des images uploadées
$picto = 'pictogramme' . $plus->id;
// 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)
@ -217,7 +221,7 @@ class ProductsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Product $product
* @param Product $product
* @return \Illuminate\Http\Response
*/
public function destroy(Product $product)

View file

@ -11,8 +11,10 @@ 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
*/
public function edit(SeoDatum $SeoDatum)
{
@ -22,8 +24,8 @@ class SeoDataController extends Controller
/**
* Update the specified resource in storage.
*
* @param UpdateSeoDataRequest $request
* @param \App\Models\SeoDatum $SeoDatum
* @param UpdateSeoDataRequest $request
* @param \App\Models\SeoDatum $SeoDatum
* @return \Illuminate\Http\Response
*/
public function update(UpdateSeoDataRequest $request, SeoDatum $SeoDatum)

View file

@ -24,8 +24,10 @@ 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
*/
public function create(Slider $slider)
{
@ -35,7 +37,7 @@ class SlidersController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StoreSliderRequest $request
* @param \Illuminate\Http\StoreSliderRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StoreSliderRequest $request)
@ -51,8 +53,10 @@ 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
*/
public function edit(Slider $slider)
{
@ -62,8 +66,8 @@ class SlidersController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\UpdateSliderRequest $request
* @param Slider $slider
* @param \Illuminate\Http\UpdateSliderRequest $request
* @param Slider $slider
* @return \Illuminate\Http\Response
*/
public function update(UpdateSliderRequest $request, Slider $slider)
@ -80,7 +84,7 @@ class SlidersController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Slider $slider
* @param Slider $slider
* @return \Illuminate\Http\Response
*/
public function destroy(Slider $slider)
@ -90,7 +94,6 @@ class SlidersController extends Controller
if ($count === 1) {
return redirect()->back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider");
}
// @todo : controller les slides liés
if (!$slider->delete()) {
return redirect()->route('bo.sliders.index')->with('error', trans('La suppression a échoué'));

View file

@ -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();
@ -38,15 +38,15 @@ class SlidesController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StoreSlideRequest $request
* @param \Illuminate\Http\StoreSlideRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StoreSlideRequest $request)
{
$slide = new Slide($request->validated());
$slide = new Slide($request->validated());
$slide->order = $this->getLastOrder();
if (is_a($request->picture,"SplFileInfo")) {
if (is_a($request->picture, "SplFileInfo")) {
$slide->picture = Utils::storeImage($request->picture, $slide->getTable());
}
@ -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();
@ -72,14 +72,14 @@ class SlidesController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\StoreSlideRequest $request
* @param Slide $slide
* @param \Illuminate\Http\StoreSlideRequest $request
* @param Slide $slide
* @return \Illuminate\Http\Response
*/
public function update(StoreSlideRequest $request, Slide $slide)
{
$slide->fill($request->validated());
if (is_a($request->picture,"SplFileInfo")) {
if (is_a($request->picture, "SplFileInfo")) {
$slide->picture = Utils::storeImage($request->picture, $slide->getTable());
}
@ -93,7 +93,7 @@ class SlidesController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Slide $slide
* @param Slide $slide
* @return \Illuminate\Http\Response
*/
public function destroy(Slide $slide)
@ -105,17 +105,25 @@ 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();
$newOrder = $tmp->order;
$tmp->order = $slide->order;
$tmp = Slide::where('order', '<', $slide->order)->orderBy('order', 'DESC')->first();
$newOrder = $tmp->order;
$tmp->order = $slide->order;
$slide->order = $newOrder;
} else {
$tmp = Slide::where('order', '>', $slide->order)->orderBy('order', 'ASC')->first();
$newOrder = $tmp->order;
$tmp->order = $slide->order;
$tmp = Slide::where('order', '>', $slide->order)->orderBy('order', 'ASC')->first();
$newOrder = $tmp->order;
$tmp->order = $slide->order;
$slide->order = $newOrder;
}
$tmp->save();
@ -126,6 +134,8 @@ class SlidesController extends Controller
/**
* retreive order position to put a new slide to
*
* @return integer
*/
private function getLastOrder()
{

View file

@ -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'));
@ -36,12 +37,12 @@ class TextsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\StoreTextRequest $request
* @param \Illuminate\Http\StoreTextRequest $request
* @return \Illuminate\Http\Response
*/
public function store(StoreTextRequest $request)
{
$text = new Text($request->validated());
$text = new Text($request->validated());
$text->page = Page::newsQuestions();
if (!$text->saveOrFail()) {
@ -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 Text $text
* @param \Illuminate\Http\StoreTextRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Text $text, StoreTextRequest $request)
@ -89,15 +91,17 @@ class TextsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param Text $text
* @param Text $text
* @return \Illuminate\Http\Response
*/
public function destroy(Text $text)
{
if (!$text->delete()) {
return redirect()->route('bo.texts.content', $text->page)->with('error', trans('La suppression a échoué'));
return redirect()->route('bo.texts.content', $text->page)
->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.texts.content', $text->page)->with('success', trans('Suppression faite avec succès'));
return redirect()->route('bo.texts.content', $text->page)
->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -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'));
@ -23,8 +24,8 @@ class TitlesController extends Controller
/**
* Update the specified resource in storage.
*
* @param Title $title
* @param \Illuminate\Http\UpdateTitleRequest $request
* @param Title $title
* @param \Illuminate\Http\UpdateTitleRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Title $title, UpdateTitleRequest $request)

View file

@ -8,16 +8,28 @@ 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()));
$lang = session()->get('lang', config('app.locale'));
return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")->with('status', true);
return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")
->with('status', true);
}
}

View file

@ -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());

View file

@ -11,17 +11,27 @@ use App\Models\Title;
class FoodServiceController extends Controller
{
/**
* Show the FoodService view.
*
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
$page = Page::foodservice();
$seoDatum = SeoDatum::where('page',$page)->first();
$page = Page::foodservice();
$seoDatum = SeoDatum::where('page', $page)->first();
$encart_food = Encart::where('page', Page::foodHeader()->value)->first();
$encart_food = Encart::where('page', Page::foodHeader()->value)->first();
$title_foodBloc2 = Title::where('page', Page::foodBloc2()->value)->first();
$pictos_food = Picto::where('page', Page::foodBloc2()->value)->get();
$products_food = Product::where('is_food_service', true)->get();
$pictos_food = Picto::where('page', Page::foodBloc2()->value)->get();
$products_food = Product::where('is_food_service', true)->get();
return view('front.food-service', compact('seoDatum' , 'encart_food', 'title_foodBloc2',
'pictos_food', 'products_food'));
return view('front.food-service', compact(
'seoDatum',
'encart_food',
'title_foodBloc2',
'pictos_food',
'products_food'
));
}
}

View file

@ -9,23 +9,35 @@ 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');
$gammes = $gammes->whereNotIn('slug', 'food-service');
$nb_gammes = $gammes->count();
$page = Page::gammes();
$seoDatum = SeoDatum::where('page',$page)->first();
$page = Page::gammes();
$seoDatum = SeoDatum::where('page', $page)->first();
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([]);
$gammes = collect([]);
$dbGammes = Gamme::where('id', $gamme->id)
->with('childGammes')->get();
@ -43,9 +55,9 @@ class GammesController extends Controller
->orderBy('name')
->get();
//make ghost seoDatum from the gamme
$seoDatum = new SeoDatum();
$seoDatum->title = $gamme->title;
// Make ghost seoDatum from the gamme.
$seoDatum = new SeoDatum();
$seoDatum->title = $gamme->title;
$seoDatum->description = $gamme->text;
return view('front.gammes.show', compact('gamme', 'products', 'seoDatum'));

View file

@ -13,11 +13,16 @@ use Illuminate\Support\Carbon;
class HomeController extends Controller
{
/**
* Show the Homepage view.
*
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
$page = Page::home();
$seoDatum = SeoDatum::where('page',$page)->first();
$page = Page::home();
$seoDatum = SeoDatum::where('page', $page)->first();
$slider = Slider::where('published', 1)->first();
if ($slider) {
@ -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'));

View file

@ -8,14 +8,19 @@ 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
$seoDatum = new SeoDatum();
// Make ghost seoDatum from the gamme.
$seoDatum = new SeoDatum();
$seoDatum->title = $mentions_legales->title;
return view('front.legals', compact('seoDatum' ,'mentions_legales'));
return view('front.legals', compact('seoDatum', 'mentions_legales'));
}
}

View file

@ -12,10 +12,15 @@ use App\Models\Title;
class MarqueController extends Controller
{
/**
* Show the Marque view.
*
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
$page = Page::marque();
$seoDatum = SeoDatum::where('page',$page)->first();
$page = Page::marque();
$seoDatum = SeoDatum::where('page', $page)->first();
$encart_marqueHeader = Encart::where('page', Page::marqueHeader()->value)->first();
$encart_marqueBloc4l = Encart::where('page', Page::marqueBloc4l()->value)->first();
@ -24,12 +29,21 @@ class MarqueController extends Controller
$pictobrands_marque = PictoBrand::all();
$pictos_marqueBloc2 = Picto::where('page', Page::marqueBloc2()->value)->get();
$title_marqueBloc2 = Title::where('page', Page::marqueBloc2()->value)->first();
$title_marqueBloc4 = Title::where('page', Page::marqueBloc4()->value)->first();
$moments = Moment::where('page', Page::marqueHistory()->value)->get();
$title_marqueBloc2 = Title::where('page', Page::marqueBloc2()->value)->first();
$title_marqueBloc4 = Title::where('page', Page::marqueBloc4()->value)->first();
$moments = Moment::where('page', Page::marqueHistory()->value)->get();
return view('front.a-propos', compact('seoDatum', 'encart_marqueHeader', 'encart_marqueBloc4l',
'encart_marqueBloc4r', 'encart_marqueFooter', 'pictobrands_marque', 'title_marqueBloc2',
'pictos_marqueBloc2', 'moments', 'title_marqueBloc4'));
return view('front.a-propos', compact(
'seoDatum',
'encart_marqueHeader',
'encart_marqueBloc4l',
'encart_marqueBloc4r',
'encart_marqueFooter',
'pictobrands_marque',
'title_marqueBloc2',
'pictos_marqueBloc2',
'moments',
'title_marqueBloc4'
));
}
}

View file

@ -13,13 +13,18 @@ use Illuminate\Support\Carbon;
class NewsController extends Controller
{
/**
* Show the News view.
*
* @return \Illuminate\Contracts\View\View
*/
public function index()
{
$page = Page::news();
$seoDatum = SeoDatum::where('page',$page)->first();
$page = Page::news();
$seoDatum = SeoDatum::where('page', $page)->first();
$advice_news = Advice::all()->first();
$texts_news = Text::where('page', Page::newsQuestions()->value)->get();
$advice_news = Advice::all()->first();
$texts_news = Text::where('page', Page::newsQuestions()->value)->get();
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
$posts = Post::where([
@ -31,6 +36,13 @@ class NewsController extends Controller
$products_news = Product::where('is_news', true)->get();
return view('front.news', compact('seoDatum', 'advice_news' , 'texts_news', 'title_newsPosts', 'posts', 'products_news'));
return view('front.news', compact(
'seoDatum',
'advice_news',
'texts_news',
'title_newsPosts',
'posts',
'products_news'
));
}
}

View file

@ -8,12 +8,17 @@ 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
$seoDatum = new SeoDatum();
// Make ghost seoDatum from the gamme.
$seoDatum = new SeoDatum();
$seoDatum->title = $privacy_policy->title;
return view('front.policy', compact('seoDatum', 'privacy_policy'));

View file

@ -9,17 +9,31 @@ 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();
$seoDatum->title = $product->name;
$seoDatum = new SeoDatum();
$seoDatum->title = $product->name;
$seoDatum->description = $product->description;
return view('front.product', compact('product', 'gamme', 'seoDatum'));
}
public function search(Request $request) {
/**
* 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');
if (!empty($filter)) {

View file

@ -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');
}
}

View file

@ -9,7 +9,6 @@ use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
@ -37,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,
],

View file

@ -2,7 +2,7 @@
/**
* Middleware pour l'auth
*
*
* @category Description
* @package Category
* @author Name <email@email.com>
@ -14,10 +14,11 @@
namespace App\Http\Middleware;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
/**
* Undocumented class
*
*
* @category Description
* @package Category
* @author Name <email@email.com>
@ -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');

View file

@ -17,32 +17,32 @@ 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)
{
$encart_home = Encart::where('page', Page::homeHeader()->value)->first();
$encart_home = Encart::where('page', Page::homeHeader()->value)->first();
$encart_marqueHeader = Encart::where('page', Page::marqueHeader()->value)->first();
$encart_marqueBloc4l = Encart::where('page', Page::marqueBloc4l()->value)->first();
$encart_marqueBloc4r = Encart::where('page', Page::marqueBloc4r()->value)->first();
$encart_marqueFooter = Encart::where('page', Page::marqueFooter()->value)->first();
$encart_food = Encart::where('page', Page::foodHeader()->value)->first();
$mentions_legales = Text::where('page', Page::mentions()->value)->first();
$privacy_policy = Text::where('page', Page::charte()->value)->first();
$encart_food = Encart::where('page', Page::foodHeader()->value)->first();
$mentions_legales = Text::where('page', Page::mentions()->value)->first();
$privacy_policy = Text::where('page', Page::charte()->value)->first();
$advice_news = Advice::all()->first();
$pictos_marqueBloc2 = Picto::where('page', Page::marqueBloc2()->value)->get();
$pictos_food = Picto::where('page', Page::foodBloc2()->value)->get();
$pictos_food = Picto::where('page', Page::foodBloc2()->value)->get();
$texts_news = Text::where('page', Page::newsQuestions()->value)->get();
$title_marqueBloc2 = Title::where('page', Page::marqueBloc2()->value)->first();
$title_marqueBloc4 = Title::where('page', Page::marqueBloc4()->value)->first();
$title_foodBloc2 = Title::where('page', Page::foodBloc2()->value)->first();
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
$title_foodBloc2 = Title::where('page', Page::foodBloc2()->value)->first();
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
View::share('encart_home', $encart_home);
View::share('encart_marqueHeader', $encart_marqueHeader);

View file

@ -12,6 +12,5 @@ class EncryptCookies extends Middleware
* @var array
*/
protected $except = [
//
];
];
}

View file

@ -4,36 +4,38 @@ 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
$currentRoute = Route::current()->getName();
// Header menu.
$currentRoute = Route::current()->getName();
$routeParamsFR = Route::current()->parameters();
$routeParamsEN = $routeParamsFR;
$routeParamsES = $routeParamsFR;
array_walk($routeParamsFR, array($this, 'unbind'),'');
array_walk($routeParamsEN, array($this, 'unbind'),'en');
array_walk($routeParamsES, array($this, 'unbind'),'es');
if (preg_match('/^(en|es)/', $currentRoute )) {
$currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute,1);
$currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute,1);
$currentRouteES = preg_replace('/^(en|es)/', 'es', $currentRoute,1);
array_walk($routeParamsFR, array($this, 'unbind'), '');
array_walk($routeParamsEN, array($this, 'unbind'), 'en');
array_walk($routeParamsES, array($this, 'unbind'), 'es');
if (preg_match('/^(en|es)/', $currentRoute)) {
$currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute, 1);
$currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute, 1);
$currentRouteES = preg_replace('/^(en|es)/', 'es', $currentRoute, 1);
} else {
$currentRouteFR = $currentRoute;
$currentRouteEN = 'en.'.$currentRoute;
$currentRouteES = 'es.'.$currentRoute;
$currentRouteEN = 'en.' . $currentRoute;
$currentRouteES = 'es.' . $currentRoute;
}
View::share('currentRouteFR', $currentRouteFR);
@ -46,9 +48,21 @@ class FrontEndGlobals
return $next($request);
}
public function unbind(&$item,$k,$lang) {
if($k=='gammeSlug' || $k=='productSlug') {
$item = $item->getTranslation('slug', $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)
{
// phpcs:enable
$classUses = class_uses($item);
if ($classUses and (\in_array(HasTranslations::class, $classUses))) {
$item = (clone $item)->setLocale($locale);
}
}
}

View file

@ -9,13 +9,18 @@ use Illuminate\Support\Facades\View;
class LangCheck
{
/**
* The available languages.
*
* @var array
*/
protected $langs = ['fr','en','es'];
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
@ -23,28 +28,28 @@ 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;
$sess_lang = $request->session()->get('lang', config('app.locale'));
$sess_lang = $request->session()->get('lang', config('app.locale'));
switch ($sess_lang) {
case 'en':
return redirect()->route($routNameEN);
@ -55,57 +60,64 @@ class LangCheck
$langset = 'fr';
$this->saveUserLocale($langset, $request);
}
}
}//end if
}//end if
$sess_lang = $request->session()->get('lang', config('app.locale'));
app()->setLocale($sess_lang);
config(['app.locale' => $sess_lang]);
$routePrefixer = "";
if($sess_lang != 'fr') {
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;
}
}

View file

@ -12,6 +12,5 @@ class PreventRequestsDuringMaintenance extends Middleware
* @var array
*/
protected $except = [
//
];
];
}

View file

@ -12,9 +12,9 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null ...$guards
* @return mixed
*/
public function handle(Request $request, Closure $next, ...$guards)

View file

@ -17,7 +17,7 @@ class TrustProxies extends Middleware
/**
* The headers that should be used to detect proxies.
*
* @var int
* @var integer
*/
protected $headers =
Request::HEADER_X_FORWARDED_FOR |

View file

@ -12,6 +12,5 @@ class VerifyCsrfToken extends Middleware
* @var array
*/
protected $except = [
//
];
];
}

View file

@ -9,7 +9,7 @@ class ContactFormRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -10,7 +10,7 @@ class StoreGammeRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class StorePictoBrandRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class StorePictoRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -5,15 +5,28 @@ 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
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @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();
}
/**

View file

@ -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;
@ -12,7 +11,7 @@ class StoreProductRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{
@ -23,141 +22,136 @@ class StoreProductRequest extends FormRequest
* Prepare the data for validation.
*
* @return void
* @phpcs:disable 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
$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,
]);
}
/**
@ -184,8 +178,6 @@ class StoreProductRequest extends FormRequest
'is_news' => 'nullable|boolean',
'is_food_service' => 'nullable|boolean',
'is_halal' => 'nullable|boolean',
// 'seo_title' => 'required|max:255',
// 'seo_description' => 'required|max:255',
];
}

View file

@ -11,7 +11,7 @@ class StoreSlideRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{
@ -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(),

View file

@ -10,7 +10,7 @@ class StoreSliderRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class StoreTextRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class UpdateAdviceRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class UpdateEncartRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{
@ -26,10 +26,6 @@ class UpdateEncartRequest extends FormRequest
return [
'title' => 'required|max:255',
'subtitle' => 'sometimes|max:255',
// TODO 'subtitle' => [
// Rule::requiredIf(), 'max:255'
// 'required|max:255'
// ],
'text' => 'required|max:2047',
'picture' => 'sometimes|image|mimes:jpeg,png,jpg|max:2048',
'alt_text_picture' => 'sometimes|max:255',

View file

@ -9,7 +9,7 @@ class UpdateMomentRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class UpdatePictoBrandRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class UpdatePictoRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class UpdateSeoDataRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -9,7 +9,7 @@ class UpdateTitleRequest extends FormRequest
/**
* Determine if the user is authorized to make this request.
*
* @return bool
* @return boolean
*/
public function authorize()
{

View file

@ -7,6 +7,7 @@ use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use SplFileInfo;
/**
* Some utilities methods
*
@ -20,14 +21,17 @@ class Utils
* if a string is passed then the store action is ignored and the strieng is returned
*
* @param \Illuminate\Http\UploadedFile|\SplFileInfo|string $image
* @param string $folderName
* @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
{
if (\is_object($image) and get_class($image) === UploadedFile::class) {
/** @var UploadedFile */
$image = $image;
$image = $image;
$newPath = self::prepareMoveFile($image->getClientOriginalName(), $folderName);
$newPath = str_replace(storage_path('app'), '', $newPath);
$image->storePubliclyAs(pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME));
@ -35,10 +39,10 @@ class Utils
}
if (\is_object($image) and get_class($image) === SplFileInfo::class) {
/** @var SplFileInfo */
$image = $image;
$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
@ -51,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");

View file

@ -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;
}

View file

@ -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,28 +49,34 @@ class Advice extends Model
'text2',
];
/**
* 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) {
if (is_a($advice->picture1,"SplFileInfo")) {
if (is_a($advice->picture1, "SplFileInfo")) {
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
}
if (is_a($advice->picture2,"SplFileInfo")) {
if (is_a($advice->picture2, "SplFileInfo")) {
$advice->picture2 = Utils::storeImage($advice->picture2, $advice->getTable());
}
if (is_a($advice->picture3,"SplFileInfo")) {
if (is_a($advice->picture3, "SplFileInfo")) {
$advice->picture3 = Utils::storeImage($advice->picture3, $advice->getTable());
}
});
static::updating(function (Advice $advice) {
if (is_a($advice->picture1,"SplFileInfo")) {
if (is_a($advice->picture1, "SplFileInfo")) {
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
}
if (is_a($advice->picture2,"SplFileInfo")) {
if (is_a($advice->picture2, "SplFileInfo")) {
$advice->picture2 = Utils::storeImage($advice->picture2, $advice->getTable());
}
if (is_a($advice->picture3,"SplFileInfo")) {
if (is_a($advice->picture3, "SplFileInfo")) {
$advice->picture3 = Utils::storeImage($advice->picture3, $advice->getTable());
}
});

View file

@ -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,16 +49,21 @@ 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) {
if (is_a($encart->picture,"SplFileInfo")) {
if (is_a($encart->picture, "SplFileInfo")) {
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
}
});
static::updating(function (Encart $encart) {
if (is_a($encart->picture,"SplFileInfo")) {
if (is_a($encart->picture, "SplFileInfo")) {
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
}
});

View file

@ -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,6 +45,12 @@ class Gamme extends Model
'alt_text_banner',
];
/**
* 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) {
@ -46,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;
}
});
@ -59,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()) {
@ -72,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;
}
});
@ -105,6 +121,11 @@ class Gamme extends Model
parent::boot();
}
/**
* map hex color notation to rgba() syntax
*
* @return string
*/
public function getRgbaColorAttribute()
{
$color = $this->color;
@ -120,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);
@ -132,6 +163,9 @@ class Gamme extends Model
/**
* Get Products for the Range.
* HasMany products relation
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function products()
{

View file

@ -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) {

View file

@ -14,32 +14,52 @@ 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) {
if (is_a($picto->picture,"SplFileInfo")) {
if (is_a($picto->picture, "SplFileInfo")) {
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
}
});
static::updating(function (Picto $picto) {
if (is_a($picto->picture,"SplFileInfo")) {
if (is_a($picto->picture, "SplFileInfo")) {
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
}
});

View file

@ -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,16 +37,21 @@ class PictoBrand extends Model
'text',
];
/**
* Perform any actions required after the model boots.
*
* @return void
*/
protected static function boot()
{
static::creating(function (PictoBrand $pictoBrand) {
if (is_a($pictoBrand->picture,"SplFileInfo")) {
if (is_a($pictoBrand->picture, "SplFileInfo")) {
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
}
});
static::updating(function (PictoBrand $pictoBrand) {
if (is_a($pictoBrand->picture,"SplFileInfo")) {
if (is_a($pictoBrand->picture, "SplFileInfo")) {
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
}
});

View file

@ -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,22 +54,28 @@ class Post extends Model
'alt_text_picture_news'
];
/**
* 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) {
if (is_a($post->picture_home,"SplFileInfo")) {
if (is_a($post->picture_home, "SplFileInfo")) {
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
}
if (is_a($post->picture_news,"SplFileInfo")) {
if (is_a($post->picture_news, "SplFileInfo")) {
$post->picture_news = Utils::storeImage($post->picture_news, $post->getTable());
}
});
static::updating(function (Post $post) {
if (is_a($post->picture_home,"SplFileInfo")) {
if (is_a($post->picture_home, "SplFileInfo")) {
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
}
if (is_a($post->picture_news,"SplFileInfo")) {
if (is_a($post->picture_news, "SplFileInfo")) {
$post->picture_news = Utils::storeImage($post->picture_news, $post->getTable());
}
});

View file

@ -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()
{

View file

@ -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);
}
}

View file

@ -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,16 +55,21 @@ 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) {
if (is_a($slide->picture,"SplFileInfo")) {
if (is_a($slide->picture, "SplFileInfo")) {
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
}
});
static::updating(function (Slide $slide) {
if (is_a($slide->picture,"SplFileInfo")) {
if (is_a($slide->picture, "SplFileInfo")) {
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
}
});
@ -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);

View file

@ -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();

View file

@ -12,15 +12,30 @@ class Text 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',

View file

@ -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',

View file

@ -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) {

View file

@ -14,7 +14,6 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{
//
}
/**

View file

@ -3,7 +3,6 @@
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
@ -12,9 +11,7 @@ class AuthServiceProvider extends ServiceProvider
*
* @var array
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
];
protected $policies = [];
/**
* Register any authentication / authorization services.
@ -24,7 +21,5 @@ class AuthServiceProvider extends ServiceProvider
public function boot()
{
$this->registerPolicies();
//
}
}

View file

@ -1,21 +0,0 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}

View file

@ -5,7 +5,6 @@ namespace App\Providers;
use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
class EventServiceProvider extends ServiceProvider
{
@ -27,6 +26,5 @@ class EventServiceProvider extends ServiceProvider
*/
public function boot()
{
//
}
}

View file

@ -4,10 +4,8 @@ namespace App\Providers;
use App\Models\Gamme;
use App\Models\Product;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
@ -21,15 +19,6 @@ class RouteServiceProvider extends ServiceProvider
*/
public const HOME = '/bo';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*
@ -37,41 +26,51 @@ class RouteServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
->group(base_path('routes/api.php'));
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
});
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) {
Route::bind('productSlug', function ($value, $route) {
/** @var \Illuminate\Routing\Route $route */
$gamme = $route->parameter('gammeSlug');
$product = Product::where('slug', 'LIKE', '%:"'.$value.'"%')->where('gamme_id', $gamme->id)->firstOrFail();
return $product;
});
/** @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);
});
}
/**
* Configure the rate limiters for the application.
*
* @return void
* Get route binder common
* @param string $value
* @return string[]
*/
protected function configureRateLimiting()
private function getRouteBinderVars(string $value): array
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
$locale = \app()->getLocale();
$defaultLocale = \config('translatable.fallback_locale');
$value = \filter_var($value, \FILTER_SANITIZE_STRING);
return compact('locale', 'defaultLocale', 'value');
}
}

View file

@ -5,10 +5,9 @@ namespace App\Traits;
use Kwaadpepper\Enum\Traits\CastsEnums;
use Spatie\Translatable\HasTranslations;
trait CastsEnumsHasTranslations {
use CastsEnums, HasTranslations
{
trait CastsEnumsHasTranslations
{
use CastsEnums, HasTranslations {
CastsEnums::getAttributeValue as enumGetAttributeValue;
CastsEnums::setAttribute as enumSetAttribute;
HasTranslations::getAttributeValue as transGetAttributeValue;
@ -17,11 +16,15 @@ trait CastsEnumsHasTranslations {
/**
* Manually mix getAttributeValue from CastsEnums and HasTranslations
*
* @param mixed $key
*
* @return string
*/
public function getAttributeValue($key)
{
if ($this->hasEnumCast($key)) {
return $this->enumGetAttributeValue($key);
return $this->enumGetAttributeValue($key);
}
return $this->transGetAttributeValue($key);
@ -29,14 +32,18 @@ trait CastsEnumsHasTranslations {
/**
* Manually mix setAttribute from CastsEnums and HasTranslations
*
* @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);
return $this->transSetAttribute($key, $value);
}
}

View file

@ -14,8 +14,8 @@
"joedixon/laravel-translation": "^1.1",
"kwaadpepper/enum": "^2.1",
"kwaadpepper/exception-handler": "^0.0.9",
"kwaadpepper/refresh-sitemap": "^1.0",
"laravel/framework": "^8.65",
"laravel/sanctum": "^2.11",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.3",
"ldc/web-admin-secure-laravel": "1.0.1",

2102
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -3,53 +3,53 @@
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services the application utilizes. Set this in your ".env" file.
|
*/
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
'debug' => (bool)env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
|--------------------------------------------------------------------------
| Application URL
|--------------------------------------------------------------------------
|
| This URL is used by the console to properly generate URLs when using
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
'url' => env('APP_URL', 'http://localhost'),
@ -57,66 +57,66 @@ return [
'asset_url' => env('ASSET_URL', null),
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Europe/Paris',
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => 'fr',
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'fr',
/*
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
|--------------------------------------------------------------------------
| Faker Locale
|--------------------------------------------------------------------------
|
| This locale will be used by the Faker PHP library when generating fake
| data for your database seeds. For example, this will be used to get
| localized telephone numbers, street address information and more.
|
*/
'faker_locale' => 'fr_FR',
/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| This key is used by the Illuminate encrypter service and should be set
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
'key' => env('APP_KEY'),
@ -124,14 +124,14 @@ return [
'cipher' => 'AES-256-CBC',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
@ -139,6 +139,7 @@ return [
/*
* Laravel Framework Service Providers...
*/
Illuminate\Auth\AuthServiceProvider::class,
Illuminate\Broadcasting\BroadcastServiceProvider::class,
Illuminate\Bus\BusServiceProvider::class,
@ -169,23 +170,23 @@ return [
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
// App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
@ -217,7 +218,6 @@ return [
'Queue' => Illuminate\Support\Facades\Queue::class,
'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
// 'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
@ -229,7 +229,7 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
// Enums
// Enums.
'Page' => \App\Enums\Page::class,
],

View file

@ -3,14 +3,14 @@
return [
/*
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
|--------------------------------------------------------------------------
| Authentication Defaults
|--------------------------------------------------------------------------
|
| This option controls the default authentication "guard" and password
| reset options for your application. You may change these defaults
| as required, but they're a perfect start for most applications.
|
*/
'defaults' => [
@ -19,20 +19,20 @@ return [
],
/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| Supported: "session"
|
*/
'guards' => [
@ -43,20 +43,20 @@ return [
],
/*
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
|--------------------------------------------------------------------------
| User Providers
|--------------------------------------------------------------------------
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
|
*/
'providers' => [
@ -64,26 +64,21 @@ return [
'driver' => 'eloquent',
'model' => App\Models\User::class,
],
// 'users' => [
// 'driver' => 'database',
// 'table' => 'users',
// ],
],
/*
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
|--------------------------------------------------------------------------
| Resetting Passwords
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
*/
'passwords' => [
@ -96,14 +91,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
|--------------------------------------------------------------------------
| Password Confirmation Timeout
|--------------------------------------------------------------------------
|
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,

View file

@ -1,13 +1,14 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| App parameters
|--------------------------------------------------------------------------
|
| Several parameters
|
|--------------------------------------------------------------------------
| App parameters
|--------------------------------------------------------------------------
|
| Several parameters
|
*/
'slide_image_maxwidth' => '1920',

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
|--------------------------------------------------------------------------
| Default Broadcaster
|--------------------------------------------------------------------------
|
| This option controls the default broadcaster that will be used by the
| framework when an event needs to be broadcast. You may set this to
| any of the connections defined in the "connections" array below.
|
| Supported: "pusher", "ably", "redis", "log", "null"
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
/*
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
|--------------------------------------------------------------------------
| Broadcast Connections
|--------------------------------------------------------------------------
|
| Here you may define all of the broadcast connections that will be used
| to broadcast events to other systems or over websockets. Samples of
| each available type of connection are provided inside this array.
|
*/
'connections' => [

View file

@ -5,30 +5,30 @@ use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
|--------------------------------------------------------------------------
| Default Cache Store
|--------------------------------------------------------------------------
|
| This option controls the default cache connection that gets used while
| using this caching library. This connection is used when another is
| not explicitly specified when executing a given caching function.
|
*/
'default' => env('CACHE_DRIVER', 'file'),
/*
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
|--------------------------------------------------------------------------
| Cache Stores
|--------------------------------------------------------------------------
|
| Here you may define all of the cache "stores" for your application as
| well as their drivers. You may even define multiple stores for the
| same cache driver to group types of items stored in your caches.
|
| Supported drivers: "apc", "array", "database", "file",
| "memcached", "redis", "dynamodb", "octane", "null"
|
*/
'stores' => [
@ -62,7 +62,7 @@ return [
env('MEMCACHED_PASSWORD'),
],
'options' => [
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
],
'servers' => [
[
@ -95,16 +95,16 @@ return [
],
/*
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
|--------------------------------------------------------------------------
| Cache Key Prefix
|--------------------------------------------------------------------------
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
|
*/
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
];

View file

@ -3,16 +3,16 @@
return [
/*
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
|--------------------------------------------------------------------------
| Cross-Origin Resource Sharing (CORS) Configuration
|--------------------------------------------------------------------------
|
| Here you may configure your settings for cross-origin resource sharing
| or "CORS". This determines what cross-origin operations may execute
| in web browsers. You are free to adjust these settings as needed.
|
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
*/
'paths' => ['api/*', 'sanctum/csrf-cookie'],

View file

@ -5,32 +5,32 @@ use Illuminate\Support\Str;
return [
/*
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
|--------------------------------------------------------------------------
| Default Database Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the database connections below you wish
| to use as your default connection for all database work. Of course
| you may use many connections at once using the Database library.
|
*/
'default' => env('DB_CONNECTION', 'mysql'),
/*
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
|--------------------------------------------------------------------------
| Database Connections
|--------------------------------------------------------------------------
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
| so make sure you have the driver for your particular database of
| choice installed on your machine before you begin development.
|
*/
'connections' => [
@ -94,27 +94,27 @@ return [
],
/*
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
|--------------------------------------------------------------------------
| Migration Repository Table
|--------------------------------------------------------------------------
|
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
@ -123,7 +123,7 @@ return [
'options' => [
'cluster' => env('REDIS_CLUSTER', 'redis'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'),
],
'default' => [

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
@ -38,7 +38,7 @@ return [
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'url' => env('APP_URL') . '/storage',
'visibility' => 'public',
],
@ -56,14 +56,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
|--------------------------------------------------------------------------
| Symbolic Links
|--------------------------------------------------------------------------
|
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [

View file

@ -3,29 +3,29 @@
return [
/*
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
|--------------------------------------------------------------------------
| Default Hash Driver
|--------------------------------------------------------------------------
|
| This option controls the default hash driver that will be used to hash
| passwords for your application. By default, the bcrypt algorithm is
| used; however, you remain free to modify this option if you wish.
|
| Supported: "bcrypt", "argon", "argon2id"
|
*/
'driver' => 'bcrypt',
/*
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
|--------------------------------------------------------------------------
| Bcrypt Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Bcrypt algorithm. This will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'bcrypt' => [
@ -33,14 +33,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
|--------------------------------------------------------------------------
| Argon Options
|--------------------------------------------------------------------------
|
| Here you may specify the configuration options that should be used when
| passwords are hashed using the Argon algorithm. These will allow you
| to control the amount of time it takes to hash the given password.
|
*/
'argon' => [

View file

@ -7,44 +7,44 @@ use Monolog\Handler\SyslogUdpHandler;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
|--------------------------------------------------------------------------
| Deprecations Log Channel
|--------------------------------------------------------------------------
|
| This option controls the log channel that should be used to log warnings
| regarding deprecated PHP and library features. This allows you to get
| your application ready for upcoming major versions of dependencies.
|
*/
'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, Laravel uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [

View file

@ -3,34 +3,34 @@
return [
/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/
'default' => env('MAIL_MAILER', 'smtp'),
/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array", "failover"
|
*/
'mailers' => [
@ -81,14 +81,14 @@ return [
],
/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/
'from' => [
@ -96,20 +96,20 @@ return [
'name' => env('MAIL_FROM_NAME', 'Example'),
],
// Contacts List
// Contacts List.
'contactsList' => [
'contactform' => explode(",", env('MAIL_LIST_CONTACTFORM', 'equipe.web@ldc.fr'))
],
/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/
'markdown' => [

View file

@ -25,7 +25,8 @@ return [
'cacheFileMode' => 0755,
'settings' => [
'default' => [
'HTML.SafeIframe' => true, // For iframes
'HTML.SafeIframe' => true,
// 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',
@ -43,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'],
@ -51,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',
@ -75,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'],
@ -83,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']],
],

Some files were not shown because too many files have changed in this diff Show more