Compare commits
61 commits
add-CICD-f
...
migration/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37f291e00f | ||
|
|
f8799190a0 | ||
|
|
4681cc4491 | ||
|
|
2b688b9dc7 | ||
|
|
19b8d6467c | ||
|
|
9c589d7d65 | ||
|
|
c7af9aec13 | ||
|
|
8625258bdc | ||
|
|
ae974764c2 | ||
|
|
bb85ddc390 | ||
|
|
8c48a0ea05 | ||
|
|
26a907bba6 | ||
|
|
5fe6cd458e | ||
|
|
54a913978f | ||
|
|
3b8a6f0454 | ||
|
|
4187db1ac8 | ||
|
|
e7e22e32cd | ||
|
|
9f92bfb761 | ||
|
|
2418746316 | ||
|
|
83d8753285 | ||
|
|
98343c979f | ||
|
|
e9331bd63d | ||
|
|
a7c5d2d9b2 | ||
|
|
fe0d3c1c3c | ||
|
|
1aa6efaac5 | ||
|
|
368f43e73f | ||
|
|
07c3ca5c1a | ||
|
|
5e1ad00212 | ||
|
|
8e406ea218 | ||
|
|
e67f0d1195 | ||
|
|
1aca07c81f | ||
|
|
1ae4b39f74 | ||
|
|
4acecd2079 | ||
|
|
9c1c0cd75b | ||
|
|
79bb207636 | ||
|
|
fd6c3b7808 | ||
|
|
61966e5a61 | ||
|
|
fb84c17f87 | ||
|
|
4d887639c0 | ||
|
|
35f4ad8a17 | ||
|
|
af3eb871b6 | ||
|
|
20c863d478 | ||
|
|
a4514fa3e6 | ||
|
|
23f53c80b9 | ||
|
|
3c7e3b0a61 | ||
|
|
d63888cabf | ||
|
|
82ef4f8845 | ||
|
|
c7e7198e81 | ||
|
|
f12aa32d8f | ||
|
|
a482e294e4 | ||
|
|
88e3e7d47b | ||
|
|
ad7bdbdd2a | ||
|
|
d7af219cd7 | ||
|
|
086fd74fe0 | ||
|
|
434de3adc5 | ||
|
|
b202ea86f9 | ||
|
|
997aa67ae7 | ||
|
|
3cb9a29afb | ||
|
|
2781f2f5f4 | ||
|
|
ba015c81ea | ||
|
|
fcf045e17d |
159 changed files with 8176 additions and 6906 deletions
12
.env.example
12
.env.example
|
|
@ -17,7 +17,7 @@ DB_PASSWORD=
|
|||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
|
@ -33,15 +33,19 @@ MAIL_FROM_NAME="${APP_NAME}"
|
|||
|
||||
MAIL_LIST_CONTACTFORM=
|
||||
|
||||
ANALYTICS_GOOGLE_ID=
|
||||
# Matomo
|
||||
MATOMO_SITE_ID=
|
||||
|
||||
# Google Recaptcha
|
||||
GOOGLE_RECAPTCHA_PUBLIC=
|
||||
GOOGLE_RECAPTCHA_PRIVATE=
|
||||
GOOGLE_RECAPTCHA_VERSION=
|
||||
# UWIL ADMIN SECURE
|
||||
# - LIST SEPARATED WITH ',' (Required)
|
||||
UWIL_ADMIN_SECURE_CIDR_LIST=""
|
||||
# - LIST SEPARATED WITH ',' (Optional)
|
||||
UWIL_ADMIN_SECURE_CIDR_PROJECT_ALLOWED_LIST=""
|
||||
|
||||
## LDCWEB ADMIN SECURE
|
||||
LDC_WEB_API_KEY=
|
||||
|
||||
# Sentry
|
||||
SENTRY_LARAVEL_DSN=
|
||||
|
|
|
|||
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,7 +1,8 @@
|
|||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/public
|
||||
/public/
|
||||
!/public/sitemap.xml
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
|
|
@ -14,3 +15,4 @@ npm-debug.log
|
|||
yarn-error.log
|
||||
/.idea
|
||||
auth.json
|
||||
.npmrc
|
||||
|
|
|
|||
|
|
@ -1,23 +1,24 @@
|
|||
include:
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "lint/lint7.3.yml"
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "security/security7.3.yml"
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "build/build7.3.yml"
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "test/test.yml"
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "deploy/deploy.yml"
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'lint/lint.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'security/security.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'build/build.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'test/test.yml'
|
||||
- project: 'ldc-web/shared-ci'
|
||||
ref: 'main'
|
||||
file: 'deploy/deploy.yml'
|
||||
|
||||
|
||||
stages:
|
||||
- lint
|
||||
- security
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
- lint
|
||||
- security
|
||||
- build
|
||||
- test
|
||||
- deploy
|
||||
|
|
|
|||
15
.vscode/settings.json
vendored
15
.vscode/settings.json
vendored
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#e2bd2b",
|
||||
"activityBar.activeBorder": "#222f5c",
|
||||
"activityBar.activeBorder": "#15202b",
|
||||
"activityBar.background": "#e2bd2b",
|
||||
"activityBar.foreground": "#15202b",
|
||||
"activityBar.inactiveForeground": "#15202b99",
|
||||
|
|
@ -11,13 +11,22 @@
|
|||
"statusBar.background": "#c19f1a",
|
||||
"statusBar.foreground": "#15202b",
|
||||
"statusBarItem.hoverBackground": "#947a14",
|
||||
"statusBarItem.remoteBackground": "#c19f1a",
|
||||
"statusBarItem.remoteBackground": "#abf4e5",
|
||||
"statusBarItem.remoteForeground": "#15202b",
|
||||
"titleBar.activeBackground": "#c19f1a",
|
||||
"titleBar.activeForeground": "#15202b",
|
||||
"titleBar.inactiveBackground": "#c19f1a99",
|
||||
"titleBar.inactiveForeground": "#15202b99",
|
||||
"commandCenter.border": "#15202b99"
|
||||
"commandCenter.border": "#15202b99",
|
||||
"activityBarTop.activeBackground": "#e2bd2b",
|
||||
"activityBarTop.activeBorder": "#15202b",
|
||||
"activityBarTop.background": "#e2bd2b",
|
||||
"activityBarTop.foreground": "#15202b",
|
||||
"activityBarTop.inactiveForeground": "#15202b99",
|
||||
"commandCenter.foreground": "#15202b",
|
||||
"statusBar.debuggingBackground": "#c19f1a",
|
||||
"statusBar.debuggingForeground": "#15202b",
|
||||
"statusBar.inactiveBackground": "#c19f1a"
|
||||
},
|
||||
"peacock.remoteColor": "#c19f1a"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-7.3:latest
|
||||
ARG PHP_8_5_TAG=latest
|
||||
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/uwil-production-8.5:${PHP_8_5_TAG}
|
||||
COPY --chown=www-data:www-data . /app/srcs
|
||||
USER root
|
||||
RUN chmod -R 755 /app/srcs/storage
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Models\User;
|
||||
|
||||
class AdminCreate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'admin:create';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Create Admin User';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$role = 0;
|
||||
$name = $this->ask('Name ?');
|
||||
$email = $this->ask('Email ?');
|
||||
$password = $this->secret('What is the password?');
|
||||
|
||||
$user = new User([
|
||||
'name' => $name,
|
||||
'email' => $email,
|
||||
'role' => $role,
|
||||
'password' => Hash::make($password)
|
||||
]);
|
||||
$user->saveOrFail();
|
||||
|
||||
$this->info('Admin created.');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
49
app/Console/Commands/UserCreate.php
Normal file
49
app/Console/Commands/UserCreate.php
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class UserCreate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $signature = 'user:create';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $description = 'Create a backend user';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$name = $this->ask('What is the name?');
|
||||
$email = $this->ask('What is the email?');
|
||||
$role = $this->ask('What is the role 1 (SuperAdmin) or 2 (Admin) ?') == '1' ? 1 : 2;
|
||||
$pwd = $this->secret('What is the password?');
|
||||
|
||||
$user = new User();
|
||||
$user->name = $name;
|
||||
$user->email = $email;
|
||||
$user->role = $role;
|
||||
$user->password = Hash::make($pwd);
|
||||
$user->saveOrFail();
|
||||
|
||||
$this->info('User created.');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -12,8 +12,7 @@ class Kernel extends ConsoleKernel
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $commands = [
|
||||
];
|
||||
protected $commands = [];
|
||||
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
|
|
@ -23,7 +22,10 @@ class Kernel extends ConsoleKernel
|
|||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// Write schedules here.
|
||||
// * FIXME: remove this when swithing to latest php version and ldc-web-admin-secure-laravel package
|
||||
if ($this->app->environment('staging')) {
|
||||
$schedule->command('ldcweb:admin-secure-sync')->daily();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $dontReport = [];
|
||||
|
||||
/**
|
||||
|
|
@ -38,6 +39,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
|
|
@ -50,9 +52,9 @@ class Handler extends ExceptionHandler
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (\Throwable $e) {
|
||||
$this->reportable(function (\Throwable $e): void {
|
||||
if (app()->bound('sentry')) {
|
||||
app('sentry')->captureException($e);
|
||||
resolve('sentry')->captureException($e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ class AdviceController extends Controller
|
|||
}
|
||||
|
||||
if (!$advice->saveOrFail()) {
|
||||
return redirect()->route('bo.advice.edit', $advice->id)
|
||||
return to_route('bo.advice.edit', $advice->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.advice.edit', $advice->id)
|
||||
return to_route('bo.advice.edit', $advice->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ class EncartsController extends Controller
|
|||
}
|
||||
|
||||
if (!$encart->saveOrFail()) {
|
||||
return redirect()->route('bo.encarts.edit', $encart->id)
|
||||
return to_route('bo.encarts.edit', $encart->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.encarts.edit', $encart->id)
|
||||
return to_route('bo.encarts.edit', $encart->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class GammesController extends Controller
|
|||
foreach ($dbGammes as $gamme) {
|
||||
$gammes->push($gamme);
|
||||
$gamme->childGammes->sortBy('title')
|
||||
->map(function (Gamme $childGamme) use (&$gammes) {
|
||||
->map(function (Gamme $childGamme) use (&$gammes): void {
|
||||
$gammes->push($childGamme);
|
||||
});
|
||||
}
|
||||
|
|
@ -69,9 +69,9 @@ class GammesController extends Controller
|
|||
}
|
||||
|
||||
if (!$gamme->saveOrFail()) {
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee');
|
||||
return to_route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee');
|
||||
}
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)->with('success', 'Gamme créée !');
|
||||
return to_route('bo.gammes.edit', $gamme->id)->with('success', 'Gamme créée !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -111,11 +111,11 @@ class GammesController extends Controller
|
|||
}
|
||||
|
||||
if (!$gamme->saveOrFail()) {
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)
|
||||
return to_route('bo.gammes.edit', $gamme->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)
|
||||
return to_route('bo.gammes.edit', $gamme->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
|
|
@ -128,9 +128,9 @@ class GammesController extends Controller
|
|||
public function destroy(Gamme $gamme)
|
||||
{
|
||||
if (!$gamme->delete()) {
|
||||
return redirect()->route('bo.gammes.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.gammes.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.gammes.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.gammes.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,11 +49,11 @@ class MomentsController extends Controller
|
|||
}
|
||||
|
||||
if (!$moment->saveOrFail()) {
|
||||
return redirect()->route('bo.moments.edit', $moment->id)
|
||||
return to_route('bo.moments.edit', $moment->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.moments.edit', $moment->id)
|
||||
return to_route('bo.moments.edit', $moment->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,10 @@ class PictoBrandsController extends Controller
|
|||
}
|
||||
|
||||
if (!$pictobrand->saveOrFail()) {
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
|
||||
return to_route('bo.pictobrands.edit', $pictobrand->id)
|
||||
->with('error', 'Le pictogramme n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
|
||||
return to_route('bo.pictobrands.edit', $pictobrand->id)
|
||||
->with('success', 'Pictogramme créé !');
|
||||
}
|
||||
|
||||
|
|
@ -84,11 +84,11 @@ class PictoBrandsController extends Controller
|
|||
}
|
||||
|
||||
if (!$pictobrand->saveOrFail()) {
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
|
||||
return to_route('bo.pictobrands.edit', $pictobrand->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
|
||||
return to_route('bo.pictobrands.edit', $pictobrand->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ class PictoBrandsController extends Controller
|
|||
public function destroy(PictoBrand $pictobrand)
|
||||
{
|
||||
if (!$pictobrand->delete()) {
|
||||
return redirect()->route('bo.pictobrands.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.pictobrands.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictobrands.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.pictobrands.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ class PictosController extends Controller
|
|||
$picto->page = Page::marqueBloc2();
|
||||
|
||||
if (!$picto->saveOrFail()) {
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée');
|
||||
return to_route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)->with('success', 'Pictogramme créé !');
|
||||
return to_route('bo.pictos.edit', $picto->id)->with('success', 'Pictogramme créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -88,11 +88,11 @@ class PictosController extends Controller
|
|||
}
|
||||
|
||||
if (!$picto->saveOrFail()) {
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)
|
||||
return to_route('bo.pictos.edit', $picto->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictos.edit', $picto->id)
|
||||
return to_route('bo.pictos.edit', $picto->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
|
|
@ -105,11 +105,11 @@ class PictosController extends Controller
|
|||
public function destroy(Picto $picto)
|
||||
{
|
||||
if (!$picto->delete()) {
|
||||
return redirect()->route('bo.pictos.content', $picto->page)
|
||||
return to_route('bo.pictos.content', $picto->page)
|
||||
->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.pictos.content', $picto->page)
|
||||
return to_route('bo.pictos.content', $picto->page)
|
||||
->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,9 +55,9 @@ class PostsController extends Controller
|
|||
$response = $post->saveOrFail();
|
||||
}
|
||||
if (!$response) {
|
||||
return redirect()->route('bo.posts.edit', $post->id)->with('error', 'L\'actualité n\'a pas été créee');
|
||||
return to_route('bo.posts.edit', $post->id)->with('error', 'L\'actualité n\'a pas été créee');
|
||||
}
|
||||
return redirect()->route('bo.posts.edit', $post->id)->with('success', 'Actualité créée !');
|
||||
return to_route('bo.posts.edit', $post->id)->with('success', 'Actualité créée !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -95,11 +95,11 @@ class PostsController extends Controller
|
|||
$response = $post->saveOrFail();
|
||||
}
|
||||
if (!$response) {
|
||||
return redirect()->route('bo.posts.edit', $post->id)
|
||||
return to_route('bo.posts.edit', $post->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.posts.edit', $post->id)
|
||||
return to_route('bo.posts.edit', $post->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
|
|
@ -112,10 +112,10 @@ class PostsController extends Controller
|
|||
public function destroy(Post $post)
|
||||
{
|
||||
if (!$post->delete()) {
|
||||
return redirect()->route('bo.posts.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.posts.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.posts.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.posts.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -36,93 +36,93 @@ class ProductsController extends Controller
|
|||
{
|
||||
$gammes = Gamme::all()->sortBy('title');
|
||||
// Default structure + produits.
|
||||
$tabFour = array(
|
||||
$tabFour = [
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/four.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
];
|
||||
$tabFriteuse = [
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/friteuse.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPoele = array(
|
||||
];
|
||||
$tabPoele = [
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/poele.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
];
|
||||
$tabCocotte = [
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/cocotte.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlancha = array(
|
||||
];
|
||||
$tabPlancha = [
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/plancha.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabBainMarie = array(
|
||||
];
|
||||
$tabBainMarie = [
|
||||
'id' => 5,
|
||||
'name' => 'Bain Marie',
|
||||
'url' => '/assets/images/bainmarie.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabBarbecue = array(
|
||||
];
|
||||
$tabBarbecue = [
|
||||
'id' => 6,
|
||||
'name' => 'Barbecue',
|
||||
'url' => '/assets/images/barbecue.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabMicroOndes = array(
|
||||
];
|
||||
$tabMicroOndes = [
|
||||
'id' => 7,
|
||||
'name' => 'Micro Ondes',
|
||||
'url' => '/assets/images/microondes.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabCasserole = array(
|
||||
];
|
||||
$tabCasserole = [
|
||||
'id' => 8,
|
||||
'name' => 'Casserole',
|
||||
'url' => '/assets/images/casserole.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlusProduit1 = array(
|
||||
];
|
||||
$tabPlusProduit1 = [
|
||||
'id' => 0,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit2 = array(
|
||||
];
|
||||
$tabPlusProduit2 = [
|
||||
'id' => 1,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit3 = array(
|
||||
];
|
||||
$tabPlusProduit3 = [
|
||||
'id' => 2,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
];
|
||||
//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]);
|
||||
|
|
@ -153,12 +153,9 @@ class ProductsController extends Controller
|
|||
$product->plusproduit = json_encode($plusproduit);
|
||||
|
||||
if (!$product->saveOrFail()) {
|
||||
return redirect()->route(
|
||||
'bo.products.edit',
|
||||
$product->id
|
||||
)->with('error', 'Le produit n\'a pas été crée');
|
||||
return to_route('bo.products.edit', $product->id)->with('error', 'Le produit n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.products.edit', $product->id)->with('success', 'Produit créé !');
|
||||
return to_route('bo.products.edit', $product->id)->with('success', 'Produit créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -210,11 +207,11 @@ class ProductsController extends Controller
|
|||
// Encodage avant save.
|
||||
$product->plusproduit = json_encode($plusproduit);
|
||||
if (!$product->saveOrFail()) {
|
||||
return redirect()->route('bo.products.edit', $product->id)
|
||||
return to_route('bo.products.edit', $product->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.products.edit', $product->id)
|
||||
return to_route('bo.products.edit', $product->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
|
|
@ -227,9 +224,9 @@ class ProductsController extends Controller
|
|||
public function destroy(Product $product)
|
||||
{
|
||||
if (!$product->delete()) {
|
||||
return redirect()->route('bo.products.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.products.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.products.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.products.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class SeoDataController extends Controller
|
|||
$SeoDatum->fill($request->validated());
|
||||
$SeoDatum->save();
|
||||
|
||||
return redirect()->route('bo.seo_data.edit', $SeoDatum->page)
|
||||
return to_route('bo.seo_data.edit', $SeoDatum->page)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ class SlidersController extends Controller
|
|||
$slider = new Slider($request->validated());
|
||||
|
||||
if (!$slider->saveOrFail()) {
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'Le slider n\'a pas été crée');
|
||||
return to_route('bo.sliders.edit', $slider->id)->with('error', 'Le slider n\'a pas été crée');
|
||||
}
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Slider créé !');
|
||||
return to_route('bo.sliders.edit', $slider->id)->with('success', 'Slider créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -75,10 +75,10 @@ class SlidersController extends Controller
|
|||
$slider->fill($request->validated());
|
||||
|
||||
if (!$slider->saveOrFail()) {
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'La modification a échoué');
|
||||
return to_route('bo.sliders.edit', $slider->id)->with('error', 'La modification a échoué');
|
||||
}
|
||||
|
||||
return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Modifications enregistrées !');
|
||||
return to_route('bo.sliders.edit', $slider->id)->with('success', 'Modifications enregistrées !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -92,12 +92,12 @@ class SlidersController extends Controller
|
|||
$count = Slider::count();
|
||||
|
||||
if ($count === 1) {
|
||||
return redirect()->back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider");
|
||||
return back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider");
|
||||
}
|
||||
|
||||
if (!$slider->delete()) {
|
||||
return redirect()->route('bo.sliders.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.sliders.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
return redirect()->route('bo.sliders.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.sliders.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class SlidesController extends Controller
|
|||
|
||||
$slide->saveOrFail();
|
||||
|
||||
return redirect()->route('bo.slides.edit', $slide->id)->with('success', 'Slide créé !');
|
||||
return to_route('bo.slides.edit', $slide->id)->with('success', 'Slide créé !');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -84,10 +84,10 @@ class SlidesController extends Controller
|
|||
}
|
||||
|
||||
if (!$slide->saveOrFail()) {
|
||||
return redirect()->route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué'));
|
||||
return to_route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !'));
|
||||
return to_route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -99,10 +99,10 @@ class SlidesController extends Controller
|
|||
public function destroy(Slide $slide)
|
||||
{
|
||||
if (!$slide->delete()) {
|
||||
return redirect()->route('bo.slides.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.slides.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.slides.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.slides.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,12 +46,10 @@ class TextsController extends Controller
|
|||
$text->page = Page::newsQuestions();
|
||||
|
||||
if (!$text->saveOrFail()) {
|
||||
return redirect()
|
||||
->route('bo.texts.edit', $text->id)
|
||||
return to_route('bo.texts.edit', $text->id)
|
||||
->with('error', 'La question/réponse n\'a pas été créée');
|
||||
}
|
||||
return redirect()
|
||||
->route('bo.texts.edit', $text->id)
|
||||
return to_route('bo.texts.edit', $text->id)
|
||||
->with('success', 'Question/réponse créée !');
|
||||
}
|
||||
|
||||
|
|
@ -80,11 +78,11 @@ class TextsController extends Controller
|
|||
$text->fill($request->validated());
|
||||
|
||||
if (!$text->saveOrFail()) {
|
||||
return redirect()->route('bo.texts.edit', $text->id)
|
||||
return to_route('bo.texts.edit', $text->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.texts.edit', $text->id)
|
||||
return to_route('bo.texts.edit', $text->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
|
||||
|
|
@ -97,11 +95,11 @@ class TextsController extends Controller
|
|||
public function destroy(Text $text)
|
||||
{
|
||||
if (!$text->delete()) {
|
||||
return redirect()->route('bo.texts.content', $text->page)
|
||||
return to_route('bo.texts.content', $text->page)
|
||||
->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.texts.content', $text->page)
|
||||
return to_route('bo.texts.content', $text->page)
|
||||
->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ class TitlesController extends Controller
|
|||
$title->fill($request->validated());
|
||||
|
||||
if (!$title->saveOrFail()) {
|
||||
return redirect()->route('bo.titles.edit', $title->id)
|
||||
return to_route('bo.titles.edit', $title->id)
|
||||
->with('error', trans('La modification a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.titles.edit', $title->id)
|
||||
return to_route('bo.titles.edit', $title->id)
|
||||
->with('success', trans('Modifications enregistrées !'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,13 +18,9 @@ class ContactController extends Controller
|
|||
*/
|
||||
public function contact()
|
||||
{
|
||||
$listCountries = Cache::remember('listCountries', 86400, function () {
|
||||
return Country::toArray();
|
||||
});
|
||||
$listCountries = Cache::remember('listCountries', 86400, fn() => Country::toArray());
|
||||
|
||||
$listDeps = Cache::remember('listDeps', 86400, function () {
|
||||
return Department::toArray();
|
||||
});
|
||||
$listDeps = Cache::remember('listDeps', 86400, fn() => Department::toArray());
|
||||
|
||||
return view('front.contact', compact('listCountries', 'listDeps'));
|
||||
}
|
||||
|
|
@ -47,7 +43,7 @@ class ContactController extends Controller
|
|||
Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($data->all()));
|
||||
|
||||
$lang = session()->get('lang', config('app.locale'));
|
||||
return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")
|
||||
->with('status', true);
|
||||
return to_route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")
|
||||
->with('status', true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class GammesController extends Controller
|
|||
foreach ($dbGammes as $dbGamme) {
|
||||
$gammes->push($dbGamme->id);
|
||||
$dbGamme->childGammes->sortBy('title')
|
||||
->map(function (Gamme $childGamme) use (&$gammes) {
|
||||
->map(function (Gamme $childGamme) use (&$gammes): void {
|
||||
$gammes->push($childGamme->id);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,15 +26,15 @@ class HomeController extends Controller
|
|||
|
||||
$slider = Slider::where('published', 1)->first();
|
||||
if ($slider) {
|
||||
$slides = Slide::whereHas('slider', function ($q) use ($slider) {
|
||||
$slides = Slide::whereHas('slider', function (\Illuminate\Contracts\Database\Query\Builder $q) use ($slider): void {
|
||||
$q->whereId($slider->id);
|
||||
})->where(function ($q) {
|
||||
})->where(function ($q): void {
|
||||
$q->where(
|
||||
function ($q) {
|
||||
$q->where('date_start', '<=', Carbon::now()->format('Y-m-d H:i:s'))
|
||||
->where('date_end', '>', Carbon::now()->format('Y-m-d H:i:s'));
|
||||
function ($q): void {
|
||||
$q->where('date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s'))
|
||||
->where('date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s'));
|
||||
}
|
||||
)->orWhere(function ($q) {
|
||||
)->orWhere(function ($q): void {
|
||||
$q->whereNull('date_start')
|
||||
->whereNull('date_end');
|
||||
});
|
||||
|
|
@ -47,8 +47,8 @@ class HomeController extends Controller
|
|||
$encart_home = Encart::where('page', Page::homeHeader()->value)->first();
|
||||
|
||||
$post_home = Post::where([
|
||||
['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
|
||||
['date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
|
||||
['on_top', true]
|
||||
])->first();
|
||||
// Limitation à 3 produits affichés sur la homepage.
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ class NewsController extends Controller
|
|||
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
|
||||
|
||||
$posts = Post::where([
|
||||
['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')],
|
||||
['date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
|
||||
['date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
|
||||
])
|
||||
->orderBy('created_at', 'DESC')
|
||||
->get();
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Kernel extends HttpKernel
|
|||
*/
|
||||
protected $middleware = [
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Fruitcake\Cors\HandleCors::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
|
|
@ -37,7 +37,7 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
'lang-check',
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Foundation\Http\Middleware\PreventRequestForgery::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\SecureHeaders::class
|
||||
],
|
||||
|
|
@ -55,7 +55,7 @@ class Kernel extends HttpKernel
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
|
|
@ -68,5 +68,6 @@ class Kernel extends HttpKernel
|
|||
'lang-check' => LangCheck::class,
|
||||
'front-end-globals' => FrontEndGlobals::class,
|
||||
'back-end-globals' => BackEndGlobals::class,
|
||||
'admin-secure' => \App\Http\Middleware\AdminSecureMiddleware::class,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
46
app/Http/Middleware/AdminSecureMiddleware.php
Normal file
46
app/Http/Middleware/AdminSecureMiddleware.php
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Lib\AdminSecure;
|
||||
use Closure;
|
||||
use Dxw\CIDR\IP;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AdminSecureMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
if (config('app.env') === 'local') {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
$client_ip = AdminSecure::fetchClientIp();
|
||||
|
||||
$ip_is_allowed = \collect(AdminSecure::getOptions()->getCidrList())
|
||||
->reduce(fn($initial, $ip_range) => $initial || IP::contains(
|
||||
$ip_range,
|
||||
$client_ip
|
||||
)->unwrap());
|
||||
|
||||
$ip_is_allowed_by_config = \collect(AdminSecure::getOptions()->getCidrAllowedList())
|
||||
->reduce(fn($initial, $ip_range) => $initial || IP::contains(
|
||||
$ip_range,
|
||||
$client_ip
|
||||
)->unwrap());
|
||||
|
||||
if ($ip_is_allowed or $ip_is_allowed_by_config or AdminSecure::ipIsPrivate($client_ip)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
abort(403, \trans('Denied IP'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -11,6 +11,7 @@ class EncryptCookies extends Middleware
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $except = [
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ class FrontEndGlobals
|
|||
$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');
|
||||
array_walk($routeParamsFR, $this->unbind(...), '');
|
||||
array_walk($routeParamsEN, $this->unbind(...), 'en');
|
||||
array_walk($routeParamsES, $this->unbind(...), 'es');
|
||||
if (preg_match('/^(en|es)/', $currentRoute)) {
|
||||
$currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute, 1);
|
||||
$currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute, 1);
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ class LangCheck
|
|||
if ($this->checkFirstAccess($request)) {
|
||||
$sess_lang = $request->session()->get('lang', config('app.locale'));
|
||||
if ($sess_lang === config('app.locale')) {
|
||||
return redirect()->route($routName, $request->route()->parameters());
|
||||
return to_route($routName, $request->route()->parameters());
|
||||
}
|
||||
return redirect()->route($sess_lang . '.' . $routName, $request->route()->parameters());
|
||||
return to_route($sess_lang . '.' . $routName, $request->route()->parameters());
|
||||
}
|
||||
$this->saveUserLocale(
|
||||
config('app.locale'),
|
||||
|
|
@ -88,6 +88,9 @@ class LangCheck
|
|||
*/
|
||||
private function checkFirstAccess(Request $request)
|
||||
{
|
||||
if (str_contains($request->header('User-Agent'), "Uptime-Kuma")) {
|
||||
return false;
|
||||
}
|
||||
// Do we have session ?
|
||||
if (!$request->session()->has('lang')) {
|
||||
$fromC = Cookie::get('language');
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class PreventRequestsDuringMaintenance extends Middleware
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $except = [
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,28 +45,20 @@ class SecureHeaders
|
|||
$cspPolicies = [
|
||||
// "default-src 'none';",
|
||||
"manifest-src 'self';",
|
||||
"connect-src 'self' blob: " . \implode(' ', [
|
||||
'https://*.google-analytics.com',
|
||||
'https://*.analytics.google.com',
|
||||
'https://*.googletagmanager.com',
|
||||
'https://*.g.doubleclick.net',
|
||||
'https://*.google.com',
|
||||
]) . ';',
|
||||
"img-src * data: blob: " . \implode(' ', [
|
||||
'https://*.google-analytics.com',
|
||||
'https://*.analytics.google.com',
|
||||
'https://*.googletagmanager.com',
|
||||
'https://*.g.doubleclick.net',
|
||||
'https://*.google.com',
|
||||
]) . ';',
|
||||
"connect-src 'self' https://yl.s-web.fr blob:;",
|
||||
"img-src * https://yl.s-web.fr data: blob:;",
|
||||
'frame-src ' . implode(' ', [
|
||||
'https://www.google.com/recaptcha/',
|
||||
'https://recaptcha.google.com/recaptcha/',
|
||||
]),
|
||||
]) . ';',
|
||||
// "font-src 'self' data:;",
|
||||
// ! Using CKEditor will must have unsafe-inline style
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
"style-src 'self' 'unsafe-inline';",
|
||||
'style-src ' . implode(" ", [
|
||||
'\'self\'',
|
||||
'\'unsafe-inline\'',
|
||||
'https://cdn.jsdelivr.net',
|
||||
]) . ';',
|
||||
// ! If you dont use ckeditor use this
|
||||
// "style-src 'self' 'nonce-$nonce';",
|
||||
// phpcs:ignore Generic.Files.LineLength.TooLong
|
||||
|
|
@ -74,7 +66,7 @@ class SecureHeaders
|
|||
'\'self\'',
|
||||
'https://www.google.com/recaptcha/',
|
||||
'https://www.gstatic.com/recaptcha/',
|
||||
'https://*.googletagmanager.com',
|
||||
'https://yl.s-web.fr',
|
||||
'https://cdn.ckeditor.com',
|
||||
'https://cdn.jsdelivr.net',
|
||||
]) . ' ' . $jsDev . ';'
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class TrimStrings extends Middleware
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class TrustProxies extends Middleware
|
|||
*
|
||||
* @var array|string|null
|
||||
*/
|
||||
#[\Override]
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
|
|
@ -19,6 +20,7 @@ class TrustProxies extends Middleware
|
|||
*
|
||||
* @var integer
|
||||
*/
|
||||
#[\Override]
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [
|
||||
];
|
||||
}
|
||||
|
|
@ -30,11 +30,11 @@ class StorePostRequest extends FormRequest
|
|||
{
|
||||
try {
|
||||
$this->merge([
|
||||
'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(),
|
||||
'date_start' => \Illuminate\Support\Facades\Date::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
|
||||
'date_end' => \Illuminate\Support\Facades\Date::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
|
||||
'on_top' => $this->on_top ? true : false,
|
||||
]);
|
||||
} catch (InvalidFormatException $e) {
|
||||
} catch (InvalidFormatException) {
|
||||
$error = ValidationException::withMessages([
|
||||
'date_start_date' => ['Format de date incorrect'],
|
||||
'date_end_date' => ['Format de date incorrect'],
|
||||
|
|
@ -58,13 +58,13 @@ class StorePostRequest extends FormRequest
|
|||
'date_start' => [
|
||||
'required',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
|
||||
],
|
||||
'date_end' => [
|
||||
'required',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'after:date_start',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
|
||||
],
|
||||
'picture_home' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max_width=1030,max_height=239',
|
||||
'alt_text_picture_home' => 'required|max:255',
|
||||
|
|
|
|||
|
|
@ -26,78 +26,78 @@ class StoreProductRequest extends FormRequest
|
|||
*/
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
$tabFour = array(
|
||||
$tabFour = [
|
||||
'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(
|
||||
];
|
||||
$tabFriteuse = [
|
||||
'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(
|
||||
];
|
||||
$tabPoele = [
|
||||
'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(
|
||||
];
|
||||
$tabCocotte = [
|
||||
'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(
|
||||
];
|
||||
$tabPlancha = [
|
||||
'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(
|
||||
];
|
||||
$tabBainMarie = [
|
||||
'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(
|
||||
];
|
||||
$tabBarbecue = [
|
||||
'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(
|
||||
];
|
||||
$tabMicroOndes = [
|
||||
'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(
|
||||
];
|
||||
$tabCasserole = [
|
||||
'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,
|
||||
|
|
@ -114,29 +114,29 @@ class StoreProductRequest extends FormRequest
|
|||
if ($this->pictogramme0) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme0->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit1 = array(
|
||||
$tabPlusProduit1 = [
|
||||
'id' => 0,
|
||||
'name' => $this->content0,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
];
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme1) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme1->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit2 = array(
|
||||
$tabPlusProduit2 = [
|
||||
'id' => 1,
|
||||
'name' => $this->content1,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
];
|
||||
$urlPlusProduit = "";
|
||||
if ($this->pictogramme2) {
|
||||
$urlPlusProduit = "/assets/images/" . $this->pictogramme2->getClientOriginalName();
|
||||
}
|
||||
$tabPlusProduit3 = array(
|
||||
$tabPlusProduit3 = [
|
||||
'id' => 2,
|
||||
'name' => $this->content2,
|
||||
'url' => $urlPlusProduit,
|
||||
);
|
||||
];
|
||||
$tabPlusProduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->name),
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ class StoreSlideRequest extends FormRequest
|
|||
{
|
||||
try {
|
||||
$this->merge([
|
||||
'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(),
|
||||
'date_start' => \Illuminate\Support\Facades\Date::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
|
||||
'date_end' => \Illuminate\Support\Facades\Date::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
|
||||
]);
|
||||
} catch (InvalidFormatException $e) {
|
||||
} catch (InvalidFormatException) {
|
||||
$error = \Illuminate\Validation\ValidationException::withMessages([
|
||||
'date_start_date' => ['Format de date incorrect'],
|
||||
'date_end_date' => ['Format de date incorrect'],
|
||||
|
|
@ -40,8 +40,8 @@ class StoreSlideRequest extends FormRequest
|
|||
throw $error;
|
||||
}
|
||||
$this->merge([
|
||||
'title' => 'lorem title ' . rand(),
|
||||
'text' => 'lorem text ' . rand(),
|
||||
'title' => 'lorem title ' . random_int(0, mt_getrandmax()),
|
||||
'text' => 'lorem text ' . random_int(0, mt_getrandmax()),
|
||||
'link_new_tab' => $this->link_new_tab ? true : false
|
||||
]);
|
||||
}
|
||||
|
|
@ -65,13 +65,13 @@ class StoreSlideRequest extends FormRequest
|
|||
'date_start' => [
|
||||
'nullable',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
|
||||
],
|
||||
'date_end' => [
|
||||
'nullable',
|
||||
'date_format:Y-m-d H:i:s',
|
||||
'after:date_start',
|
||||
'before:' . Carbon::now()->parse('2037-12-31')
|
||||
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
123
app/Lib/AdminSecure.php
Normal file
123
app/Lib/AdminSecure.php
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
|
||||
namespace App\Lib;
|
||||
|
||||
use App\Lib\Options;
|
||||
use Dxw\CIDR\IPAddress;
|
||||
use Dxw\CIDR\IPv4Address;
|
||||
use Dxw\CIDR\IPv4Range;
|
||||
use Dxw\CIDR\IPv6Address;
|
||||
use Dxw\CIDR\IPv6Range;
|
||||
|
||||
abstract class AdminSecure
|
||||
{
|
||||
/**
|
||||
* Private ipV4 CIDR list
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $private_ip_v4_cidr_list = [
|
||||
'10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'
|
||||
];
|
||||
|
||||
/**
|
||||
* Private ipV4 CIDR loopback
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $private_ip_v4_loopback_cidr = '127.0.0.0/8';
|
||||
|
||||
/**
|
||||
* Private ipV6 CIDR list
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $private_ip_v6_cidr_list = [
|
||||
'fd00::/8'
|
||||
];
|
||||
|
||||
/**
|
||||
* Private ipV6 CIDR loopback
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $private_ip_v6_loopback_cidr = '::1/128';
|
||||
|
||||
/**
|
||||
* Private options
|
||||
*
|
||||
* @var \Uwil\AdminSecure\Laravel\Options|null
|
||||
*/
|
||||
private static $options = null;
|
||||
|
||||
/**
|
||||
* Check if ip is private
|
||||
*
|
||||
* @param \Dxw\CIDR\IPv4Address|\Dxw\CIDR\IPv6Address $ip_address
|
||||
* @return boolean
|
||||
*/
|
||||
public static function ipIsPrivate($ip_address): bool
|
||||
{
|
||||
return $ip_address::class === IPv4Address::class ?
|
||||
self::ipV4IsPrivate($ip_address) : self::ipV6IsPrivate($ip_address);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch client IP
|
||||
*
|
||||
* @return \Dxw\CIDR\IPv4Address|\Dxw\CIDR\IPv6Address
|
||||
* @throws \Uwil\AdminSecure\Laravel\Exceptions\AdminSecureException If the ip is invalid.
|
||||
*/
|
||||
public static function fetchClientIp()
|
||||
{
|
||||
// ! REVERSE PROXY HACK.
|
||||
$ip = request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp();
|
||||
$ip = IPAddress::Make($ip);
|
||||
|
||||
if ($ip->isErr()) {
|
||||
throw new \Exception(\trans('Client IP not valid ') . $ip->getErr());
|
||||
}
|
||||
return $ip->unwrap();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ipV4 is private
|
||||
*
|
||||
* @param \Dxw\CIDR\IPv4Address $ipv4_address
|
||||
* @return boolean
|
||||
*/
|
||||
private static function ipV4IsPrivate(IPv4Address $ipv4_address): bool
|
||||
{
|
||||
return \collect(self::$private_ip_v4_cidr_list)
|
||||
->concat([self::$private_ip_v4_loopback_cidr])
|
||||
->map(fn(string $ipv4_cidr) => IPv4Range::Make($ipv4_cidr)->unwrap())
|
||||
->reduce(fn($initial, IPv4Range $ipv4_range) => $initial || $ipv4_range->containsAddress($ipv4_address));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if ipV6 is private
|
||||
*
|
||||
* @param \Dxw\CIDR\IPv6Address $ipv6_address
|
||||
* @return boolean
|
||||
*/
|
||||
private static function ipV6IsPrivate(IPv6Address $ipv6_address): bool
|
||||
{
|
||||
return \collect(self::$private_ip_v6_cidr_list)
|
||||
->concat([self::$private_ip_v6_loopback_cidr])
|
||||
->map(fn(string $ipv6_cidr) => IPv6Range::Make($ipv6_cidr)->unwrap())
|
||||
->reduce(fn($initial, IPv6Range $ipv6_range) => $initial || $ipv6_range->containsAddress($ipv6_address));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Admin secure options
|
||||
*
|
||||
* @return \App\Lib\Options
|
||||
*/
|
||||
public static function getOptions(): Options
|
||||
{
|
||||
if (!self::$options) {
|
||||
self::$options = new Options(\config('admin-secure'));
|
||||
}
|
||||
return self::$options;
|
||||
}
|
||||
}
|
||||
|
|
@ -170,19 +170,12 @@ class ExceptionsHelper
|
|||
$argsCount = count($stack['args']);
|
||||
for ($i = 0; $i < $argsCount; $i++) {
|
||||
$type = \gettype($stack['args'][$i]);
|
||||
switch ($type) {
|
||||
case 'object':
|
||||
$traceArgs .= sprintf('Object(%s)', \get_class($stack['args'][$i]));
|
||||
break;
|
||||
case 'array':
|
||||
$traceArgs .= sprintf('Array(%d)', \count($stack['args'][$i]));
|
||||
break;
|
||||
case 'string':
|
||||
$traceArgs .= sprintf('String(%d)', \strlen($stack['args'][$i]));
|
||||
break;
|
||||
default:
|
||||
$traceArgs .= \gettype($stack['args'][$i]);
|
||||
}
|
||||
match ($type) {
|
||||
'object' => $traceArgs .= sprintf('Object(%s)', $stack['args'][$i]::class),
|
||||
'array' => $traceArgs .= sprintf('Array(%d)', \count($stack['args'][$i])),
|
||||
'string' => $traceArgs .= sprintf('String(%d)', \strlen($stack['args'][$i])),
|
||||
default => $traceArgs .= \gettype($stack['args'][$i]),
|
||||
};
|
||||
$traceArgs .= ($i !== ($argsCount - 1) ? ',' : '');
|
||||
}
|
||||
return $traceArgs;
|
||||
|
|
|
|||
|
|
@ -22,40 +22,30 @@ class ToolboxHelper
|
|||
'g-recaptcha-response' => [
|
||||
'required', 'string',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
|
||||
function ($attribute, $value, $fail) use ($isV3) {
|
||||
function ($attribute, $value, $fail) use ($isV3): void {
|
||||
try {
|
||||
$response = Http::asForm()->post('https://www.google.com/recaptcha/api/siteverify', [
|
||||
'secret' => config('services.google.recaptcha.private'),
|
||||
'response' => \strval($value),
|
||||
'remoteip' => app('clientIp')
|
||||
'remoteip' => resolve('clientIp')
|
||||
]);
|
||||
if ($e = $response->toException()) {
|
||||
throw $e;
|
||||
}
|
||||
throw_if($e = $response->toException(), $e);
|
||||
if ($isV3) {
|
||||
if (
|
||||
!$response->json('success') or
|
||||
!$response->json('challenge_ts') or
|
||||
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
|
||||
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or
|
||||
!$response->json('score')
|
||||
) {
|
||||
throw new \RuntimeException();
|
||||
}
|
||||
throw_if(!$response->json('success') or
|
||||
!$response->json('challenge_ts') or
|
||||
\Illuminate\Support\Facades\Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
|
||||
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or
|
||||
!$response->json('score'), \RuntimeException::class);
|
||||
if (\floatval($response->json('score')) < 0.8) {
|
||||
$fail("Vous n'avez pas obtenu un score assez élevé lors de la validation du recaptcha");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!$response->json('success') or
|
||||
!$response->json('challenge_ts') or
|
||||
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
|
||||
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST)
|
||||
) {
|
||||
throw new \RuntimeException();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw_if(!$response->json('success') or
|
||||
!$response->json('challenge_ts') or
|
||||
\Illuminate\Support\Facades\Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
|
||||
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST), \RuntimeException::class);
|
||||
} catch (\Exception) {
|
||||
$fail('Erreur lors de la validation du formulaire veuillez réssayer');
|
||||
} //end try
|
||||
}
|
||||
|
|
|
|||
157
app/Lib/Options.php
Normal file
157
app/Lib/Options.php
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Lib;
|
||||
|
||||
use Dxw\CIDR\IPv4Range;
|
||||
use Dxw\CIDR\IPv6Range;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
final class Options
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed> The configuration options
|
||||
*/
|
||||
private $options;
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\OptionsResolver\OptionsResolver The options resolver
|
||||
*/
|
||||
private $resolver;
|
||||
|
||||
/**
|
||||
* The cache key where to store config cidr list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $cache_config_key = 'uwil_ip_cidr_config_list';
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param array<string, mixed> $options The configuration options.
|
||||
*/
|
||||
public function __construct(array $options = [])
|
||||
{
|
||||
$this->resolver = new OptionsResolver();
|
||||
|
||||
$this->configureOptions($this->resolver);
|
||||
|
||||
$this->options = $this->resolver->resolve($options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cidr list
|
||||
*
|
||||
* @return array<\Dxw\CIDR\IPv4Range|\Dxw\CIDR\IPv6Range>
|
||||
*/
|
||||
public function getCidrList(): array
|
||||
{
|
||||
return $this->options['cidrList'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cidr project allowed list
|
||||
*
|
||||
* @return array<\Dxw\CIDR\IPv4Range|\Dxw\CIDR\IPv6Range>
|
||||
*/
|
||||
public function getCidrAllowedList(): array
|
||||
{
|
||||
return $this->options['cidrProjectAllowedList'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the options of the client.
|
||||
*
|
||||
* @param \Symfony\Component\OptionsResolver\OptionsResolver $resolver The resolver for the options.
|
||||
* @return void
|
||||
*/
|
||||
private function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'cidrList' => [],
|
||||
'cidrProjectAllowedList' => []
|
||||
]);
|
||||
|
||||
$resolver->setNormalizer('cidrList', $this->normalizeCidrList(...));
|
||||
$resolver->setNormalizer('cidrProjectAllowedList', $this->normalizeCidrProjectList(...));
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalise Cidr list for cidrList option
|
||||
*
|
||||
* @param \Symfony\Component\OptionsResolver\Options $options
|
||||
* @param string|null $value
|
||||
* @return array
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
|
||||
*/
|
||||
private function normalizeCidrList(
|
||||
\Symfony\Component\OptionsResolver\Options $options,
|
||||
?string $value
|
||||
): array {
|
||||
// phpcs:enable
|
||||
return $this->doNormalizeCidrList($value, 'cidrList');
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalise Cidr list for cidrProjectAllowedList option
|
||||
*
|
||||
* @param \Symfony\Component\OptionsResolver\Options $options
|
||||
* @param string|null $value
|
||||
* @return array
|
||||
* @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
|
||||
*/
|
||||
private function normalizeCidrProjectList(
|
||||
\Symfony\Component\OptionsResolver\Options $options,
|
||||
?string $value
|
||||
): array {
|
||||
// phpcs:enable
|
||||
return $this->doNormalizeCidrList($value, 'cidrProjectAllowedList');
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize CIDR list with specific cache key.
|
||||
*
|
||||
* @param string|null $value
|
||||
* @param string $optionName
|
||||
* @return array<\Dxw\CIDR\IPv4Range|\Dxw\CIDR\IPv6Range>
|
||||
*/
|
||||
private function doNormalizeCidrList(?string $value, string $optionName): array
|
||||
{
|
||||
$cacheConfigKey = self::$cache_config_key . '_' . $optionName;
|
||||
$allowed_cidr_config_list = collect(explode(',', strval($value)))->filter();
|
||||
$allowed_cidr_config_list_hash = \md5($allowed_cidr_config_list->implode(','));
|
||||
$allowed_cidr_list = [];
|
||||
|
||||
// Flush cache if config hash changed
|
||||
if ($allowed_cidr_config_list_hash !== \collect(Cache::get($cacheConfigKey))->get('hash')) {
|
||||
Cache::forget($cacheConfigKey);
|
||||
|
||||
/** @var array<\Dxw\CIDR\IPv4Range|\Dxw\CIDR\IPv6Range> $allowed_cidr_list */
|
||||
$allowed_cidr_list = $allowed_cidr_config_list
|
||||
->map(function (string $cidr) {
|
||||
$ip_range = !IPv4Range::Make($cidr)->isErr() ? IPv4Range::Make($cidr) : IPv6Range::Make($cidr);
|
||||
if ($ip_range->isErr()) {
|
||||
throw new \Exception(\trans(
|
||||
'CIDR LIST not valid (ipv4 or ipv6 cidr) :cidr',
|
||||
[
|
||||
'cidr' => $cidr
|
||||
]
|
||||
));
|
||||
}
|
||||
return $ip_range->unwrap();
|
||||
})->all();
|
||||
}
|
||||
|
||||
/** @var array<\Dxw\CIDR\IPv4Range|\Dxw\CIDR\IPv6Range> $allowed_cidr_list */
|
||||
return \collect(Cache::rememberForever($cacheConfigKey, fn() => [
|
||||
'list' => $allowed_cidr_list,
|
||||
'hash' => $allowed_cidr_config_list_hash
|
||||
]))->get('list');
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ class Utils
|
|||
*/
|
||||
public static function storeImage($image, string $folderName): string
|
||||
{
|
||||
if (\is_object($image) and get_class($image) === UploadedFile::class) {
|
||||
if (\is_object($image) and $image::class === UploadedFile::class) {
|
||||
/** @var UploadedFile */
|
||||
$image = $image;
|
||||
$newPath = self::prepareMoveFile($image->getClientOriginalName(), $folderName);
|
||||
|
|
@ -37,7 +37,7 @@ class Utils
|
|||
$image->storePubliclyAs(pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME));
|
||||
return '/storage' . str_replace('/public', '', $newPath);
|
||||
}
|
||||
if (\is_object($image) and get_class($image) === SplFileInfo::class) {
|
||||
if (\is_object($image) and $image::class === SplFileInfo::class) {
|
||||
/** @var SplFileInfo */
|
||||
$image = $image;
|
||||
$newPath = self::prepareMoveFile($image->getBaseName(), $folderName);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Advice extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title1',
|
||||
'title2',
|
||||
|
|
@ -57,7 +58,7 @@ class Advice extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Advice $advice) {
|
||||
static::creating(function (Advice $advice): void {
|
||||
if (is_a($advice->picture1, "SplFileInfo")) {
|
||||
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
|
||||
}
|
||||
|
|
@ -69,7 +70,7 @@ class Advice extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (Advice $advice) {
|
||||
static::updating(function (Advice $advice): void {
|
||||
if (is_a($advice->picture1, "SplFileInfo")) {
|
||||
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
|
||||
}
|
||||
|
|
@ -81,7 +82,7 @@ class Advice extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Advice $advice) {
|
||||
static::deleted(function (Advice $advice): void {
|
||||
if ($advice->picture1) {
|
||||
$urlPicture = public_path() . $advice->picture1;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class Encart extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -56,19 +57,19 @@ class Encart extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Encart $encart) {
|
||||
static::creating(function (Encart $encart): void {
|
||||
if (is_a($encart->picture, "SplFileInfo")) {
|
||||
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Encart $encart) {
|
||||
static::updating(function (Encart $encart): void {
|
||||
if (is_a($encart->picture, "SplFileInfo")) {
|
||||
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Encart $encart) {
|
||||
static::deleted(function (Encart $encart): void {
|
||||
if ($encart->picture) {
|
||||
$urlPicture = public_path() . $encart->picture;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Gamme extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'parent_gamme_id',
|
||||
'title',
|
||||
|
|
@ -53,7 +54,7 @@ class Gamme extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Gamme $gamme) {
|
||||
static::creating(function (Gamme $gamme): void {
|
||||
if (is_a($gamme->picture, "SplFileInfo")) {
|
||||
$gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable());
|
||||
}
|
||||
|
|
@ -67,7 +68,7 @@ class Gamme extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (Gamme $gamme) {
|
||||
static::updating(function (Gamme $gamme): void {
|
||||
if (is_a($gamme->picture, "SplFileInfo")) {
|
||||
$gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable());
|
||||
}
|
||||
|
|
@ -93,14 +94,14 @@ class Gamme extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::deleting(function (Gamme $gamme) {
|
||||
static::deleting(function (Gamme $gamme): void {
|
||||
if ($gamme->childGammes()->exists()) {
|
||||
Gamme::whereParentGammeId($gamme->id)
|
||||
->update(['parent_gamme_id' => null]);
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Gamme $gamme) {
|
||||
static::deleted(function (Gamme $gamme): void {
|
||||
if ($gamme->picture) {
|
||||
$urlPicture = public_path() . $gamme->picture;
|
||||
if ($urlPicture) {
|
||||
|
|
@ -126,7 +127,7 @@ class Gamme extends Model
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRgbaColorAttribute()
|
||||
protected function getRgbaColorAttribute()
|
||||
{
|
||||
$color = $this->color;
|
||||
|
||||
|
|
@ -136,7 +137,7 @@ class Gamme extends Model
|
|||
if ($color[0] == '#') {
|
||||
$color = substr($color, 1);
|
||||
}
|
||||
list($r, $g, $b) = array_map("hexdec", str_split($color, (strlen($color) / 3)));
|
||||
[$r, $g, $b] = array_map(hexdec(...), str_split($color, (strlen($color) / 3)));
|
||||
|
||||
return "rgba($r,$g,$b,1)";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class Moment extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -56,19 +57,19 @@ class Moment extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Moment $moment) {
|
||||
static::creating(function (Moment $moment): void {
|
||||
if (is_a($moment->picture, "SplFileInfo")) {
|
||||
$moment->picture = Utils::storeImage($moment->picture, $moment->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Moment $moment) {
|
||||
static::updating(function (Moment $moment): void {
|
||||
if (is_a($moment->picture, "SplFileInfo")) {
|
||||
$moment->picture = Utils::storeImage($moment->picture, $moment->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Moment $moment) {
|
||||
static::deleted(function (Moment $moment): void {
|
||||
if ($moment->picture) {
|
||||
$urlPicture = public_path() . $moment->picture;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ class Picto extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'picture',
|
||||
'alt_text_picture',
|
||||
|
|
@ -52,19 +53,19 @@ class Picto extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Picto $picto) {
|
||||
static::creating(function (Picto $picto): void {
|
||||
if (is_a($picto->picture, "SplFileInfo")) {
|
||||
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Picto $picto) {
|
||||
static::updating(function (Picto $picto): void {
|
||||
if (is_a($picto->picture, "SplFileInfo")) {
|
||||
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Picto $picto) {
|
||||
static::deleted(function (Picto $picto): void {
|
||||
if ($picto->picture) {
|
||||
$urlPicture = public_path() . $picto->picture;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class PictoBrand extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'picture',
|
||||
|
|
@ -44,19 +45,19 @@ class PictoBrand extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (PictoBrand $pictoBrand) {
|
||||
static::creating(function (PictoBrand $pictoBrand): void {
|
||||
if (is_a($pictoBrand->picture, "SplFileInfo")) {
|
||||
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (PictoBrand $pictoBrand) {
|
||||
static::updating(function (PictoBrand $pictoBrand): void {
|
||||
if (is_a($pictoBrand->picture, "SplFileInfo")) {
|
||||
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (PictoBrand $pictoBrand) {
|
||||
static::deleted(function (PictoBrand $pictoBrand): void {
|
||||
if ($pictoBrand->picture) {
|
||||
$urlPicture = public_path() . $pictoBrand->picture;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Post extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $casts = [
|
||||
'date_start' => 'datetime',
|
||||
'date_end' => 'datetime',
|
||||
|
|
@ -28,6 +29,7 @@ class Post extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -62,7 +64,7 @@ class Post extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Post $post) {
|
||||
static::creating(function (Post $post): void {
|
||||
if (is_a($post->picture_home, "SplFileInfo")) {
|
||||
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
|
||||
}
|
||||
|
|
@ -71,7 +73,7 @@ class Post extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (Post $post) {
|
||||
static::updating(function (Post $post): void {
|
||||
if (is_a($post->picture_home, "SplFileInfo")) {
|
||||
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
|
||||
}
|
||||
|
|
@ -80,7 +82,7 @@ class Post extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Post $post) {
|
||||
static::deleted(function (Post $post): void {
|
||||
if ($post->picture_home) {
|
||||
$urlPicture = public_path() . $post->picture_home;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Product extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'gamme_id',
|
||||
'name',
|
||||
|
|
@ -60,19 +61,19 @@ class Product extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Product $product) {
|
||||
static::creating(function (Product $product): void {
|
||||
if (is_a($product->picture, "SplFileInfo")) {
|
||||
$product->picture = Utils::storeImage($product->picture, $product->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Product $product) {
|
||||
static::updating(function (Product $product): void {
|
||||
if (is_a($product->picture, "SplFileInfo")) {
|
||||
$product->picture = Utils::storeImage($product->picture, $product->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Product $product) {
|
||||
static::deleted(function (Product $product): void {
|
||||
if ($product->picture) {
|
||||
$urlPicture = public_path() . $product->picture;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class SeoDatum extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'description',
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ class Slide extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $casts = [
|
||||
'date_start' => 'datetime',
|
||||
'date_end' => 'datetime',
|
||||
|
|
@ -28,6 +29,7 @@ class Slide extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -62,19 +64,19 @@ class Slide extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (Slide $slide) {
|
||||
static::creating(function (Slide $slide): void {
|
||||
if (is_a($slide->picture, "SplFileInfo")) {
|
||||
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (Slide $slide) {
|
||||
static::updating(function (Slide $slide): void {
|
||||
if (is_a($slide->picture, "SplFileInfo")) {
|
||||
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::deleted(function (Slide $slide) {
|
||||
static::deleted(function (Slide $slide): void {
|
||||
if ($slide->picture) {
|
||||
$urlPicture = public_path() . $slide->picture;
|
||||
if ($urlPicture) {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class Slider extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'label',
|
||||
'slug',
|
||||
|
|
@ -52,12 +53,12 @@ class Slider extends Model
|
|||
*/
|
||||
public function showableSlides()
|
||||
{
|
||||
$now = Carbon::now();
|
||||
$now = \Illuminate\Support\Facades\Date::now();
|
||||
return $this->hasMany(Slide::class, 'slider_id')
|
||||
->orderBy('order', 'ASC')->where(function ($q) use ($now) {
|
||||
->orderBy('order', 'ASC')->where(function (\Illuminate\Contracts\Database\Query\Builder $q) use ($now): void {
|
||||
$q->whereDate('date_start', '<=', $now)
|
||||
->orWhereNull('date_start');
|
||||
})->where(function ($q) use ($now) {
|
||||
})->where(function (\Illuminate\Contracts\Database\Query\Builder $q) use ($now): void {
|
||||
$q->whereDate('date_end', '>=', $now)
|
||||
->orWhereNull('date_end');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class Text extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class Title extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ class User extends Authenticatable
|
|||
*
|
||||
* @var string[]
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
|
|
@ -40,6 +41,7 @@ class User extends Authenticatable
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
|
|
@ -50,6 +52,7 @@ class User extends Authenticatable
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
|
@ -61,13 +64,13 @@ class User extends Authenticatable
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (User $user) {
|
||||
static::creating(function (User $user): void {
|
||||
if (Hash::needsRehash($user->password)) {
|
||||
$user->password = Hash::make($user->password);
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (User $user) {
|
||||
static::updating(function (User $user): void {
|
||||
if (Hash::needsRehash($user->password)) {
|
||||
$user->password = Hash::make($user->password);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $policies = [];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->routes(function () {
|
||||
$this->routes(function (): void {
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(base_path('routes/web.php'));
|
||||
|
|
@ -37,7 +37,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||
$vars = $this->getRouteBinderVars($value);
|
||||
\extract($vars);
|
||||
/** @var \App\Models\Gamme */
|
||||
$gamme = Gamme::where(function (Builder $q) use ($locale, $defaultLocale, $value) {
|
||||
$gamme = Gamme::where(function (Builder $q) use ($locale, $defaultLocale, $value): void {
|
||||
$q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'")
|
||||
->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'");
|
||||
})->firstOrFail();
|
||||
|
|
@ -52,7 +52,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||
$vars = $this->getRouteBinderVars($value);
|
||||
\extract($vars);
|
||||
/** @var \App\Models\Product */
|
||||
$product = Product::where(function (Builder $q) use ($locale, $defaultLocale, $value) {
|
||||
$product = Product::where(function (Builder $q) use ($locale, $defaultLocale, $value): void {
|
||||
$q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'")
|
||||
->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'");
|
||||
})->where('gamme_id', $gamme->id)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
$app = new Illuminate\Foundation\Application(
|
||||
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||
\Illuminate\Support\Env::get('APP_BASE_PATH', dirname(__DIR__))
|
||||
);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -8,28 +8,30 @@
|
|||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"php": "^8.5",
|
||||
"dxw/cidr": "^4.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"joedixon/laravel-translation": "^1.1",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"kwaadpepper/refresh-sitemap": "^1.0",
|
||||
"laravel/framework": "^8.65",
|
||||
"laravel/tinker": "^2.5",
|
||||
"laravel/ui": "^3.3",
|
||||
"ldc/web-admin-secure-laravel": "^1.0",
|
||||
"laravel/framework": "^13.0",
|
||||
"laravel/tinker": "^3.0",
|
||||
"laravel/ui": "^4.0",
|
||||
"mews/purifier": "^3.3",
|
||||
"sentry/sentry-laravel": "^4.1",
|
||||
"spatie/laravel-translatable": "^4.6"
|
||||
"spatie/laravel-translatable": "^6.0",
|
||||
"uwil/laravel-k8s": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^2.5",
|
||||
"driftingly/rector-laravel": "^2.5",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^5.10",
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
"slevomat/coding-standard": "^7.0"
|
||||
"nunomaduro/collision": "^8.1",
|
||||
"phpunit/phpunit": "^12.0",
|
||||
"rector/rector": "^2.8",
|
||||
"slevomat/coding-standard": "^8.31",
|
||||
"spatie/laravel-ignition": "^2.0",
|
||||
"squizlabs/php_codesniffer": "^4.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
|
@ -72,9 +74,20 @@
|
|||
},
|
||||
"gitlab-domains": [
|
||||
"lab.s-web.fr"
|
||||
]
|
||||
],
|
||||
"policy": {
|
||||
"advisories": {
|
||||
"ignore": {
|
||||
"laravel/framework": {
|
||||
"constraint": "^10.0",
|
||||
"on-audit": false,
|
||||
"reason": "Palier temporaire de migration vers une version Laravel maintenue. Ne pas deployer."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"repositories": {
|
||||
"lab.s-web.fr": {
|
||||
|
|
|
|||
7361
composer.lock
generated
7361
composer.lock
generated
File diff suppressed because it is too large
Load diff
6
config/admin-secure.php
Normal file
6
config/admin-secure.php
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'cidrList' => env('UWIL_ADMIN_SECURE_CIDR_LIST'),
|
||||
'cidrProjectAllowedList' => env('UWIL_ADMIN_SECURE_CIDR_PROJECT_ALLOWED_LIST')
|
||||
];
|
||||
|
|
@ -177,7 +177,6 @@ return [
|
|||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
|
||||
App\Providers\AppServiceProvider::class,
|
||||
App\Providers\AuthServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ return [
|
|||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
\Pdo\Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DRIVER', 'local'),
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'analyticsKey' => env('ANALYTICS_GOOGLE_ID')
|
||||
];
|
||||
|
|
@ -17,7 +17,7 @@ return [
|
|||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
'default' => env('LOG_CHANNEL', 'k8s'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Gamme;
|
||||
use App\Models\Product;
|
||||
use Spatie\Sitemap\Tags\Url;
|
||||
|
||||
return [
|
||||
|
||||
/**
|
||||
* A list of url to ignore
|
||||
* These are hard coded
|
||||
* Each url does not have to be exhaustive
|
||||
*
|
||||
* For example, if you want to ignore all routes
|
||||
* of the backoffice group
|
||||
* just add '/backoffice' into this table
|
||||
*/
|
||||
'ignoreRoutes' => [
|
||||
'/bo'
|
||||
],
|
||||
|
||||
/**
|
||||
* This table is needed to resolve models matching
|
||||
* routes
|
||||
*
|
||||
* it has to be filled like following
|
||||
*
|
||||
* 'products.meat-type' => [
|
||||
* 'slugMeatType' => [MeatTypes::class, 'slug']
|
||||
* ],
|
||||
* 'kitchen-side.health-nutrition.balanced-menu.menu' => [
|
||||
* 'type' => [BalancedMenuType::class, 'type']
|
||||
* ]
|
||||
*
|
||||
* The index is the complete route name, the array content is an array
|
||||
* within index is the argument name with its model class.
|
||||
* This will allow the generator to generate a route for each of the models
|
||||
* in this table
|
||||
*/
|
||||
'routesBinder' => [
|
||||
'gammes.show' => [
|
||||
'gammeSlug' => [Gamme::class, 'slug'],
|
||||
],
|
||||
'product.show' => [
|
||||
'gammeSlug' => [Gamme::class, 'slug'],
|
||||
'productSlug' => [Product::class, 'slug']
|
||||
]
|
||||
],
|
||||
|
||||
/**
|
||||
* You can put route conditions here
|
||||
* These will be used to decide whether the route should appear
|
||||
* in the sitemap or not
|
||||
*
|
||||
* These are called in Eloquent where
|
||||
*
|
||||
* example
|
||||
*
|
||||
* 'queryConditions' => [
|
||||
* 'status' => true,
|
||||
* 'ocbStatus' => EleveurOcbStatus::yes()->value,
|
||||
* 'star_moment' => true
|
||||
* ]
|
||||
*
|
||||
*/
|
||||
'queryConditions' => [],
|
||||
|
||||
/**
|
||||
* The default route frequency to use with sitemap generator
|
||||
*/
|
||||
'routeDefaultFrequency' => Url::CHANGE_FREQUENCY_DAILY,
|
||||
|
||||
/**
|
||||
* The default route priority to use with sitemap generator
|
||||
*
|
||||
* priority should be a number between 0 and 1
|
||||
* https://www.sitemaps.org/protocol.html
|
||||
*/
|
||||
'routeDefaultPriority' => 0.5,
|
||||
|
||||
/**
|
||||
* Frequencies for routes
|
||||
* use the full or partial route name as index
|
||||
* and a frequency within \Spatie\Sitemap\Tags\Url constants
|
||||
*/
|
||||
'routeFrequencies' => [],
|
||||
|
||||
/**
|
||||
* Priorities for routes
|
||||
* use the full or partial route name as index
|
||||
* and a priority number between 0 and 1
|
||||
*/
|
||||
'routePriorities' => [],
|
||||
|
||||
/**
|
||||
* Enable or disable schedule for the job
|
||||
* If set to true the sitemap generator will be run
|
||||
* using the 'cron' instruction
|
||||
*/
|
||||
'schedule' => false,
|
||||
|
||||
/**
|
||||
* If you want to set specific
|
||||
* instruction for when to schedule job
|
||||
* you can set this with a cron instruction
|
||||
* You can generate one using https://crontab.guru/
|
||||
* https://laravel.com/docs/8.x/scheduling#schedule-frequency-options
|
||||
*
|
||||
* schedule must be set to true
|
||||
*
|
||||
* Default is every day at 15:45
|
||||
*/
|
||||
'cron' => '45 15 * * *'
|
||||
];
|
||||
|
|
@ -57,5 +57,5 @@ return [
|
|||
// @see: https://docs.sentry.io/platforms/php/guides/laravel/configuration/options/#traces-sample-rate.
|
||||
'traces_sample_rate' => env('SENTRY_TRACES_SAMPLE_RATE') === null ? null : (float)env('SENTRY_TRACES_SAMPLE_RATE'),
|
||||
|
||||
'before_send' => [\App\Lib\Helpers\ExceptionsHelper::class, 'sentryEventHandler'],
|
||||
'before_send' => \App\Lib\Helpers\ExceptionsHelper::sentryEventHandler(...),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -38,4 +38,7 @@ return [
|
|||
]
|
||||
],
|
||||
|
||||
'matomo' => [
|
||||
'site_id' => env('MATOMO_SITE_ID')
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class AdviceFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Advice::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class EncartFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Encart::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class GammeFactory extends Factory
|
|||
*/
|
||||
public function definition()
|
||||
{
|
||||
$title = $this->faker->text(10) . rand(1, 100);
|
||||
$title = $this->faker->text(10) . random_int(1, 100);
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/cookrange.jpg'));
|
||||
$picture = new Gamme();
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class MomentFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Moment::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class PictoBrandFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = PictoBrand::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class PictoFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Picto::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ class PostFactory extends Factory
|
|||
'alt_text_picture_home' => $this->faker->sentence(10),
|
||||
'picture_news' => $imgnewspath,
|
||||
'alt_text_picture_news' => $this->faker->sentence(10),
|
||||
'date_start' => Carbon::now(),
|
||||
'date_end' => Carbon::now()->addDays(2),
|
||||
'date_start' => \Illuminate\Support\Facades\Date::now(),
|
||||
'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2),
|
||||
'on_top' => true
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,94 +17,94 @@ class ProductFactory extends Factory
|
|||
*/
|
||||
public function definition()
|
||||
{
|
||||
$name = $this->faker->text(10) . rand(1, 100);
|
||||
$tabFour = array(
|
||||
$name = $this->faker->text(10) . random_int(1, 100);
|
||||
$tabFour = [
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/four.png',
|
||||
'time' => '1h30mins.',
|
||||
'temp' => '200°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
];
|
||||
$tabFriteuse = [
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/friteuse.png',
|
||||
'time' => '15 minutes',
|
||||
'temp' => '100°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabPoele = array(
|
||||
];
|
||||
$tabPoele = [
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/poele.png',
|
||||
'time' => '5 minutes sur chaque face',
|
||||
'temp' => '100°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
];
|
||||
$tabCocotte = [
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/cocotte.png',
|
||||
'time' => '3 h',
|
||||
'temp' => '80°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabPlancha = array(
|
||||
];
|
||||
$tabPlancha = [
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/plancha.png',
|
||||
'time' => '20mins',
|
||||
'temp' => '130°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabBainMarie = array(
|
||||
];
|
||||
$tabBainMarie = [
|
||||
'id' => 5,
|
||||
'name' => 'Bain Marie',
|
||||
'url' => '/assets/images/bainmarie.png',
|
||||
'time' => '30 mins à 45 mins',
|
||||
'temp' => '80°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabBarbecue = array(
|
||||
];
|
||||
$tabBarbecue = [
|
||||
'id' => 6,
|
||||
'name' => 'Barbecue',
|
||||
'url' => '/assets/images/barbecue.png',
|
||||
'time' => '30 minutes',
|
||||
'temp' => '200°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabMicroOndes = array(
|
||||
];
|
||||
$tabMicroOndes = [
|
||||
'id' => 7,
|
||||
'name' => 'Micro Ondes',
|
||||
'url' => '/assets/images/microondes.png',
|
||||
'time' => '3mins',
|
||||
'temp' => '900 Watts',
|
||||
'status' => false
|
||||
);
|
||||
$tabCasserole = array(
|
||||
];
|
||||
$tabCasserole = [
|
||||
'id' => 8,
|
||||
'name' => 'Casserole',
|
||||
'url' => '/assets/images/casserole.png',
|
||||
'time' => '10mins',
|
||||
'temp' => '90°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlusProduit1 = array(
|
||||
];
|
||||
$tabPlusProduit1 = [
|
||||
'id' => 0,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '/assets/images/sans-label.jpg',
|
||||
);
|
||||
$tabPlusProduit2 = array(
|
||||
];
|
||||
$tabPlusProduit2 = [
|
||||
'id' => 1,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '/assets/images/sans-label.jpg',
|
||||
);
|
||||
$tabPlusProduit3 = array(
|
||||
];
|
||||
$tabPlusProduit3 = [
|
||||
'id' => 2,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '/assets/images/sans-label.jpg',
|
||||
);
|
||||
];
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/product_sample_01.png'));
|
||||
$picture = new Product();
|
||||
|
|
@ -129,10 +129,10 @@ class ProductFactory extends Factory
|
|||
]),
|
||||
'plusproduit' => json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]),
|
||||
'is_published' => true,
|
||||
'is_on_top' => rand(true, false),
|
||||
'is_news' => rand(true, false),
|
||||
'is_food_service' => rand(true, false),
|
||||
'is_halal' => rand(true, false),
|
||||
'is_on_top' => random_int(true, false),
|
||||
'is_news' => random_int(true, false),
|
||||
'is_food_service' => random_int(true, false),
|
||||
'is_halal' => random_int(true, false),
|
||||
'seo_title' => $this->faker->text(5),
|
||||
'seo_description' => $this->faker->sentence(20),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class SlideFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Slide::class;
|
||||
|
||||
/**
|
||||
|
|
@ -33,10 +34,10 @@ class SlideFactory extends Factory
|
|||
'title' => $this->faker->unique()->word(),
|
||||
'text' => $this->faker->realText(25),
|
||||
'link_label' => $this->faker->text(128),
|
||||
'link' => route('wasup'),
|
||||
'link_new_tab' => rand(0, 1),
|
||||
'date_start' => Carbon::now(),
|
||||
'date_end' => Carbon::now()->addDays(2),
|
||||
'link' => 'route(\'wasup\')',
|
||||
'link_new_tab' => random_int(0, 1),
|
||||
'date_start' => \Illuminate\Support\Facades\Date::now(),
|
||||
'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2),
|
||||
'picture' => $imgpath,
|
||||
'alt_text_picture' => $this->faker->sentence(10),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class SliderFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Slider::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class TextFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Text::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class TitleFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = Title::class;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class UserFactory extends Factory
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $model = User::class;
|
||||
|
||||
/**
|
||||
|
|
@ -40,10 +41,8 @@ class UserFactory extends Factory
|
|||
public function unverified()
|
||||
{
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
|
||||
return $this->state(function (array $attributes) {
|
||||
return [
|
||||
'email_verified_at' => null,
|
||||
];
|
||||
});
|
||||
return $this->state(fn(array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateUsersTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
Schema::create('users', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->smallInteger('role');
|
||||
$table->string('name');
|
||||
|
|
@ -23,7 +23,6 @@ class CreateUsersTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -33,4 +32,4 @@ class CreateUsersTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePasswordResetsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,13 +13,12 @@ class CreatePasswordResetsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
Schema::create('password_resets', function (Blueprint $table): void {
|
||||
$table->string('email')->index();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -29,4 +28,4 @@ class CreatePasswordResetsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateFailedJobsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
Schema::create('failed_jobs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
|
|
@ -23,7 +23,6 @@ class CreateFailedJobsTable extends Migration
|
|||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -33,4 +32,4 @@ class CreateFailedJobsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateEncartsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateEncartsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('encarts', function (Blueprint $table) {
|
||||
Schema::create('encarts', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->smallInteger('page');
|
||||
$table->text('title');
|
||||
|
|
@ -24,7 +24,6 @@ class CreateEncartsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -34,4 +33,4 @@ class CreateEncartsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('encarts');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSlidersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateSlidersTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('sliders', function (Blueprint $table) {
|
||||
Schema::create('sliders', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('label');
|
||||
$table->string('slug')->unique();
|
||||
|
|
@ -22,7 +22,6 @@ class CreateSlidersTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -32,4 +31,4 @@ class CreateSlidersTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('sliders');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSlidesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateSlidesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('slides', function (Blueprint $table) {
|
||||
Schema::create('slides', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('slider_id')->default(1)->constrained('sliders');
|
||||
|
||||
|
|
@ -32,7 +32,6 @@ class CreateSlidesTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -42,4 +41,4 @@ class CreateSlidesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('slides');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePictosTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreatePictosTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pictos', function (Blueprint $table) {
|
||||
Schema::create('pictos', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->smallInteger('page');
|
||||
$table->text('picture')->nullable();
|
||||
|
|
@ -22,7 +22,6 @@ class CreatePictosTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -32,4 +31,4 @@ class CreatePictosTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('pictos');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePictoBrandsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreatePictoBrandsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('picto_brands', function (Blueprint $table) {
|
||||
Schema::create('picto_brands', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('title');
|
||||
$table->text('picture')->nullable();
|
||||
|
|
@ -22,7 +22,6 @@ class CreatePictoBrandsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -32,4 +31,4 @@ class CreatePictoBrandsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('picto_brands');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTitlesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateTitlesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('titles', function (Blueprint $table) {
|
||||
Schema::create('titles', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->smallInteger('page')->unique();
|
||||
$table->text('title');
|
||||
|
|
@ -21,7 +21,6 @@ class CreateTitlesTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -31,4 +30,4 @@ class CreateTitlesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('titles');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTextsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateTextsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('texts', function (Blueprint $table) {
|
||||
Schema::create('texts', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->smallInteger('page');
|
||||
$table->text('title');
|
||||
|
|
@ -21,7 +21,6 @@ class CreateTextsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -31,4 +30,4 @@ class CreateTextsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('texts');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAdviceTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateAdviceTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('advice', function (Blueprint $table) {
|
||||
Schema::create('advice', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('title1');
|
||||
$table->text('title2');
|
||||
|
|
@ -28,7 +28,6 @@ class CreateAdviceTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -38,4 +37,4 @@ class CreateAdviceTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('advice');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreatePostsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreatePostsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('posts', function (Blueprint $table) {
|
||||
Schema::create('posts', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('title');
|
||||
$table->mediumText('text');
|
||||
|
|
@ -27,7 +27,6 @@ class CreatePostsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -37,4 +36,4 @@ class CreatePostsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('posts');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateGammesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateGammesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('gammes', function (Blueprint $table) {
|
||||
Schema::create('gammes', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('parent_gamme_id')->nullable();
|
||||
$table->text('title');
|
||||
|
|
@ -27,7 +27,6 @@ class CreateGammesTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -37,4 +36,4 @@ class CreateGammesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('gammes');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateProductsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateProductsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('products', function (Blueprint $table) {
|
||||
Schema::create('products', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('gamme_id')->nullable();
|
||||
$table->text('name');
|
||||
|
|
@ -32,7 +32,6 @@ class CreateProductsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -42,4 +41,4 @@ class CreateProductsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue