Compare commits
47 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7045e1c7e4 | ||
|
|
4ff27773ba | ||
|
|
cdeb3f3d54 | ||
|
|
1f00088ea1 | ||
|
|
e0e508fdec | ||
|
|
d670922170 | ||
|
|
c49c0c89e3 | ||
|
|
5f87028bff | ||
|
|
d8faf11749 | ||
|
|
62889856ca | ||
|
|
552232c83d | ||
|
|
7aff38e8a1 | ||
|
|
554c743e6c | ||
|
|
0fa4995c0d | ||
|
|
4b125e8368 | ||
|
|
61624b888d | ||
|
|
e2b03d4648 | ||
|
|
693593cd95 | ||
|
|
01b5d6c544 | ||
|
|
d63cbf50aa | ||
|
|
4880f10777 | ||
|
|
34bd0e6895 | ||
|
|
d6e0065159 | ||
|
|
f0bfb57e8d | ||
|
|
cb4d496303 | ||
|
|
60006a383e | ||
|
|
c7a7658244 | ||
|
|
4d34bade3c | ||
|
|
8729f456f9 | ||
|
|
0ffc67a99c | ||
|
|
ef7fabda83 | ||
|
|
d7f5f6a6de | ||
|
|
77b3b6cbfe | ||
|
|
ad4d504b92 | ||
|
|
7c79c8d2e4 | ||
|
|
cfa966e400 | ||
|
|
f50306d885 | ||
|
|
3f75c0acfb | ||
|
|
bb0c3c22b2 | ||
|
|
a73734d053 | ||
|
|
f4022a7117 | ||
|
|
fe47655ee9 | ||
|
|
b0f7179c63 | ||
|
|
c983f142cb | ||
|
|
b39b7ac5a6 | ||
|
|
963d1a7e95 | ||
|
|
c0b725623b |
174 changed files with 5774 additions and 5809 deletions
13
.env.example
13
.env.example
|
|
@ -25,8 +25,17 @@ MAIL_LIST_CONTACTFORM=
|
|||
# Matomo
|
||||
MATOMO_SITE_ID=
|
||||
|
||||
## LDCWEB ADMIN SECURE
|
||||
LDC_WEB_API_KEY=
|
||||
# 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=""
|
||||
|
||||
|
||||
# Sentry
|
||||
SENTRY_LARAVEL_DSN=
|
||||
|
|
|
|||
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -1,6 +1,6 @@
|
|||
/public/build
|
||||
/public/storage
|
||||
/public/sitemap.xml
|
||||
# /public/sitemap.xml
|
||||
/storage/app/public/*.*
|
||||
node_modules
|
||||
/vendor
|
||||
|
|
@ -8,3 +8,8 @@ node_modules
|
|||
auth.json
|
||||
.vscode
|
||||
.npmrc
|
||||
.viminfo
|
||||
.zshrc
|
||||
.composer
|
||||
.config
|
||||
.npm
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
include:
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "lint/lint7.3.yml"
|
||||
file: "lint/lint.yml"
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "security/security7.3.yml"
|
||||
file: "security/security.yml"
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "build/build7.3.yml"
|
||||
file: "build/build.yml"
|
||||
- project: "ldc-web/shared-ci"
|
||||
ref: "main"
|
||||
file: "test/test.yml"
|
||||
|
|
|
|||
14
.vscode/settings.json
vendored
14
.vscode/settings.json
vendored
|
|
@ -12,12 +12,22 @@
|
|||
"statusBar.background": "#273c4e",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#385670",
|
||||
"statusBarItem.remoteBackground": "#273c4e",
|
||||
"statusBarItem.remoteBackground": "#aa5583",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#273c4e",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#273c4e99",
|
||||
"titleBar.inactiveForeground": "#e7e7e799"
|
||||
"titleBar.inactiveForeground": "#e7e7e799",
|
||||
"activityBar.activeBorder": "#e7e7e7",
|
||||
"activityBarTop.activeBackground": "#385670",
|
||||
"activityBarTop.activeBorder": "#e7e7e7",
|
||||
"activityBarTop.background": "#385670",
|
||||
"activityBarTop.foreground": "#e7e7e7",
|
||||
"activityBarTop.inactiveForeground": "#e7e7e799",
|
||||
"commandCenter.foreground": "#e7e7e7",
|
||||
"statusBar.debuggingBackground": "#273c4e",
|
||||
"statusBar.debuggingForeground": "#e7e7e7",
|
||||
"statusBar.inactiveBackground": "#273c4e"
|
||||
},
|
||||
"peacock.remoteColor": "#273c4e"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
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
|
||||
USER www-data
|
||||
USER www-data
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class CreateAdmin extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $signature = 'user:create';
|
||||
|
||||
/**
|
||||
|
|
@ -24,6 +25,7 @@ class CreateAdmin extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
#[\Override]
|
||||
protected $description = 'Create a backend admin user';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -79,10 +79,10 @@ final class Category extends BaseEnum
|
|||
public function __get(string $attribute)
|
||||
{
|
||||
if ($attribute === 'icon') {
|
||||
return $this->icon()[$this->getDefinition()] ?? null;
|
||||
return self::icon()[$this->getDefinition()] ?? null;
|
||||
}
|
||||
if ($attribute === 'color') {
|
||||
return $this->color()[$this->getDefinition()] ?? null;
|
||||
return self::color()[$this->getDefinition()] ?? null;
|
||||
}
|
||||
return parent::__get($attribute);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class Handler extends ExceptionHandler
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $dontReport = [];
|
||||
|
||||
/**
|
||||
|
|
@ -19,9 +20,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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class CharteController extends Controller
|
|||
$charte->fill($request->validated());
|
||||
|
||||
if ($charte->saveOrFail()) {
|
||||
return redirect()->route('bo.charte.edit', $charte->slug)
|
||||
return to_route('bo.charte.edit', $charte->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.charte.edit', $charte->slug)
|
||||
return to_route('bo.charte.edit', $charte->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class ContactController extends Controller
|
|||
$contact->fill($request->validated());
|
||||
|
||||
if ($contact->saveOrFail()) {
|
||||
return redirect()->route('bo.contact.edit', $contact->slug)
|
||||
return to_route('bo.contact.edit', $contact->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.contact.edit', $contact->slug)
|
||||
return to_route('bo.contact.edit', $contact->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class FaqBannersController extends Controller
|
|||
$faqbanner->fill($request->validated());
|
||||
|
||||
if (!$faqbanner->saveOrFail()) {
|
||||
return redirect()->route('bo.faqbanners.edit', $faqbanner->slug)
|
||||
return to_route('bo.faqbanners.edit', $faqbanner->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.faqbanners.edit', $faqbanner->slug)
|
||||
return to_route('bo.faqbanners.edit', $faqbanner->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class FaqsController extends Controller
|
|||
$faq->order = $this->getLastOrder();
|
||||
|
||||
if ($faq->saveOrFail()) {
|
||||
return redirect()->route('bo.faqs.edit', $faq->id)->with('success', trans(__('Creation_saved')));
|
||||
return to_route('bo.faqs.edit', $faq->id)->with('success', trans(__('Creation_saved')));
|
||||
}
|
||||
|
||||
return back()->with('error', trans(__('Creation_failed')));
|
||||
|
|
@ -79,10 +79,10 @@ class FaqsController extends Controller
|
|||
$faq->fill($request->validated());
|
||||
|
||||
if ($faq->saveOrFail()) {
|
||||
return redirect()->route('bo.faqs.edit', $faq->id)->with('success', trans(__('Changes_saved')));
|
||||
return to_route('bo.faqs.edit', $faq->id)->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.faqs.edit', $faq->id)->with('error', trans(__('Changes_failed')));
|
||||
return to_route('bo.faqs.edit', $faq->id)->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -95,10 +95,10 @@ class FaqsController extends Controller
|
|||
public function destroy(Faq $faq): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($faq->deleteOrFail()) {
|
||||
return redirect()->route('bo.faqs.index')->with('success', trans(__('Delete_saved')));
|
||||
return to_route('bo.faqs.index')->with('success', trans(__('Delete_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.faqs.index')->with('error', trans(__('Delete_failed')));
|
||||
return to_route('bo.faqs.index')->with('error', trans(__('Delete_failed')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -121,7 +121,7 @@ class FaqsController extends Controller
|
|||
$tmp->order = $faq->order;
|
||||
$faq->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.faq.index');
|
||||
return to_route('bo.faq.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$faq->save();
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class GammeBannersController extends Controller
|
|||
$gammebanner->fill($request->validated());
|
||||
|
||||
if ($gammebanner->saveOrFail()) {
|
||||
return redirect()->route('bo.gammebanners.edit', $gammebanner->slug)
|
||||
return to_route('bo.gammebanners.edit', $gammebanner->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.gammebanners.edit', $gammebanner->slug)
|
||||
return to_route('bo.gammebanners.edit', $gammebanner->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class GammeHooksController extends Controller
|
|||
$gammehook->fill($request->validated());
|
||||
|
||||
if ($gammehook->saveOrFail()) {
|
||||
return redirect()->route('bo.gammehooks.edit', $gammehook->slug)
|
||||
return to_route('bo.gammehooks.edit', $gammehook->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.gammehooks.edit', $gammehook->slug)
|
||||
return to_route('bo.gammehooks.edit', $gammehook->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class GammesController extends Controller
|
|||
foreach ($dbGammes as $gamme) {
|
||||
$gammes->push($gamme);
|
||||
$gamme->childGammes->sortBy('order')
|
||||
->map(function (Gamme $childGamme) use (&$gammes) {
|
||||
->map(function (Gamme $childGamme) use (&$gammes): void {
|
||||
$gammes->push($childGamme);
|
||||
});
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ class GammesController extends Controller
|
|||
$gamme->category = null;
|
||||
}
|
||||
if ($gamme->saveOrFail()) {
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)->with('success', trans(__('Changes_saved')));
|
||||
return to_route('bo.gammes.edit', $gamme->id)->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
return back()->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
|
|
@ -116,7 +116,7 @@ class GammesController extends Controller
|
|||
$gamme->category = null;
|
||||
}
|
||||
if ($gamme->saveOrFail()) {
|
||||
return redirect()->route('bo.gammes.edit', $gamme->id)
|
||||
return to_route('bo.gammes.edit', $gamme->id)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
return back()->with('error', trans(__('Changes_failed')));
|
||||
|
|
@ -132,7 +132,7 @@ class GammesController extends Controller
|
|||
public function destroy(Gamme $gamme): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($gamme->deleteOrFail()) {
|
||||
return redirect()->route('bo.gammes.index')->with('success', trans(__('Delete_saved')));
|
||||
return to_route('bo.gammes.index')->with('success', trans(__('Delete_saved')));
|
||||
}
|
||||
return back()->with('error', trans(__('Delete_failed')));
|
||||
}
|
||||
|
|
@ -160,7 +160,7 @@ class GammesController extends Controller
|
|||
$tmp->order = $gamme->order;
|
||||
$gamme->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.homepage_slides.index');
|
||||
return to_route('bo.homepage_slides.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$gamme->save();
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ class HomepageHooksController extends Controller
|
|||
$homepagehook->fill($request->validated());
|
||||
|
||||
if ($homepagehook->saveOrFail()) {
|
||||
return redirect()->route('bo.homepagehooks.edit', $homepagehook->slug)
|
||||
return to_route('bo.homepagehooks.edit', $homepagehook->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.homepagehooks.edit', $homepagehook->slug)
|
||||
return to_route('bo.homepagehooks.edit', $homepagehook->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class HomepageNewscastsController extends Controller
|
|||
$homepagenewscast->order = $this->getLastOrder();
|
||||
|
||||
if ($homepagenewscast->saveOrFail()) {
|
||||
return redirect()->route('bo.homepagenewscasts.edit', $homepagenewscast->id)
|
||||
return to_route('bo.homepagenewscasts.edit', $homepagenewscast->id)
|
||||
->with('success', trans(__('Creation_saved')));
|
||||
}
|
||||
return back()->with('error', trans(__('Creation_failed')));
|
||||
|
|
@ -79,11 +79,11 @@ class HomepageNewscastsController extends Controller
|
|||
$homepagenewscast->fill($request->validated());
|
||||
|
||||
if ($homepagenewscast->saveOrFail()) {
|
||||
return redirect()->route('bo.homepagenewscasts.edit', $homepagenewscast->id)
|
||||
return to_route('bo.homepagenewscasts.edit', $homepagenewscast->id)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.homepagenewscasts.edit', $homepagenewscast->id)
|
||||
return to_route('bo.homepagenewscasts.edit', $homepagenewscast->id)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
@ -97,10 +97,10 @@ class HomepageNewscastsController extends Controller
|
|||
public function destroy(HomepageNewscast $homepagenewscast): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($homepagenewscast->deleteOrFail()) {
|
||||
return redirect()->route('bo.homepagenewscasts.index')->with('success', trans(__('Delete_saved')));
|
||||
return to_route('bo.homepagenewscasts.index')->with('success', trans(__('Delete_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.homepagenewscasts.index')->with('error', trans(__('Delete_failed')));
|
||||
return to_route('bo.homepagenewscasts.index')->with('error', trans(__('Delete_failed')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +125,7 @@ class HomepageNewscastsController extends Controller
|
|||
$tmp->order = $homepagenewscast->order;
|
||||
$homepagenewscast->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.homepage_newscasts.index');
|
||||
return to_route('bo.homepage_newscasts.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$homepagenewscast->save();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class HomepageSlidesController extends Controller
|
|||
$homepageslide->picture = ToolboxHelper::storeImage($request->picture, $homepageslide->getTable());
|
||||
|
||||
if ($homepageslide->saveOrFail()) {
|
||||
return redirect()->route('bo.homepageslides.edit', $homepageslide->id)
|
||||
return to_route('bo.homepageslides.edit', $homepageslide->id)
|
||||
->with('success', trans(__('Creation_saved')));
|
||||
}
|
||||
return back()->with('error', trans(__('Creation_failed')));
|
||||
|
|
@ -81,11 +81,11 @@ class HomepageSlidesController extends Controller
|
|||
$homepageslide->fill($request->validated());
|
||||
|
||||
if ($homepageslide->saveOrFail()) {
|
||||
return redirect()->route('bo.homepageslides.edit', $homepageslide->id)
|
||||
return to_route('bo.homepageslides.edit', $homepageslide->id)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.homepageslides.edit', $homepageslide->id)
|
||||
return to_route('bo.homepageslides.edit', $homepageslide->id)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
@ -99,10 +99,10 @@ class HomepageSlidesController extends Controller
|
|||
public function destroy(HomepageSlide $homepageslide): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if (!$homepageslide->delete()) {
|
||||
return redirect()->route('bo.homepageslides.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.homepageslides.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.homepageslides.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.homepageslides.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -128,7 +128,7 @@ class HomepageSlidesController extends Controller
|
|||
$tmp->order = $homepageslide->order;
|
||||
$homepageslide->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.homepage_slides.index');
|
||||
return to_route('bo.homepage_slides.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$homepageslide->save();
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ class HomepageWhoarewesController extends Controller
|
|||
$homepagewhoarewe->fill($request->validated());
|
||||
|
||||
if ($homepagewhoarewe->saveOrFail()) {
|
||||
return redirect()->route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
|
||||
return to_route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
|
||||
return to_route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class MentionController extends Controller
|
|||
$mention->fill($request->validated());
|
||||
|
||||
if ($mention->saveOrFail()) {
|
||||
return redirect()->route('bo.mention.edit', $mention->slug)
|
||||
return to_route('bo.mention.edit', $mention->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.mention.edit', $mention->slug)
|
||||
return to_route('bo.mention.edit', $mention->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,64 +34,64 @@ class ProductsController extends Controller
|
|||
public function create(Product $product): \Illuminate\Contracts\View\View
|
||||
{
|
||||
$gammes = Gamme::all()->sortBy('title');
|
||||
$tabPlusProduit1 = array(
|
||||
$tabPlusProduit1 = [
|
||||
'id' => 0,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit2 = array(
|
||||
];
|
||||
$tabPlusProduit2 = [
|
||||
'id' => 1,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit3 = array(
|
||||
];
|
||||
$tabPlusProduit3 = [
|
||||
'id' => 2,
|
||||
'name' => '',
|
||||
'url' => '',
|
||||
);
|
||||
];
|
||||
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
|
||||
|
||||
|
||||
$tabFour = array(
|
||||
$tabFour = [
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/produits_details/four.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
];
|
||||
$tabFriteuse = [
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/produits_details/friteuse.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPoele = array(
|
||||
];
|
||||
$tabPoele = [
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/produits_details/poele.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
];
|
||||
$tabCocotte = [
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/produits_details/cocotte.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlancha = array(
|
||||
];
|
||||
$tabPlancha = [
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/produits_details/plancha.png',
|
||||
'time' => '',
|
||||
'temp' => '',
|
||||
'status' => false
|
||||
);
|
||||
];
|
||||
|
||||
|
||||
$product->pictos = json_encode([
|
||||
|
|
@ -137,7 +137,7 @@ class ProductsController extends Controller
|
|||
$product->pictos = $request->pictos;
|
||||
|
||||
if ($product->saveOrFail()) {
|
||||
return redirect()->route('bo.products.edit', $product->id)
|
||||
return to_route('bo.products.edit', $product->id)
|
||||
->with('success', trans(__('Creation_saved')));
|
||||
}
|
||||
return back()->with('error', trans(__('Creation_failed')));
|
||||
|
|
@ -194,10 +194,10 @@ class ProductsController extends Controller
|
|||
}
|
||||
$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('success', trans(__('Changes_saved')));
|
||||
}
|
||||
return redirect()->route('bo.products.edit', $product->id)
|
||||
return to_route('bo.products.edit', $product->id)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
@ -211,9 +211,9 @@ class ProductsController extends Controller
|
|||
public function destroy(Product $product): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($product->deleteOrFail()) {
|
||||
return redirect()->route('bo.products.index')->with('success', trans('Delete_saved'));
|
||||
return to_route('bo.products.index')->with('success', trans('Delete_saved'));
|
||||
}
|
||||
return redirect()->route('bo.products.index')->with('error', trans('Delete_failed'));
|
||||
return to_route('bo.products.index')->with('error', trans('Delete_failed'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -239,7 +239,7 @@ class ProductsController extends Controller
|
|||
$tmp->order = $product->order;
|
||||
$product->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.products.index');
|
||||
return to_route('bo.products.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$product->save();
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class WhoareweBannersController extends Controller
|
|||
$whoarewebanner->fill($request->validated());
|
||||
|
||||
if ($whoarewebanner->saveOrFail()) {
|
||||
return redirect()->route('bo.whoarewebanners.edit', $whoarewebanner->slug)
|
||||
return to_route('bo.whoarewebanners.edit', $whoarewebanner->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoarewebanners.edit', $whoarewebanner->slug)
|
||||
return to_route('bo.whoarewebanners.edit', $whoarewebanner->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ class WhoareweBrandDetailsController extends Controller
|
|||
$whoarewebranddetail->fill($request->validated());
|
||||
|
||||
if ($whoarewebranddetail->saveOrFail()) {
|
||||
return redirect()->route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
|
||||
return to_route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
|
||||
return to_route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class WhoareweBrandsController extends Controller
|
|||
$whoarewebrand->order = $this->getLastOrder();
|
||||
|
||||
if ($whoarewebrand->saveOrFail()) {
|
||||
return redirect()->route('bo.whoarewebrands.edit', $whoarewebrand->id)
|
||||
return to_route('bo.whoarewebrands.edit', $whoarewebrand->id)
|
||||
->with('success', trans(_('Creation_saved')));
|
||||
}
|
||||
return back()->with('error', trans(_('Creation_failed')));
|
||||
|
|
@ -79,11 +79,11 @@ class WhoareweBrandsController extends Controller
|
|||
$whoarewebrand->fill($request->validated());
|
||||
|
||||
if ($whoarewebrand->saveOrFail()) {
|
||||
return redirect()->route('bo.whoarewebrands.edit', $whoarewebrand->id)
|
||||
return to_route('bo.whoarewebrands.edit', $whoarewebrand->id)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoarewebrands.edit', $whoarewebrand->id)
|
||||
return to_route('bo.whoarewebrands.edit', $whoarewebrand->id)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
@ -97,10 +97,10 @@ class WhoareweBrandsController extends Controller
|
|||
public function destroy(WhoareweBrand $whoarewebrand): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($whoarewebrand->deleteOrFail()) {
|
||||
return redirect()->route('bo.whoarewebrands.index')->with('success', trans('Suppression faite avec succès'));
|
||||
return to_route('bo.whoarewebrands.index')->with('success', trans('Suppression faite avec succès'));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoarewebrands.index')->with('error', trans('La suppression a échoué'));
|
||||
return to_route('bo.whoarewebrands.index')->with('error', trans('La suppression a échoué'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +125,7 @@ class WhoareweBrandsController extends Controller
|
|||
$tmp->order = $whoarewebrand->order;
|
||||
$whoarewebrand->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.whoarewe_brands.index');
|
||||
return to_route('bo.whoarewe_brands.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$whoarewebrand->save();
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ class WhoareweContactsController extends Controller
|
|||
$whoarewecontact->fill($request->validated());
|
||||
|
||||
if ($whoarewecontact->saveOrFail()) {
|
||||
return redirect()->route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
|
||||
return to_route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
|
||||
return to_route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ class WhoareweDescriptionsController extends Controller
|
|||
$whoarewedescription->fill($request->validated());
|
||||
|
||||
if ($whoarewedescription->saveOrFail()) {
|
||||
return redirect()->route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
|
||||
return to_route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
|
||||
return to_route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@ class WhoareweExpertiseDetailsController extends Controller
|
|||
$whoareweexpertisedetail->fill($request->validated());
|
||||
|
||||
if ($whoareweexpertisedetail->saveOrFail()) {
|
||||
return redirect()->route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
|
||||
return to_route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
|
||||
return to_route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class WhoareweExpertisesController extends Controller
|
|||
$whoareweexpertise->order = $this->getLastOrder();
|
||||
|
||||
if ($whoareweexpertise->saveOrFail()) {
|
||||
return redirect()->route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
|
||||
return to_route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
|
||||
->with('success', trans(__('Creation_saved')));
|
||||
};
|
||||
return back()->with('error', trans(__('Creation_failed')));
|
||||
|
|
@ -80,11 +80,11 @@ class WhoareweExpertisesController extends Controller
|
|||
$whoareweexpertise->fill($request->validated());
|
||||
|
||||
if ($whoareweexpertise->saveOrFail()) {
|
||||
return redirect()->route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
|
||||
return to_route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
|
||||
return to_route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
@ -98,11 +98,11 @@ class WhoareweExpertisesController extends Controller
|
|||
public function destroy(WhoareweExpertise $whoareweexpertise): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($whoareweexpertise->deleteOrFail()) {
|
||||
return redirect()->route('bo.whoareweexpertises.index')
|
||||
return to_route('bo.whoareweexpertises.index')
|
||||
->with('success', trans(__('Delete_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoareweexpertises.index')->with('error', trans(__('Delete_failed')));
|
||||
return to_route('bo.whoareweexpertises.index')->with('error', trans(__('Delete_failed')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -128,7 +128,7 @@ class WhoareweExpertisesController extends Controller
|
|||
$tmp->order = $whoareweexpertise->order;
|
||||
$whoareweexpertise->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.whoarewe_expertises.index');
|
||||
return to_route('bo.whoarewe_expertises.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$whoareweexpertise->save();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class WhoareweIconDetailsController extends Controller
|
|||
$whoareweicondetail->fill($request->validated());
|
||||
|
||||
if ($whoareweicondetail->saveOrFail()) {
|
||||
return redirect()->route('bo.whoareweicondetails.edit', $whoareweicondetail->slug)
|
||||
return to_route('bo.whoareweicondetails.edit', $whoareweicondetail->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class WhoareweIconsController extends Controller
|
|||
$whoareweicon = new WhoareweIcon($request->validated());
|
||||
$whoareweicon->order = $this->getLastOrder();
|
||||
if ($whoareweicon->saveOrFail()) {
|
||||
return redirect()->route('bo.whoareweicons.edit', $whoareweicon->id)
|
||||
return to_route('bo.whoareweicons.edit', $whoareweicon->id)
|
||||
->with('success', trans(__('Creation_saved')));
|
||||
}
|
||||
|
||||
|
|
@ -80,11 +80,11 @@ class WhoareweIconsController extends Controller
|
|||
$whoareweicon->fill($request->validated());
|
||||
|
||||
if ($whoareweicon->saveOrFail()) {
|
||||
return redirect()->route('bo.whoareweicons.edit', $whoareweicon->id)
|
||||
return to_route('bo.whoareweicons.edit', $whoareweicon->id)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoareweicons.edit', $whoareweicon->id)
|
||||
return to_route('bo.whoareweicons.edit', $whoareweicon->id)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
@ -98,10 +98,10 @@ class WhoareweIconsController extends Controller
|
|||
public function destroy(WhoareweIcon $whoareweicon): \Illuminate\Http\RedirectResponse
|
||||
{
|
||||
if ($whoareweicon->deleteOrFail()) {
|
||||
return redirect()->route('bo.whoareweicons.index')->with('success', trans(__('Delete_saved')));
|
||||
return to_route('bo.whoareweicons.index')->with('success', trans(__('Delete_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoareweicons.index')->with('error', trans(__('Delete_failed')));
|
||||
return to_route('bo.whoareweicons.index')->with('error', trans(__('Delete_failed')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -127,7 +127,7 @@ class WhoareweIconsController extends Controller
|
|||
$tmp->order = $whoareweicon->order;
|
||||
$whoareweicon->order = $newOrder;
|
||||
} else {
|
||||
return redirect()->route('bo.whoarewe_icons.index');
|
||||
return to_route('bo.whoarewe_icons.index');
|
||||
}
|
||||
$tmp->save();
|
||||
$whoareweicon->save();
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ class WhoareweKnowsController extends Controller
|
|||
$whoareweknow->fill($request->validated());
|
||||
|
||||
if ($whoareweknow->saveOrFail()) {
|
||||
return redirect()->route('bo.whoareweknows.edit', $whoareweknow->slug)
|
||||
return to_route('bo.whoareweknows.edit', $whoareweknow->slug)
|
||||
->with('success', trans(__('Changes_saved')));
|
||||
}
|
||||
|
||||
return redirect()->route('bo.whoareweknows.edit', $whoareweknow->slug)
|
||||
return to_route('bo.whoareweknows.edit', $whoareweknow->slug)
|
||||
->with('error', trans(__('Changes_failed')));
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class GammesController extends Controller
|
|||
foreach ($dbGammes as $dbGamme) {
|
||||
$gammes->push($dbGamme->id);
|
||||
$dbGamme->childGammes->sortBy('order')
|
||||
->map(function (Gamme $childGamme) use (&$gammes) {
|
||||
->map(function (Gamme $childGamme) use (&$gammes): void {
|
||||
$gammes->push($childGamme->id);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,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,
|
||||
|
|
@ -34,8 +34,9 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Foundation\Http\Middleware\PreventRequestForgery::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\SecureHeaders::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
|
|
@ -51,7 +52,7 @@ class Kernel extends HttpKernel
|
|||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
protected $middlewareAliases = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
|
|
@ -62,5 +63,6 @@ class Kernel extends HttpKernel
|
|||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
'htmlsanitize' => \App\Http\Middleware\HtmlSanitizer::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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
|
|
@ -12,9 +11,11 @@ class Authenticate extends Middleware
|
|||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
* @phpcs:disabled Squiz.Commenting.FunctionComment.TypeHintMissing
|
||||
*/
|
||||
protected function redirectTo(Request $request)
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
// @phpcs:enable
|
||||
if (!$request->expectsJson()) {
|
||||
return route('bo.login');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,5 +11,6 @@ class EncryptCookies extends Middleware
|
|||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $except = [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class HtmlSanitizer
|
|||
$inputs = $request->all();
|
||||
/** @var callable|null */
|
||||
$cleanInput = null;
|
||||
$cleanInput = function (&$input, $name, $rootName = null) use ($params, &$cleanInput) {
|
||||
$cleanInput = function (&$input, $name, $rootName = null) use ($params, &$cleanInput): void {
|
||||
// * Nested element array
|
||||
if (is_array($input)) {
|
||||
array_walk_recursive($input, $cleanInput, $name);
|
||||
|
|
@ -32,7 +32,7 @@ class HtmlSanitizer
|
|||
// ? Is a json input ?
|
||||
if ($isJson = \json_decode($input, true) and is_array($isJson)) {
|
||||
// ! Decode each json field recursive.
|
||||
\array_walk_recursive($isJson, function (&$item) {
|
||||
\array_walk_recursive($isJson, function (&$item): void {
|
||||
if (\is_string($item)) {
|
||||
$item = clean($item);
|
||||
$item = ToolboxHelper::stripCkEditorSchemesOnMediaInputs($item);
|
||||
|
|
|
|||
|
|
@ -11,5 +11,6 @@ class PreventRequestsDuringMaintenance extends Middleware
|
|||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $except = [];
|
||||
}
|
||||
|
|
|
|||
119
app/Http/Middleware/SecureHeaders.php
Normal file
119
app/Http/Middleware/SecureHeaders.php
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\View;
|
||||
|
||||
class SecureHeaders
|
||||
{
|
||||
/**
|
||||
* Enumerate headers which you do not want in your application's responses.
|
||||
* Great starting point would be to go check out @Scott_Helme's:
|
||||
* https://securityheaders.com/
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $unwantedHeaderList = [
|
||||
'X-Powered-By',
|
||||
'Server',
|
||||
];
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): \Symfony\Component\HttpFoundation\Response
|
||||
{
|
||||
// phpcs:enable
|
||||
View::share('nonce', $nonce = \uniqid());
|
||||
// * For VueJS dev tool to execute
|
||||
$jsDev = config('app.debug') ? "'unsafe-eval' 'unsafe-inline'" : "'nonce-{$nonce}' 'strict-dynamic'";
|
||||
$reportUri = Route::has('cspReportUri') ?
|
||||
\sprintf('report-uri %s', \parse_url(route('cspReportUri'), \PHP_URL_PATH)) : '';
|
||||
$this->removeUnwantedHeaders($this->unwantedHeaderList);
|
||||
$response = $next($request);
|
||||
$response->headers->set('Referrer-Policy', 'no-referrer-when-downgrade');
|
||||
$response->headers->set('X-Content-Type-Options', 'nosniff');
|
||||
$response->headers->set('X-XSS-Protection', '1; mode=block');
|
||||
$response->headers->set('X-Frame-Options', 'SAMEORIGIN');
|
||||
$response->headers->set('Strict-Transport-Security', 'max-age=31536000; includeSubDomains;');
|
||||
$cspPolicies = [
|
||||
"default-src 'none';",
|
||||
"manifest-src 'self';",
|
||||
"connect-src " . \implode(' ', [
|
||||
// * VIMEO
|
||||
'https://player.vimeo.com',
|
||||
// * MATOMO
|
||||
'https://yl.s-web.fr',
|
||||
// * RECAPTCHA
|
||||
'https://www.google.com/recaptcha/',
|
||||
'https://recaptcha.google.com/recaptcha/',
|
||||
// * OTHERS
|
||||
'blob:',
|
||||
'\'self\'',
|
||||
]) . ';',
|
||||
'img-src ' . implode(" ", [
|
||||
// * MATOMO
|
||||
'https://yl.s-web.fr',
|
||||
// * OTHERS
|
||||
'*',
|
||||
'blob:',
|
||||
'data:',
|
||||
]) . ';',
|
||||
"frame-src " . implode(" ", [
|
||||
// * VIMEO
|
||||
'https://player.vimeo.com',
|
||||
// * RECAPTCHA
|
||||
'https://www.google.com/recaptcha/',
|
||||
'https://recaptcha.google.com/recaptcha/',
|
||||
'\'self\'',
|
||||
]) . ';',
|
||||
'font-src ' . implode(" ", [
|
||||
// * OTHERS
|
||||
'\'self\'',
|
||||
'data:',
|
||||
]) . ';',
|
||||
'style-src ' . implode(" ", [
|
||||
// * CKEDITOR
|
||||
'\'unsafe-inline\'',
|
||||
// * OTHERS
|
||||
'\'self\'',
|
||||
]) . ';',
|
||||
'script-src ' . implode(" ", [
|
||||
// * MATOMO
|
||||
'https://yl.s-web.fr',
|
||||
// * RECAPTCHA
|
||||
'https://www.google.com/recaptcha/',
|
||||
'https://www.gstatic.com/recaptcha/',
|
||||
// * OTHERS
|
||||
'\'self\'',
|
||||
'\'unsafe-eval\'',
|
||||
]) . ' ' . $jsDev . ';'
|
||||
];
|
||||
$response->headers->set(
|
||||
'Content-Security-Policy',
|
||||
implode(' ', $cspPolicies) . $reportUri
|
||||
);
|
||||
$response->headers->set('Feature-Policy', 'fullscreen \'self\';');
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove unwanted headers.
|
||||
*
|
||||
* @param array $headerList
|
||||
* @return void
|
||||
*/
|
||||
private function removeUnwantedHeaders(array $headerList): void
|
||||
{
|
||||
foreach ($headerList as $header) {
|
||||
header_remove($header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ class TrimStrings extends Middleware
|
|||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ class TrustProxies extends Middleware
|
|||
*
|
||||
* @var array<int, string>|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,15 +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<int, string>
|
||||
*/
|
||||
protected $except = [];
|
||||
}
|
||||
|
|
@ -2,20 +2,11 @@
|
|||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Lib\ToolboxHelper;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ContactFormRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
|
|
@ -23,25 +14,27 @@ class ContactFormRequest extends FormRequest
|
|||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
ToolboxHelper::validateRecaptcha($this, \config('services.google.recaptcha.version') === 3);
|
||||
|
||||
return [
|
||||
'civilite' => 'required|in:monsieur,madame',
|
||||
'name' => 'required|min:2',
|
||||
'lastname' => 'required|min:2',
|
||||
'address' => 'required|max:255',
|
||||
'postcode' => 'required',
|
||||
'city' => 'required|string|max:255',
|
||||
'country' => 'required|string|max:255',
|
||||
'phone' => 'required|max:255',
|
||||
'email' => 'required|email:rfc,dns,spoof|max:255',
|
||||
'topic' => 'required',
|
||||
'product_name' => 'required_if:topic,Réclamation|max:255',
|
||||
'barcode' => 'sometimes|max:128',
|
||||
'shop' => 'required_if:topic,Réclamation|max:255',
|
||||
'lot' => 'required_if:topic,Réclamation|max:255',
|
||||
'limit_date' => 'required_if:topic,Réclamation|date|nullable',
|
||||
'civilite' => 'required|in:monsieur,madame',
|
||||
'name' => 'required|min:2',
|
||||
'lastname' => 'required|min:2',
|
||||
'address' => 'required|max:255',
|
||||
'postcode' => 'required',
|
||||
'city' => 'required|string|max:255',
|
||||
'country' => 'required|string|max:255',
|
||||
'phone' => 'required|max:255',
|
||||
'email' => 'required|email:rfc,dns,spoof|max:255',
|
||||
'topic' => 'required',
|
||||
'product_name' => 'required_if:topic,Réclamation|max:255',
|
||||
'barcode' => 'sometimes|max:128',
|
||||
'shop' => 'required_if:topic,Réclamation|max:255',
|
||||
'lot' => 'required_if:topic,Réclamation|max:255',
|
||||
'limit_date' => 'required_if:topic,Réclamation|date|nullable',
|
||||
'consumption_date' => 'required_if:topic,Réclamation|date|nullable',
|
||||
'message' => 'required|min:26',
|
||||
'file' => 'nullable|mimes:jpg,jpeg,png,pdf|max:5120',
|
||||
'message' => 'required|min:26',
|
||||
'file' => 'nullable|mimes:jpg,jpeg,png,pdf|max:5120',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -54,8 +47,8 @@ class ContactFormRequest extends FormRequest
|
|||
{
|
||||
return [
|
||||
'topic.required' => __('Veuille préciser la nature de votre demande.'),
|
||||
'file.max' => __('La taille du fichier ne peut pas dépasser :max kilo-octets.'),
|
||||
'file.mimes' => __('Le fichier doit être de type : :values.'),
|
||||
'file.max' => __('La taille du fichier ne peut pas dépasser :max kilo-octets.'),
|
||||
'file.mimes' => __('Le fichier doit être de type : :values.'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,46 +25,46 @@ class StoreProductRequest extends FormRequest
|
|||
*/
|
||||
protected function prepareForValidation(): void
|
||||
{
|
||||
$tabFour = array(
|
||||
$tabFour = [
|
||||
'id' => 0,
|
||||
'name' => 'Four',
|
||||
'url' => '/assets/images/produits_details/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/produits_details/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/produits_details/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/produits_details/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/produits_details/plancha.png',
|
||||
'time' => $this->time_cook4,
|
||||
'temp' => $this->temp_cook4,
|
||||
'status' => $this->is_activated4 ? true : false
|
||||
);
|
||||
];
|
||||
$tabCuisson = json_encode([
|
||||
'four' => $tabFour,
|
||||
'friteuse' => $tabFriteuse,
|
||||
|
|
@ -77,29 +77,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([
|
||||
|
|
|
|||
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;
|
||||
|
|
|
|||
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');
|
||||
}
|
||||
}
|
||||
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
namespace App\Lib;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
|
@ -32,9 +33,9 @@ class ToolboxHelper
|
|||
* @throws Exception Cannot handle image.
|
||||
* @return string The storage path
|
||||
*/
|
||||
public static function storeImage($image, string $folderName)
|
||||
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);
|
||||
|
|
@ -42,7 +43,7 @@ class ToolboxHelper
|
|||
$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);
|
||||
|
|
@ -70,7 +71,7 @@ class ToolboxHelper
|
|||
public static function removeFile(string $path): void
|
||||
{
|
||||
$path = \ltrim(\urldecode($path), '/');
|
||||
if (\strpos($path, 'storage') !== 0) {
|
||||
if (!str_starts_with($path, 'storage')) {
|
||||
return;
|
||||
}
|
||||
$path = ToolboxHelper::mbReplace('storage/', '', $path);
|
||||
|
|
@ -115,10 +116,10 @@ class ToolboxHelper
|
|||
public static function assertFieldIsUnique(
|
||||
string $table,
|
||||
string $field,
|
||||
$value,
|
||||
mixed $value,
|
||||
?int $id = null,
|
||||
?callable $query = null
|
||||
) {
|
||||
): void {
|
||||
if (!$query) {
|
||||
Validator::make([$field => $value], [
|
||||
self::mbReplace('.', '\.', $field) => Rule::unique($table, $field)->ignore($id),
|
||||
|
|
@ -148,7 +149,7 @@ class ToolboxHelper
|
|||
* @param integer $count
|
||||
* @return mixed
|
||||
*/
|
||||
public static function mbReplace($search, $replace, $subject, int &$count = 0)
|
||||
public static function mbReplace(mixed $search, mixed $replace, mixed $subject, int &$count = 0): mixed
|
||||
{
|
||||
if (!is_array($search) && is_array($replace)) {
|
||||
return false;
|
||||
|
|
@ -229,7 +230,7 @@ class ToolboxHelper
|
|||
]);
|
||||
}
|
||||
return $match;
|
||||
} catch (NotFoundHttpException $e) {
|
||||
} catch (NotFoundHttpException) {
|
||||
return $match;
|
||||
}
|
||||
},
|
||||
|
|
@ -237,4 +238,49 @@ class ToolboxHelper
|
|||
);
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate recaptcha.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param boolean $isV3
|
||||
* @return void
|
||||
*/
|
||||
public static function validateRecaptcha(Request $request, bool $isV3 = true): void
|
||||
{
|
||||
Validator::validate($request->all(), [
|
||||
'g-recaptcha-response' => [
|
||||
'required',
|
||||
'string',
|
||||
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
|
||||
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' => resolve('clientIp')
|
||||
]);
|
||||
throw_if($e = $response->toException(), $e);
|
||||
if ($isV3) {
|
||||
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(trans('recaptcha.not_enough_score'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
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(trans('recaptcha.error'));
|
||||
} //end try
|
||||
}
|
||||
]
|
||||
], [], ['g-recaptcha-response' => 'reCaptcha']);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,6 @@ class SendContactMail extends Mailable
|
|||
use Queueable;
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* The form data.
|
||||
*
|
||||
* @var $data
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* The joined file name
|
||||
*
|
||||
|
|
@ -51,9 +44,8 @@ class SendContactMail extends Mailable
|
|||
* @param mixed $data
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($data)
|
||||
public function __construct(protected $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class BasicBanner extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'picture',
|
||||
|
|
@ -28,13 +29,13 @@ class BasicBanner extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (BasicBanner $banner) {
|
||||
static::creating(function (BasicBanner $banner): void {
|
||||
if ($banner->picture) {
|
||||
$banner->picture = ToolboxHelper::storeImage($banner->picture, $banner->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (BasicBanner $banner) {
|
||||
static::updating(function (BasicBanner $banner): void {
|
||||
if ($banner->picture) {
|
||||
$banner->picture = ToolboxHelper::storeImage($banner->picture, $banner->getTable());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class BasicTable extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Contact extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'hook',
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class Faq extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class Gamme extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'parent_gamme_id',
|
||||
'title',
|
||||
|
|
@ -37,22 +38,22 @@ class Gamme extends Model
|
|||
*/
|
||||
protected static function boot(): void
|
||||
{
|
||||
static::creating(function (Gamme $gamme) {
|
||||
static::creating(function (Gamme $gamme): void {
|
||||
$gamme->updateImages($gamme);
|
||||
});
|
||||
|
||||
static::updating(function (Gamme $gamme) {
|
||||
static::updating(function (Gamme $gamme): void {
|
||||
$gamme->updateImages($gamme);
|
||||
});
|
||||
|
||||
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 {
|
||||
$gamme->deleteImages($gamme->picture1);
|
||||
$gamme->deleteImages($gamme->picture2);
|
||||
$gamme->deleteImages($gamme->picture3);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class GammeHook extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class HomepageHook extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -30,13 +31,13 @@ class HomepageHook extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (HomepageHook $homepagehook) {
|
||||
static::creating(function (HomepageHook $homepagehook): void {
|
||||
if ($homepagehook->picture) {
|
||||
$homepagehook->picture = ToolboxHelper::storeImage($homepagehook->picture, $homepagehook->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (HomepageHook $homepagehook) {
|
||||
static::updating(function (HomepageHook $homepagehook): void {
|
||||
if ($homepagehook->picture) {
|
||||
$homepagehook->picture = ToolboxHelper::storeImage($homepagehook->picture, $homepagehook->getTable());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class HomepageNewscast extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'picture',
|
||||
|
|
@ -32,7 +33,7 @@ class HomepageNewscast extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (HomepageNewscast $homepagenewscast) {
|
||||
static::creating(function (HomepageNewscast $homepagenewscast): void {
|
||||
if ($homepagenewscast->picture) {
|
||||
$homepagenewscast->picture = ToolboxHelper::storeImage(
|
||||
$homepagenewscast->picture,
|
||||
|
|
@ -41,7 +42,7 @@ class HomepageNewscast extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (HomepageNewscast $homepagenewscast) {
|
||||
static::updating(function (HomepageNewscast $homepagenewscast): void {
|
||||
if ($homepagenewscast->picture) {
|
||||
$homepagenewscast->picture = ToolboxHelper::storeImage(
|
||||
$homepagenewscast->picture,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class HomepageSlide extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'picture',
|
||||
|
|
@ -29,6 +30,7 @@ class HomepageSlide extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $casts = [
|
||||
'new_tab' => 'bool',
|
||||
'status' => 'bool',
|
||||
|
|
@ -41,11 +43,11 @@ class HomepageSlide extends Model
|
|||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::creating(function (HomepageSlide $slide) {
|
||||
static::creating(function (HomepageSlide $slide): void {
|
||||
self::manageFields($slide);
|
||||
});
|
||||
|
||||
static::updating(function (HomepageSlide $slide) {
|
||||
static::updating(function (HomepageSlide $slide): void {
|
||||
self::manageFields($slide);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class HomepageWhoarewe extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'subtitle',
|
||||
|
|
@ -32,7 +33,7 @@ class HomepageWhoarewe extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (HomepageWhoarewe $whoarewe) {
|
||||
static::creating(function (HomepageWhoarewe $whoarewe): void {
|
||||
if ($whoarewe->picture1) {
|
||||
$whoarewe->picture1 = ToolboxHelper::storeImage($whoarewe->picture1, $whoarewe->getTable());
|
||||
}
|
||||
|
|
@ -41,7 +42,7 @@ class HomepageWhoarewe extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (HomepageWhoarewe $whoarewe) {
|
||||
static::updating(function (HomepageWhoarewe $whoarewe): void {
|
||||
if ($whoarewe->picture1) {
|
||||
$whoarewe->picture1 = ToolboxHelper::storeImage($whoarewe->picture1, $whoarewe->getTable());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class Product extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'gamme_id',
|
||||
'name',
|
||||
|
|
@ -43,15 +44,15 @@ class Product extends Model
|
|||
*/
|
||||
protected static function boot(): void
|
||||
{
|
||||
static::creating(function (Product $product) {
|
||||
static::creating(function (Product $product): void {
|
||||
$product->updateImages($product);
|
||||
});
|
||||
|
||||
static::updating(function (Product $product) {
|
||||
static::updating(function (Product $product): void {
|
||||
$product->updateImages($product);
|
||||
});
|
||||
|
||||
static::deleted(function (Product $product) {
|
||||
static::deleted(function (Product $product): void {
|
||||
$product->deleteImages($product, $product->picture1);
|
||||
$product->deleteImages($product, $product->picture2);
|
||||
$product->deleteImages($product, $product->picture3);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ class User extends Authenticatable
|
|||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
|
|
@ -28,6 +29,7 @@ class User extends Authenticatable
|
|||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $hidden = [
|
||||
'password',
|
||||
'remember_token',
|
||||
|
|
@ -38,6 +40,7 @@ class User extends Authenticatable
|
|||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
|
@ -49,13 +52,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class WhoareweBrand extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -34,7 +35,7 @@ class WhoareweBrand extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (WhoareweBrand $whoarewebrand) {
|
||||
static::creating(function (WhoareweBrand $whoarewebrand): void {
|
||||
if ($whoarewebrand->picture1) {
|
||||
$whoarewebrand->picture1 = ToolboxHelper::storeImage(
|
||||
$whoarewebrand->picture1,
|
||||
|
|
@ -49,7 +50,7 @@ class WhoareweBrand extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (WhoareweBrand $whoarewebrand) {
|
||||
static::updating(function (WhoareweBrand $whoarewebrand): void {
|
||||
if ($whoarewebrand->picture1) {
|
||||
$whoarewebrand->picture1 = ToolboxHelper::storeImage(
|
||||
$whoarewebrand->picture1,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class WhoareweBrandDetail extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class WhoareweContact extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -32,7 +33,7 @@ class WhoareweContact extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (WhoareweContact $whoarewecontact) {
|
||||
static::creating(function (WhoareweContact $whoarewecontact): void {
|
||||
if ($whoarewecontact->picture) {
|
||||
$whoarewecontact->picture = ToolboxHelper::storeImage(
|
||||
$whoarewecontact->picture,
|
||||
|
|
@ -41,7 +42,7 @@ class WhoareweContact extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (WhoareweContact $whoarewecontact) {
|
||||
static::updating(function (WhoareweContact $whoarewecontact): void {
|
||||
if ($whoarewecontact->picture) {
|
||||
$whoarewecontact->picture = ToolboxHelper::storeImage(
|
||||
$whoarewecontact->picture,
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class WhoareweDescription extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -31,7 +32,7 @@ class WhoareweDescription extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (WhoareweDescription $whoarewedescription) {
|
||||
static::creating(function (WhoareweDescription $whoarewedescription): void {
|
||||
if ($whoarewedescription->picture1) {
|
||||
$whoarewedescription->picture1 = ToolboxHelper::storeImage(
|
||||
$whoarewedescription->picture1,
|
||||
|
|
@ -46,7 +47,7 @@ class WhoareweDescription extends Model
|
|||
}
|
||||
});
|
||||
|
||||
static::updating(function (WhoareweDescription $whoarewedescription) {
|
||||
static::updating(function (WhoareweDescription $whoarewedescription): void {
|
||||
if ($whoarewedescription->picture1) {
|
||||
$whoarewedescription->picture1 = ToolboxHelper::storeImage(
|
||||
$whoarewedescription->picture1,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class WhoareweExpertise extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'text',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class WhoareweExpertiseDetail extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class WhoareweIcon extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'text',
|
||||
'picture',
|
||||
|
|
@ -28,13 +29,13 @@ class WhoareweIcon extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (WhoareweIcon $whoareweicon) {
|
||||
static::creating(function (WhoareweIcon $whoareweicon): void {
|
||||
if ($whoareweicon->picture) {
|
||||
$whoareweicon->picture = ToolboxHelper::storeImage($whoareweicon->picture, $whoareweicon->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (WhoareweIcon $whoareweicon) {
|
||||
static::updating(function (WhoareweIcon $whoareweicon): void {
|
||||
if ($whoareweicon->picture) {
|
||||
$whoareweicon->picture = ToolboxHelper::storeImage($whoareweicon->picture, $whoareweicon->getTable());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class WhoareweIconDetail extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'picture',
|
||||
|
|
@ -28,13 +29,13 @@ class WhoareweIconDetail extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (WhoareweIconDetail $whoarewe) {
|
||||
static::creating(function (WhoareweIconDetail $whoarewe): void {
|
||||
if ($whoarewe->picture) {
|
||||
$whoarewe->picture = ToolboxHelper::storeImage($whoarewe->picture, $whoarewe->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (WhoareweIconDetail $whoarewe) {
|
||||
static::updating(function (WhoareweIconDetail $whoarewe): void {
|
||||
if ($whoarewe->picture) {
|
||||
$whoarewe->picture = ToolboxHelper::storeImage($whoarewe->picture, $whoarewe->getTable());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class WhoareweKnow extends Model
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
#[\Override]
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text',
|
||||
|
|
@ -30,13 +31,13 @@ class WhoareweKnow extends Model
|
|||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
static::creating(function (WhoareweKnow $whoareweknow) {
|
||||
static::creating(function (WhoareweKnow $whoareweknow): void {
|
||||
if ($whoareweknow->picture) {
|
||||
$whoareweknow->picture = ToolboxHelper::storeImage($whoareweknow->picture, $whoareweknow->getTable());
|
||||
}
|
||||
});
|
||||
|
||||
static::updating(function (WhoareweKnow $whoareweknow) {
|
||||
static::updating(function (WhoareweKnow $whoareweknow): void {
|
||||
if ($whoareweknow->picture) {
|
||||
$whoareweknow->picture = ToolboxHelper::storeImage($whoareweknow->picture, $whoareweknow->getTable());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,27 +2,25 @@
|
|||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
// * HTTPS FIX
|
||||
URL::forceScheme('https');
|
||||
|
||||
// * HA PROXY FIX
|
||||
App::singleton('clientIp', fn() => (config('app.env') === 'local')
|
||||
? request()->getClientIp()
|
||||
: request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ class AuthServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $policies = [];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ class EventServiceProvider extends ServiceProvider
|
|||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
#[\Override]
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class RouteServiceProvider extends ServiceProvider
|
|||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
$this->routes(function (): void {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
|
|
@ -53,8 +53,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
|
||||
});
|
||||
RateLimiter::for('api', fn(Request $request) => Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
*/
|
||||
|
||||
$app = new Illuminate\Foundation\Application(
|
||||
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||
\Illuminate\Support\Env::get('APP_BASE_PATH', dirname(__DIR__))
|
||||
);
|
||||
|
||||
/*
|
||||
|
|
|
|||
170
composer.json
170
composer.json
|
|
@ -1,84 +1,94 @@
|
|||
{
|
||||
"name": "laravel/laravel",
|
||||
"type": "project",
|
||||
"description": "The Laravel Framework.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^7.3|^8.0",
|
||||
"fruitcake/laravel-cors": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/refresh-sitemap": "^1.0",
|
||||
"laravel/framework": "^8.75",
|
||||
"laravel/tinker": "^2.5",
|
||||
"laravel/ui": "^3.4",
|
||||
"ldc/web-admin-secure-laravel": "1.0.1",
|
||||
"mews/purifier": "^3.3",
|
||||
"sentry/sentry-laravel": "^3.1",
|
||||
"uwil/k8s-laravel": "^1.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"facade/ignition": "^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"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
"name": "uwil/domaine-de-lanvaux",
|
||||
"type": "project",
|
||||
"description": "domaine-de-lanvaux website",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"php-http/discovery": true
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.5",
|
||||
"dxw/cidr": "^4.0",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"kwaadpepper/enum": "^2.1",
|
||||
"laravel/framework": "^13.0",
|
||||
"laravel/tinker": "^3.0",
|
||||
"laravel/ui": "^4.0",
|
||||
"mews/purifier": "^3.3",
|
||||
"sentry/sentry-laravel": "^4.3",
|
||||
"uwil/laravel-k8s": "*"
|
||||
},
|
||||
"gitlab-domains": [
|
||||
"lab.s-web.fr"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"repositories": {
|
||||
"lab.s-web.fr": {
|
||||
"type": "composer",
|
||||
"url": "https://lab.s-web.fr/api/v4/group/23/-/packages/composer/packages.json"
|
||||
}
|
||||
}
|
||||
"require-dev": {
|
||||
"spatie/laravel-ignition": "^2.0",
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^8.1",
|
||||
"phpunit/phpunit": "^12.0",
|
||||
"slevomat/coding-standard": "^8.31"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": true,
|
||||
"php-http/discovery": true
|
||||
},
|
||||
"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": "stable",
|
||||
"prefer-stable": true,
|
||||
"repositories": {
|
||||
"lab.s-web.fr": {
|
||||
"type": "composer",
|
||||
"url": "https://lab.s-web.fr/api/v4/group/23/-/packages/composer/packages.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
7696
composer.lock
generated
7696
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')
|
||||
];
|
||||
|
|
@ -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,104 +0,0 @@
|
|||
<?php
|
||||
|
||||
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' => [],
|
||||
|
||||
/**
|
||||
* 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' => true,
|
||||
|
||||
/**
|
||||
* 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(...),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -18,4 +18,11 @@ return [
|
|||
'site_id' => env('MATOMO_SITE_ID')
|
||||
],
|
||||
|
||||
'google' => [
|
||||
'recaptcha' => [
|
||||
'public' => env('GOOGLE_RECAPTCHA_PUBLIC'),
|
||||
'private' => env('GOOGLE_RECAPTCHA_PRIVATE'),
|
||||
'version' => env('GOOGLE_RECAPTCHA_VERSION', "3") === "3" ? true : false
|
||||
]
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
$picture = new Gamme();
|
||||
$upload = new SplFileInfo(resource_path('assets/images/gammes/rillettes.png'));
|
||||
|
|
|
|||
|
|
@ -17,62 +17,62 @@ 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/produits_details/four.png',
|
||||
'time' => '1h30mins.',
|
||||
'temp' => '200°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabFriteuse = array(
|
||||
];
|
||||
$tabFriteuse = [
|
||||
'id' => 1,
|
||||
'name' => 'Friteuse',
|
||||
'url' => '/assets/images/produits_details/friteuse.png',
|
||||
'time' => '15mins',
|
||||
'temp' => '100°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabPoele = array(
|
||||
];
|
||||
$tabPoele = [
|
||||
'id' => 2,
|
||||
'name' => 'Poêle',
|
||||
'url' => '/assets/images/produits_details/poele.png',
|
||||
'time' => '5mins sur chaque face',
|
||||
'temp' => '100°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabCocotte = array(
|
||||
];
|
||||
$tabCocotte = [
|
||||
'id' => 3,
|
||||
'name' => 'Cocotte',
|
||||
'url' => '/assets/images/produits_details/cocotte.png',
|
||||
'time' => '3h',
|
||||
'temp' => '80°C',
|
||||
'status' => false
|
||||
);
|
||||
$tabPlancha = array(
|
||||
];
|
||||
$tabPlancha = [
|
||||
'id' => 4,
|
||||
'name' => 'Plancha',
|
||||
'url' => '/assets/images/produits_details/plancha.png',
|
||||
'time' => '20mins',
|
||||
'temp' => '130°C',
|
||||
'status' => true
|
||||
);
|
||||
$tabPlusProduit1 = array(
|
||||
];
|
||||
$tabPlusProduit1 = [
|
||||
'id' => 0,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit2 = array(
|
||||
];
|
||||
$tabPlusProduit2 = [
|
||||
'id' => 1,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '',
|
||||
);
|
||||
$tabPlusProduit3 = array(
|
||||
];
|
||||
$tabPlusProduit3 = [
|
||||
'id' => 2,
|
||||
'name' => 'Lorem ipsum set doloris',
|
||||
'url' => '',
|
||||
);
|
||||
];
|
||||
|
||||
$upload = new SplFileInfo(resource_path('assets/images/gammes/rillettes.png'));
|
||||
$picture = new Product();
|
||||
|
|
|
|||
|
|
@ -32,10 +32,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->string('name');
|
||||
$table->string('email')->unique();
|
||||
|
|
@ -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 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->text('title');
|
||||
$table->string('slug')->unique();
|
||||
|
|
@ -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 AlterGammesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,12 +13,11 @@ class AlterGammesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('gammes', function (Blueprint $table) {
|
||||
Schema::table('gammes', function (Blueprint $table): void {
|
||||
$table->unsignedBigInteger('parent_gamme_id')->nullable()->after('id');
|
||||
$table->foreign('parent_gamme_id')->references('id')->on('gammes');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -26,8 +25,8 @@ class AlterGammesTable extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('gammes', function (Blueprint $table) {
|
||||
Schema::table('gammes', function (Blueprint $table): void {
|
||||
$table->dropColumn('parent_gamme_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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()->constrained();
|
||||
$table->text('name');
|
||||
|
|
@ -33,7 +33,6 @@ class CreateProductsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -43,4 +42,4 @@ class CreateProductsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('products');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBasicTablesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateBasicTablesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('basic_tables', function (Blueprint $table) {
|
||||
Schema::create('basic_tables', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('title');
|
||||
$table->string('slug');
|
||||
|
|
@ -21,7 +21,6 @@ class CreateBasicTablesTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -31,4 +30,4 @@ class CreateBasicTablesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('basic_tables');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateHomepageSlidesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateHomepageSlidesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('homepage_slides', function (Blueprint $table) {
|
||||
Schema::create('homepage_slides', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('title');
|
||||
$table->string('picture')->nullable();
|
||||
|
|
@ -23,7 +23,6 @@ class CreateHomepageSlidesTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -33,4 +32,4 @@ class CreateHomepageSlidesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('homepage_slides');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateHomepageNewscastsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateHomepageNewscastsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('homepage_newscasts', function (Blueprint $table) {
|
||||
Schema::create('homepage_newscasts', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('title');
|
||||
$table->string('picture')->nullable();
|
||||
|
|
@ -27,7 +27,6 @@ class CreateHomepageNewscastsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -37,4 +36,4 @@ class CreateHomepageNewscastsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('homepage_newscasts');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateHomepageWhoarewesTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateHomepageWhoarewesTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('homepage_whoarewes', function (Blueprint $table) {
|
||||
Schema::create('homepage_whoarewes', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('slug');
|
||||
$table->text('title');
|
||||
|
|
@ -27,7 +27,6 @@ class CreateHomepageWhoarewesTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -37,4 +36,4 @@ class CreateHomepageWhoarewesTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('homepage_whoarewes');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateBasicBannersTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateBasicBannersTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('basic_banners', function (Blueprint $table) {
|
||||
Schema::create('basic_banners', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('slug');
|
||||
$table->text('title');
|
||||
|
|
@ -23,7 +23,6 @@ class CreateBasicBannersTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -33,4 +32,4 @@ class CreateBasicBannersTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('basic_banners');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateHomepageHooksTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateHomepageHooksTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('homepage_hooks', function (Blueprint $table) {
|
||||
Schema::create('homepage_hooks', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('slug');
|
||||
$table->text('title');
|
||||
|
|
@ -25,7 +25,6 @@ class CreateHomepageHooksTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -35,4 +34,4 @@ class CreateHomepageHooksTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('homepage_hooks');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateWhoareweDescriptionsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateWhoareweDescriptionsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('whoarewe_descriptions', function (Blueprint $table) {
|
||||
Schema::create('whoarewe_descriptions', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('slug');
|
||||
$table->text('title');
|
||||
|
|
@ -26,7 +26,6 @@ class CreateWhoareweDescriptionsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -36,4 +35,4 @@ class CreateWhoareweDescriptionsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('whoarewe_descriptions');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
|||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateWhoareweIconDetailsTable extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
|
@ -13,7 +13,7 @@ class CreateWhoareweIconDetailsTable extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('whoarewe_icon_details', function (Blueprint $table) {
|
||||
Schema::create('whoarewe_icon_details', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->text('slug');
|
||||
$table->text('title');
|
||||
|
|
@ -23,7 +23,6 @@ class CreateWhoareweIconDetailsTable extends Migration
|
|||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
|
|
@ -33,4 +32,4 @@ class CreateWhoareweIconDetailsTable extends Migration
|
|||
{
|
||||
Schema::dropIfExists('whoarewe_icon_details');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue