Compare commits

..

No commits in common. "develop" and "add-CICD" have entirely different histories.

174 changed files with 5828 additions and 5793 deletions

View file

@ -25,17 +25,8 @@ MAIL_LIST_CONTACTFORM=
# Matomo
MATOMO_SITE_ID=
# Google Recaptcha
GOOGLE_RECAPTCHA_PUBLIC=
GOOGLE_RECAPTCHA_PRIVATE=
GOOGLE_RECAPTCHA_VERSION=
# UWIL ADMIN SECURE
# - LIST SEPARATED WITH ',' (Required)
UWIL_ADMIN_SECURE_CIDR_LIST=""
# - LIST SEPARATED WITH ',' (Optional)
UWIL_ADMIN_SECURE_CIDR_PROJECT_ALLOWED_LIST=""
## LDCWEB ADMIN SECURE
LDC_WEB_API_KEY=
# Sentry
SENTRY_LARAVEL_DSN=

7
.gitignore vendored
View file

@ -1,6 +1,6 @@
/public/build
/public/storage
# /public/sitemap.xml
/public/sitemap.xml
/storage/app/public/*.*
node_modules
/vendor
@ -8,8 +8,3 @@ node_modules
auth.json
.vscode
.npmrc
.viminfo
.zshrc
.composer
.config
.npm

View file

@ -1,13 +1,13 @@
include:
- project: "ldc-web/shared-ci"
ref: "main"
file: "lint/lint.yml"
file: "lint/lint7.3.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "security/security.yml"
file: "security/security7.3.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "build/build.yml"
file: "build/build7.3.yml"
- project: "ldc-web/shared-ci"
ref: "main"
file: "test/test.yml"

14
.vscode/settings.json vendored
View file

@ -12,22 +12,12 @@
"statusBar.background": "#273c4e",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#385670",
"statusBarItem.remoteBackground": "#aa5583",
"statusBarItem.remoteBackground": "#273c4e",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#273c4e",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#273c4e99",
"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"
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.remoteColor": "#273c4e"
}

View file

@ -1,6 +1,5 @@
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}
FROM registry.s-web.fr/ldc-web/projets/ldc-web-images-docker/ldcweb-production-7.3:latest
COPY --chown=www-data:www-data . /app/srcs
USER root
RUN chmod -R 755 /app/srcs/storage
USER www-data
USER www-data

View file

@ -17,7 +17,6 @@ class CreateAdmin extends Command
*
* @var string
*/
#[\Override]
protected $signature = 'user:create';
/**
@ -25,7 +24,6 @@ class CreateAdmin extends Command
*
* @var string
*/
#[\Override]
protected $description = 'Create a backend admin user';
/**

View file

@ -79,10 +79,10 @@ final class Category extends BaseEnum
public function __get(string $attribute)
{
if ($attribute === 'icon') {
return self::icon()[$this->getDefinition()] ?? null;
return $this->icon()[$this->getDefinition()] ?? null;
}
if ($attribute === 'color') {
return self::color()[$this->getDefinition()] ?? null;
return $this->color()[$this->getDefinition()] ?? null;
}
return parent::__get($attribute);
}

View file

@ -11,7 +11,6 @@ class Handler extends ExceptionHandler
*
* @var array
*/
#[\Override]
protected $dontReport = [];
/**
@ -20,9 +19,9 @@ class Handler extends ExceptionHandler
*/
public function register()
{
$this->reportable(function (\Throwable $e): void {
$this->reportable(function (\Throwable $e) {
if (app()->bound('sentry')) {
resolve('sentry')->captureException($e);
app('sentry')->captureException($e);
}
});
}

View file

@ -34,11 +34,11 @@ class CharteController extends Controller
$charte->fill($request->validated());
if ($charte->saveOrFail()) {
return to_route('bo.charte.edit', $charte->slug)
return redirect()->route('bo.charte.edit', $charte->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.charte.edit', $charte->slug)
return redirect()->route('bo.charte.edit', $charte->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -34,11 +34,11 @@ class ContactController extends Controller
$contact->fill($request->validated());
if ($contact->saveOrFail()) {
return to_route('bo.contact.edit', $contact->slug)
return redirect()->route('bo.contact.edit', $contact->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.contact.edit', $contact->slug)
return redirect()->route('bo.contact.edit', $contact->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -34,11 +34,11 @@ class FaqBannersController extends Controller
$faqbanner->fill($request->validated());
if (!$faqbanner->saveOrFail()) {
return to_route('bo.faqbanners.edit', $faqbanner->slug)
return redirect()->route('bo.faqbanners.edit', $faqbanner->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.faqbanners.edit', $faqbanner->slug)
return redirect()->route('bo.faqbanners.edit', $faqbanner->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -47,7 +47,7 @@ class FaqsController extends Controller
$faq->order = $this->getLastOrder();
if ($faq->saveOrFail()) {
return to_route('bo.faqs.edit', $faq->id)->with('success', trans(__('Creation_saved')));
return redirect()->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 to_route('bo.faqs.edit', $faq->id)->with('success', trans(__('Changes_saved')));
return redirect()->route('bo.faqs.edit', $faq->id)->with('success', trans(__('Changes_saved')));
}
return to_route('bo.faqs.edit', $faq->id)->with('error', trans(__('Changes_failed')));
return redirect()->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 to_route('bo.faqs.index')->with('success', trans(__('Delete_saved')));
return redirect()->route('bo.faqs.index')->with('success', trans(__('Delete_saved')));
}
return to_route('bo.faqs.index')->with('error', trans(__('Delete_failed')));
return redirect()->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 to_route('bo.faq.index');
return redirect()->route('bo.faq.index');
}
$tmp->save();
$faq->save();

View file

@ -34,11 +34,11 @@ class GammeBannersController extends Controller
$gammebanner->fill($request->validated());
if ($gammebanner->saveOrFail()) {
return to_route('bo.gammebanners.edit', $gammebanner->slug)
return redirect()->route('bo.gammebanners.edit', $gammebanner->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.gammebanners.edit', $gammebanner->slug)
return redirect()->route('bo.gammebanners.edit', $gammebanner->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -34,11 +34,11 @@ class GammeHooksController extends Controller
$gammehook->fill($request->validated());
if ($gammehook->saveOrFail()) {
return to_route('bo.gammehooks.edit', $gammehook->slug)
return redirect()->route('bo.gammehooks.edit', $gammehook->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.gammehooks.edit', $gammehook->slug)
return redirect()->route('bo.gammehooks.edit', $gammehook->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -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): void {
->map(function (Gamme $childGamme) use (&$gammes) {
$gammes->push($childGamme);
});
}
@ -73,7 +73,7 @@ class GammesController extends Controller
$gamme->category = null;
}
if ($gamme->saveOrFail()) {
return to_route('bo.gammes.edit', $gamme->id)->with('success', trans(__('Changes_saved')));
return redirect()->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 to_route('bo.gammes.edit', $gamme->id)
return redirect()->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 to_route('bo.gammes.index')->with('success', trans(__('Delete_saved')));
return redirect()->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 to_route('bo.homepage_slides.index');
return redirect()->route('bo.homepage_slides.index');
}
$tmp->save();
$gamme->save();

View file

@ -35,11 +35,11 @@ class HomepageHooksController extends Controller
$homepagehook->fill($request->validated());
if ($homepagehook->saveOrFail()) {
return to_route('bo.homepagehooks.edit', $homepagehook->slug)
return redirect()->route('bo.homepagehooks.edit', $homepagehook->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.homepagehooks.edit', $homepagehook->slug)
return redirect()->route('bo.homepagehooks.edit', $homepagehook->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -47,7 +47,7 @@ class HomepageNewscastsController extends Controller
$homepagenewscast->order = $this->getLastOrder();
if ($homepagenewscast->saveOrFail()) {
return to_route('bo.homepagenewscasts.edit', $homepagenewscast->id)
return redirect()->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 to_route('bo.homepagenewscasts.edit', $homepagenewscast->id)
return redirect()->route('bo.homepagenewscasts.edit', $homepagenewscast->id)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.homepagenewscasts.edit', $homepagenewscast->id)
return redirect()->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 to_route('bo.homepagenewscasts.index')->with('success', trans(__('Delete_saved')));
return redirect()->route('bo.homepagenewscasts.index')->with('success', trans(__('Delete_saved')));
}
return to_route('bo.homepagenewscasts.index')->with('error', trans(__('Delete_failed')));
return redirect()->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 to_route('bo.homepage_newscasts.index');
return redirect()->route('bo.homepage_newscasts.index');
}
$tmp->save();
$homepagenewscast->save();

View file

@ -49,7 +49,7 @@ class HomepageSlidesController extends Controller
$homepageslide->picture = ToolboxHelper::storeImage($request->picture, $homepageslide->getTable());
if ($homepageslide->saveOrFail()) {
return to_route('bo.homepageslides.edit', $homepageslide->id)
return redirect()->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 to_route('bo.homepageslides.edit', $homepageslide->id)
return redirect()->route('bo.homepageslides.edit', $homepageslide->id)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.homepageslides.edit', $homepageslide->id)
return redirect()->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 to_route('bo.homepageslides.index')->with('error', trans('La suppression a échoué'));
return redirect()->route('bo.homepageslides.index')->with('error', trans('La suppression a échoué'));
}
return to_route('bo.homepageslides.index')->with('success', trans('Suppression faite avec succès'));
return redirect()->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 to_route('bo.homepage_slides.index');
return redirect()->route('bo.homepage_slides.index');
}
$tmp->save();
$homepageslide->save();

View file

@ -35,11 +35,11 @@ class HomepageWhoarewesController extends Controller
$homepagewhoarewe->fill($request->validated());
if ($homepagewhoarewe->saveOrFail()) {
return to_route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
return redirect()->route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
return redirect()->route('bo.homepagewhoarewes.edit', $homepagewhoarewe->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -34,11 +34,11 @@ class MentionController extends Controller
$mention->fill($request->validated());
if ($mention->saveOrFail()) {
return to_route('bo.mention.edit', $mention->slug)
return redirect()->route('bo.mention.edit', $mention->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.mention.edit', $mention->slug)
return redirect()->route('bo.mention.edit', $mention->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -34,64 +34,64 @@ class ProductsController extends Controller
public function create(Product $product): \Illuminate\Contracts\View\View
{
$gammes = Gamme::all()->sortBy('title');
$tabPlusProduit1 = [
$tabPlusProduit1 = array(
'id' => 0,
'name' => '',
'url' => '',
];
$tabPlusProduit2 = [
);
$tabPlusProduit2 = array(
'id' => 1,
'name' => '',
'url' => '',
];
$tabPlusProduit3 = [
);
$tabPlusProduit3 = array(
'id' => 2,
'name' => '',
'url' => '',
];
);
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
$tabFour = [
$tabFour = array(
'id' => 0,
'name' => 'Four',
'url' => '/assets/images/produits_details/four.png',
'time' => '',
'temp' => '',
'status' => false
];
$tabFriteuse = [
);
$tabFriteuse = array(
'id' => 1,
'name' => 'Friteuse',
'url' => '/assets/images/produits_details/friteuse.png',
'time' => '',
'temp' => '',
'status' => false
];
$tabPoele = [
);
$tabPoele = array(
'id' => 2,
'name' => 'Poêle',
'url' => '/assets/images/produits_details/poele.png',
'time' => '',
'temp' => '',
'status' => false
];
$tabCocotte = [
);
$tabCocotte = array(
'id' => 3,
'name' => 'Cocotte',
'url' => '/assets/images/produits_details/cocotte.png',
'time' => '',
'temp' => '',
'status' => false
];
$tabPlancha = [
);
$tabPlancha = array(
'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 to_route('bo.products.edit', $product->id)
return redirect()->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 to_route('bo.products.edit', $product->id)
return redirect()->route('bo.products.edit', $product->id)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.products.edit', $product->id)
return redirect()->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 to_route('bo.products.index')->with('success', trans('Delete_saved'));
return redirect()->route('bo.products.index')->with('success', trans('Delete_saved'));
}
return to_route('bo.products.index')->with('error', trans('Delete_failed'));
return redirect()->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 to_route('bo.products.index');
return redirect()->route('bo.products.index');
}
$tmp->save();
$product->save();

View file

@ -34,11 +34,11 @@ class WhoareweBannersController extends Controller
$whoarewebanner->fill($request->validated());
if ($whoarewebanner->saveOrFail()) {
return to_route('bo.whoarewebanners.edit', $whoarewebanner->slug)
return redirect()->route('bo.whoarewebanners.edit', $whoarewebanner->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoarewebanners.edit', $whoarewebanner->slug)
return redirect()->route('bo.whoarewebanners.edit', $whoarewebanner->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -35,11 +35,11 @@ class WhoareweBrandDetailsController extends Controller
$whoarewebranddetail->fill($request->validated());
if ($whoarewebranddetail->saveOrFail()) {
return to_route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
return redirect()->route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
return redirect()->route('bo.whoarewebranddetails.edit', $whoarewebranddetail->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -47,7 +47,7 @@ class WhoareweBrandsController extends Controller
$whoarewebrand->order = $this->getLastOrder();
if ($whoarewebrand->saveOrFail()) {
return to_route('bo.whoarewebrands.edit', $whoarewebrand->id)
return redirect()->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 to_route('bo.whoarewebrands.edit', $whoarewebrand->id)
return redirect()->route('bo.whoarewebrands.edit', $whoarewebrand->id)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoarewebrands.edit', $whoarewebrand->id)
return redirect()->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 to_route('bo.whoarewebrands.index')->with('success', trans('Suppression faite avec succès'));
return redirect()->route('bo.whoarewebrands.index')->with('success', trans('Suppression faite avec succès'));
}
return to_route('bo.whoarewebrands.index')->with('error', trans('La suppression a échoué'));
return redirect()->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 to_route('bo.whoarewe_brands.index');
return redirect()->route('bo.whoarewe_brands.index');
}
$tmp->save();
$whoarewebrand->save();

View file

@ -35,11 +35,11 @@ class WhoareweContactsController extends Controller
$whoarewecontact->fill($request->validated());
if ($whoarewecontact->saveOrFail()) {
return to_route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
return redirect()->route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
return redirect()->route('bo.whoarewecontacts.edit', $whoarewecontact->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -35,11 +35,11 @@ class WhoareweDescriptionsController extends Controller
$whoarewedescription->fill($request->validated());
if ($whoarewedescription->saveOrFail()) {
return to_route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
return redirect()->route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
return redirect()->route('bo.whoarewedescriptions.edit', $whoarewedescription->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -36,11 +36,11 @@ class WhoareweExpertiseDetailsController extends Controller
$whoareweexpertisedetail->fill($request->validated());
if ($whoareweexpertisedetail->saveOrFail()) {
return to_route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
return redirect()->route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
return redirect()->route('bo.whoareweexpertisedetails.edit', $whoareweexpertisedetail->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -47,7 +47,7 @@ class WhoareweExpertisesController extends Controller
$whoareweexpertise->order = $this->getLastOrder();
if ($whoareweexpertise->saveOrFail()) {
return to_route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
return redirect()->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 to_route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
return redirect()->route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoareweexpertises.edit', $whoareweexpertise->id)
return redirect()->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 to_route('bo.whoareweexpertises.index')
return redirect()->route('bo.whoareweexpertises.index')
->with('success', trans(__('Delete_saved')));
}
return to_route('bo.whoareweexpertises.index')->with('error', trans(__('Delete_failed')));
return redirect()->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 to_route('bo.whoarewe_expertises.index');
return redirect()->route('bo.whoarewe_expertises.index');
}
$tmp->save();
$whoareweexpertise->save();

View file

@ -35,7 +35,7 @@ class WhoareweIconDetailsController extends Controller
$whoareweicondetail->fill($request->validated());
if ($whoareweicondetail->saveOrFail()) {
return to_route('bo.whoareweicondetails.edit', $whoareweicondetail->slug)
return redirect()->route('bo.whoareweicondetails.edit', $whoareweicondetail->slug)
->with('success', trans(__('Changes_saved')));
}

View file

@ -46,7 +46,7 @@ class WhoareweIconsController extends Controller
$whoareweicon = new WhoareweIcon($request->validated());
$whoareweicon->order = $this->getLastOrder();
if ($whoareweicon->saveOrFail()) {
return to_route('bo.whoareweicons.edit', $whoareweicon->id)
return redirect()->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 to_route('bo.whoareweicons.edit', $whoareweicon->id)
return redirect()->route('bo.whoareweicons.edit', $whoareweicon->id)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoareweicons.edit', $whoareweicon->id)
return redirect()->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 to_route('bo.whoareweicons.index')->with('success', trans(__('Delete_saved')));
return redirect()->route('bo.whoareweicons.index')->with('success', trans(__('Delete_saved')));
}
return to_route('bo.whoareweicons.index')->with('error', trans(__('Delete_failed')));
return redirect()->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 to_route('bo.whoarewe_icons.index');
return redirect()->route('bo.whoarewe_icons.index');
}
$tmp->save();
$whoareweicon->save();

View file

@ -35,11 +35,11 @@ class WhoareweKnowsController extends Controller
$whoareweknow->fill($request->validated());
if ($whoareweknow->saveOrFail()) {
return to_route('bo.whoareweknows.edit', $whoareweknow->slug)
return redirect()->route('bo.whoareweknows.edit', $whoareweknow->slug)
->with('success', trans(__('Changes_saved')));
}
return to_route('bo.whoareweknows.edit', $whoareweknow->slug)
return redirect()->route('bo.whoareweknows.edit', $whoareweknow->slug)
->with('error', trans(__('Changes_failed')));
});
}

View file

@ -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): void {
->map(function (Gamme $childGamme) use (&$gammes) {
$gammes->push($childGamme->id);
});
}

View file

@ -15,7 +15,7 @@ class Kernel extends HttpKernel
*/
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
@ -34,9 +34,8 @@ class Kernel extends HttpKernel
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\Illuminate\Foundation\Http\Middleware\PreventRequestForgery::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\App\Http\Middleware\SecureHeaders::class,
],
'api' => [
@ -52,7 +51,7 @@ class Kernel extends HttpKernel
*
* @var array<string, class-string|string>
*/
protected $middlewareAliases = [
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
@ -63,6 +62,5 @@ 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,
];
}

View file

@ -1,46 +0,0 @@
<?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'));
}
}

View file

@ -2,6 +2,7 @@
namespace App\Http\Middleware;
use Illuminate\Http\Request;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
class Authenticate extends Middleware
@ -11,11 +12,9 @@ class Authenticate extends Middleware
*
* @param \Illuminate\Http\Request $request
* @return string|null
* @phpcs:disabled Squiz.Commenting.FunctionComment.TypeHintMissing
*/
protected function redirectTo($request)
protected function redirectTo(Request $request)
{
// @phpcs:enable
if (!$request->expectsJson()) {
return route('bo.login');
}

View file

@ -11,6 +11,5 @@ class EncryptCookies extends Middleware
*
* @var array<int, string>
*/
#[\Override]
protected $except = [];
}

View file

@ -20,7 +20,7 @@ class HtmlSanitizer
$inputs = $request->all();
/** @var callable|null */
$cleanInput = null;
$cleanInput = function (&$input, $name, $rootName = null) use ($params, &$cleanInput): void {
$cleanInput = function (&$input, $name, $rootName = null) use ($params, &$cleanInput) {
// * 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): void {
\array_walk_recursive($isJson, function (&$item) {
if (\is_string($item)) {
$item = clean($item);
$item = ToolboxHelper::stripCkEditorSchemesOnMediaInputs($item);

View file

@ -11,6 +11,5 @@ class PreventRequestsDuringMaintenance extends Middleware
*
* @var array<int, string>
*/
#[\Override]
protected $except = [];
}

View file

@ -1,119 +0,0 @@
<?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);
}
}
}

View file

@ -11,7 +11,6 @@ class TrimStrings extends Middleware
*
* @var array<int, string>
*/
#[\Override]
protected $except = [
'current_password',
'password',

View file

@ -12,7 +12,6 @@ class TrustProxies extends Middleware
*
* @var array<int, string>|string|null
*/
#[\Override]
protected $proxies;
/**
@ -20,7 +19,6 @@ class TrustProxies extends Middleware
*
* @var integer
*/
#[\Override]
protected $headers =
Request::HEADER_X_FORWARDED_FOR |
Request::HEADER_X_FORWARDED_HOST |

View file

@ -0,0 +1,15 @@
<?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 = [];
}

View file

@ -2,11 +2,20 @@
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.
*
@ -14,27 +23,25 @@ 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',
];
}
@ -47,8 +54,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.'),
];
}
}

View file

@ -25,46 +25,46 @@ class StoreProductRequest extends FormRequest
*/
protected function prepareForValidation(): void
{
$tabFour = [
$tabFour = array(
'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 = [
);
$tabFriteuse = array(
'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 = [
);
$tabPoele = array(
'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 = [
);
$tabCocotte = array(
'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 = [
);
$tabPlancha = array(
'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 = [
$tabPlusProduit1 = array(
'id' => 0,
'name' => $this->content0,
'url' => $urlPlusProduit,
];
);
$urlPlusProduit = "";
if ($this->pictogramme1) {
$urlPlusProduit = "/assets/images/" . $this->pictogramme1->getClientOriginalName();
}
$tabPlusProduit2 = [
$tabPlusProduit2 = array(
'id' => 1,
'name' => $this->content1,
'url' => $urlPlusProduit,
];
);
$urlPlusProduit = "";
if ($this->pictogramme2) {
$urlPlusProduit = "/assets/images/" . $this->pictogramme2->getClientOriginalName();
}
$tabPlusProduit3 = [
$tabPlusProduit3 = array(
'id' => 2,
'name' => $this->content2,
'url' => $urlPlusProduit,
];
);
$tabPlusProduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
$this->merge([

View file

@ -1,123 +0,0 @@
<?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;
}
}

View file

@ -170,12 +170,19 @@ class ExceptionsHelper
$argsCount = count($stack['args']);
for ($i = 0; $i < $argsCount; $i++) {
$type = \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]),
};
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]);
}
$traceArgs .= ($i !== ($argsCount - 1) ? ',' : '');
}
return $traceArgs;

View file

@ -1,157 +0,0 @@
<?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');
}
}

View file

@ -2,13 +2,12 @@
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;
@ -33,9 +32,9 @@ class ToolboxHelper
* @throws Exception Cannot handle image.
* @return string The storage path
*/
public static function storeImage($image, string $folderName): string
public static function storeImage($image, string $folderName)
{
if (\is_object($image) and $image::class === UploadedFile::class) {
if (\is_object($image) and get_class($image) === UploadedFile::class) {
/** @var UploadedFile */
$image = $image;
$newPath = self::prepareMoveFile($image->getClientOriginalName(), $folderName);
@ -43,7 +42,7 @@ class ToolboxHelper
$image->storePubliclyAs(pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME));
return '/storage' . str_replace('/public', '', $newPath);
}
if (\is_object($image) and $image::class === SplFileInfo::class) {
if (\is_object($image) and get_class($image) === SplFileInfo::class) {
/** @var SplFileInfo */
$image = $image;
$newPath = self::prepareMoveFile($image->getBaseName(), $folderName);
@ -71,7 +70,7 @@ class ToolboxHelper
public static function removeFile(string $path): void
{
$path = \ltrim(\urldecode($path), '/');
if (!str_starts_with($path, 'storage')) {
if (\strpos($path, 'storage') !== 0) {
return;
}
$path = ToolboxHelper::mbReplace('storage/', '', $path);
@ -116,10 +115,10 @@ class ToolboxHelper
public static function assertFieldIsUnique(
string $table,
string $field,
mixed $value,
$value,
?int $id = null,
?callable $query = null
): void {
) {
if (!$query) {
Validator::make([$field => $value], [
self::mbReplace('.', '\.', $field) => Rule::unique($table, $field)->ignore($id),
@ -149,7 +148,7 @@ class ToolboxHelper
* @param integer $count
* @return mixed
*/
public static function mbReplace(mixed $search, mixed $replace, mixed $subject, int &$count = 0): mixed
public static function mbReplace($search, $replace, $subject, int &$count = 0)
{
if (!is_array($search) && is_array($replace)) {
return false;
@ -230,7 +229,7 @@ class ToolboxHelper
]);
}
return $match;
} catch (NotFoundHttpException) {
} catch (NotFoundHttpException $e) {
return $match;
}
},
@ -238,49 +237,4 @@ 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']);
}
}

View file

@ -31,6 +31,13 @@ class SendContactMail extends Mailable
use Queueable;
use SerializesModels;
/**
* The form data.
*
* @var $data
*/
protected $data;
/**
* The joined file name
*
@ -44,8 +51,9 @@ class SendContactMail extends Mailable
* @param mixed $data
* @return void
*/
public function __construct(protected $data)
public function __construct($data)
{
$this->data = $data;
}
/**

View file

@ -15,7 +15,6 @@ class BasicBanner extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'picture',
@ -29,13 +28,13 @@ class BasicBanner extends Model
*/
protected static function boot()
{
static::creating(function (BasicBanner $banner): void {
static::creating(function (BasicBanner $banner) {
if ($banner->picture) {
$banner->picture = ToolboxHelper::storeImage($banner->picture, $banner->getTable());
}
});
static::updating(function (BasicBanner $banner): void {
static::updating(function (BasicBanner $banner) {
if ($banner->picture) {
$banner->picture = ToolboxHelper::storeImage($banner->picture, $banner->getTable());
}

View file

@ -14,7 +14,6 @@ class BasicTable extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',

View file

@ -14,7 +14,6 @@ class Contact extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'hook',

View file

@ -14,7 +14,6 @@ class Faq extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',

View file

@ -16,7 +16,6 @@ class Gamme extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'parent_gamme_id',
'title',
@ -38,22 +37,22 @@ class Gamme extends Model
*/
protected static function boot(): void
{
static::creating(function (Gamme $gamme): void {
static::creating(function (Gamme $gamme) {
$gamme->updateImages($gamme);
});
static::updating(function (Gamme $gamme): void {
static::updating(function (Gamme $gamme) {
$gamme->updateImages($gamme);
});
static::deleting(function (Gamme $gamme): void {
static::deleting(function (Gamme $gamme) {
if ($gamme->childGammes()->exists()) {
Gamme::whereParentGammeId($gamme->id)
->update(['parent_gamme_id' => null]);
}
});
static::deleted(function (Gamme $gamme): void {
static::deleted(function (Gamme $gamme) {
$gamme->deleteImages($gamme->picture1);
$gamme->deleteImages($gamme->picture2);
$gamme->deleteImages($gamme->picture3);

View file

@ -14,7 +14,6 @@ class GammeHook extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'subtitle',

View file

@ -15,7 +15,6 @@ class HomepageHook extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'subtitle',
@ -31,13 +30,13 @@ class HomepageHook extends Model
*/
protected static function boot()
{
static::creating(function (HomepageHook $homepagehook): void {
static::creating(function (HomepageHook $homepagehook) {
if ($homepagehook->picture) {
$homepagehook->picture = ToolboxHelper::storeImage($homepagehook->picture, $homepagehook->getTable());
}
});
static::updating(function (HomepageHook $homepagehook): void {
static::updating(function (HomepageHook $homepagehook) {
if ($homepagehook->picture) {
$homepagehook->picture = ToolboxHelper::storeImage($homepagehook->picture, $homepagehook->getTable());
}

View file

@ -15,7 +15,6 @@ class HomepageNewscast extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'picture',
@ -33,7 +32,7 @@ class HomepageNewscast extends Model
*/
protected static function boot()
{
static::creating(function (HomepageNewscast $homepagenewscast): void {
static::creating(function (HomepageNewscast $homepagenewscast) {
if ($homepagenewscast->picture) {
$homepagenewscast->picture = ToolboxHelper::storeImage(
$homepagenewscast->picture,
@ -42,7 +41,7 @@ class HomepageNewscast extends Model
}
});
static::updating(function (HomepageNewscast $homepagenewscast): void {
static::updating(function (HomepageNewscast $homepagenewscast) {
if ($homepagenewscast->picture) {
$homepagenewscast->picture = ToolboxHelper::storeImage(
$homepagenewscast->picture,

View file

@ -15,7 +15,6 @@ class HomepageSlide extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'picture',
@ -30,7 +29,6 @@ class HomepageSlide extends Model
*
* @var array
*/
#[\Override]
protected $casts = [
'new_tab' => 'bool',
'status' => 'bool',
@ -43,11 +41,11 @@ class HomepageSlide extends Model
*/
protected static function booted()
{
static::creating(function (HomepageSlide $slide): void {
static::creating(function (HomepageSlide $slide) {
self::manageFields($slide);
});
static::updating(function (HomepageSlide $slide): void {
static::updating(function (HomepageSlide $slide) {
self::manageFields($slide);
});
}

View file

@ -15,7 +15,6 @@ class HomepageWhoarewe extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'subtitle',
@ -33,7 +32,7 @@ class HomepageWhoarewe extends Model
*/
protected static function boot()
{
static::creating(function (HomepageWhoarewe $whoarewe): void {
static::creating(function (HomepageWhoarewe $whoarewe) {
if ($whoarewe->picture1) {
$whoarewe->picture1 = ToolboxHelper::storeImage($whoarewe->picture1, $whoarewe->getTable());
}
@ -42,7 +41,7 @@ class HomepageWhoarewe extends Model
}
});
static::updating(function (HomepageWhoarewe $whoarewe): void {
static::updating(function (HomepageWhoarewe $whoarewe) {
if ($whoarewe->picture1) {
$whoarewe->picture1 = ToolboxHelper::storeImage($whoarewe->picture1, $whoarewe->getTable());
}

View file

@ -16,7 +16,6 @@ class Product extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'gamme_id',
'name',
@ -44,15 +43,15 @@ class Product extends Model
*/
protected static function boot(): void
{
static::creating(function (Product $product): void {
static::creating(function (Product $product) {
$product->updateImages($product);
});
static::updating(function (Product $product): void {
static::updating(function (Product $product) {
$product->updateImages($product);
});
static::deleted(function (Product $product): void {
static::deleted(function (Product $product) {
$product->deleteImages($product, $product->picture1);
$product->deleteImages($product, $product->picture2);
$product->deleteImages($product, $product->picture3);

View file

@ -17,7 +17,6 @@ class User extends Authenticatable
*
* @var array<int, string>
*/
#[\Override]
protected $fillable = [
'name',
'email',
@ -29,7 +28,6 @@ class User extends Authenticatable
*
* @var array<int, string>
*/
#[\Override]
protected $hidden = [
'password',
'remember_token',
@ -40,7 +38,6 @@ class User extends Authenticatable
*
* @var array<string, string>
*/
#[\Override]
protected $casts = [
'email_verified_at' => 'datetime',
];
@ -52,13 +49,13 @@ class User extends Authenticatable
*/
protected static function boot()
{
static::creating(function (User $user): void {
static::creating(function (User $user) {
if (Hash::needsRehash($user->password)) {
$user->password = Hash::make($user->password);
}
});
static::updating(function (User $user): void {
static::updating(function (User $user) {
if (Hash::needsRehash($user->password)) {
$user->password = Hash::make($user->password);
}

View file

@ -15,7 +15,6 @@ class WhoareweBrand extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',
@ -35,7 +34,7 @@ class WhoareweBrand extends Model
*/
protected static function boot()
{
static::creating(function (WhoareweBrand $whoarewebrand): void {
static::creating(function (WhoareweBrand $whoarewebrand) {
if ($whoarewebrand->picture1) {
$whoarewebrand->picture1 = ToolboxHelper::storeImage(
$whoarewebrand->picture1,
@ -50,7 +49,7 @@ class WhoareweBrand extends Model
}
});
static::updating(function (WhoareweBrand $whoarewebrand): void {
static::updating(function (WhoareweBrand $whoarewebrand) {
if ($whoarewebrand->picture1) {
$whoarewebrand->picture1 = ToolboxHelper::storeImage(
$whoarewebrand->picture1,

View file

@ -14,7 +14,6 @@ class WhoareweBrandDetail extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
];

View file

@ -15,7 +15,6 @@ class WhoareweContact extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',
@ -33,7 +32,7 @@ class WhoareweContact extends Model
*/
protected static function boot()
{
static::creating(function (WhoareweContact $whoarewecontact): void {
static::creating(function (WhoareweContact $whoarewecontact) {
if ($whoarewecontact->picture) {
$whoarewecontact->picture = ToolboxHelper::storeImage(
$whoarewecontact->picture,
@ -42,7 +41,7 @@ class WhoareweContact extends Model
}
});
static::updating(function (WhoareweContact $whoarewecontact): void {
static::updating(function (WhoareweContact $whoarewecontact) {
if ($whoarewecontact->picture) {
$whoarewecontact->picture = ToolboxHelper::storeImage(
$whoarewecontact->picture,

View file

@ -15,7 +15,6 @@ class WhoareweDescription extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',
@ -32,7 +31,7 @@ class WhoareweDescription extends Model
*/
protected static function boot()
{
static::creating(function (WhoareweDescription $whoarewedescription): void {
static::creating(function (WhoareweDescription $whoarewedescription) {
if ($whoarewedescription->picture1) {
$whoarewedescription->picture1 = ToolboxHelper::storeImage(
$whoarewedescription->picture1,
@ -47,7 +46,7 @@ class WhoareweDescription extends Model
}
});
static::updating(function (WhoareweDescription $whoarewedescription): void {
static::updating(function (WhoareweDescription $whoarewedescription) {
if ($whoarewedescription->picture1) {
$whoarewedescription->picture1 = ToolboxHelper::storeImage(
$whoarewedescription->picture1,

View file

@ -14,7 +14,6 @@ class WhoareweExpertise extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'text',
];

View file

@ -14,7 +14,6 @@ class WhoareweExpertiseDetail extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
];

View file

@ -15,7 +15,6 @@ class WhoareweIcon extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'text',
'picture',
@ -29,13 +28,13 @@ class WhoareweIcon extends Model
*/
protected static function boot()
{
static::creating(function (WhoareweIcon $whoareweicon): void {
static::creating(function (WhoareweIcon $whoareweicon) {
if ($whoareweicon->picture) {
$whoareweicon->picture = ToolboxHelper::storeImage($whoareweicon->picture, $whoareweicon->getTable());
}
});
static::updating(function (WhoareweIcon $whoareweicon): void {
static::updating(function (WhoareweIcon $whoareweicon) {
if ($whoareweicon->picture) {
$whoareweicon->picture = ToolboxHelper::storeImage($whoareweicon->picture, $whoareweicon->getTable());
}

View file

@ -15,7 +15,6 @@ class WhoareweIconDetail extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'picture',
@ -29,13 +28,13 @@ class WhoareweIconDetail extends Model
*/
protected static function boot()
{
static::creating(function (WhoareweIconDetail $whoarewe): void {
static::creating(function (WhoareweIconDetail $whoarewe) {
if ($whoarewe->picture) {
$whoarewe->picture = ToolboxHelper::storeImage($whoarewe->picture, $whoarewe->getTable());
}
});
static::updating(function (WhoareweIconDetail $whoarewe): void {
static::updating(function (WhoareweIconDetail $whoarewe) {
if ($whoarewe->picture) {
$whoarewe->picture = ToolboxHelper::storeImage($whoarewe->picture, $whoarewe->getTable());
}

View file

@ -15,7 +15,6 @@ class WhoareweKnow extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',
@ -31,13 +30,13 @@ class WhoareweKnow extends Model
*/
protected static function boot()
{
static::creating(function (WhoareweKnow $whoareweknow): void {
static::creating(function (WhoareweKnow $whoareweknow) {
if ($whoareweknow->picture) {
$whoareweknow->picture = ToolboxHelper::storeImage($whoareweknow->picture, $whoareweknow->getTable());
}
});
static::updating(function (WhoareweKnow $whoareweknow): void {
static::updating(function (WhoareweKnow $whoareweknow) {
if ($whoareweknow->picture) {
$whoareweknow->picture = ToolboxHelper::storeImage($whoareweknow->picture, $whoareweknow->getTable());
}

View file

@ -2,25 +2,27 @@
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(): void
public function boot()
{
// * 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());
}
}

View file

@ -11,7 +11,6 @@ class AuthServiceProvider extends ServiceProvider
*
* @var array<class-string, class-string>
*/
#[\Override]
protected $policies = [];
/**

View file

@ -13,7 +13,6 @@ class EventServiceProvider extends ServiceProvider
*
* @var array<class-string, array<int, class-string>>
*/
#[\Override]
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,

View file

@ -30,7 +30,7 @@ class RouteServiceProvider extends ServiceProvider
{
$this->configureRateLimiting();
$this->routes(function (): void {
$this->routes(function () {
Route::prefix('api')
->middleware('api')
->namespace($this->namespace)
@ -53,6 +53,8 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function configureRateLimiting()
{
RateLimiter::for('api', fn(Request $request) => Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()));
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
});
}
}

View file

@ -12,7 +12,7 @@
*/
$app = new Illuminate\Foundation\Application(
\Illuminate\Support\Env::get('APP_BASE_PATH', dirname(__DIR__))
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
/*

View file

@ -1,94 +1,84 @@
{
"name": "uwil/domaine-de-lanvaux",
"type": "project",
"description": "domaine-de-lanvaux website",
"keywords": [
"framework",
"laravel"
],
"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": "*"
},
"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"
}
"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"
],
"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"
]
},
"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"
}
}
}

7746
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +0,0 @@
<?php
return [
'cidrList' => env('UWIL_ADMIN_SECURE_CIDR_LIST'),
'cidrProjectAllowedList' => env('UWIL_ADMIN_SECURE_CIDR_PROJECT_ALLOWED_LIST')
];

View file

@ -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'),
]) : [],
],

View file

@ -13,7 +13,7 @@ return [
|
*/
'default' => env('FILESYSTEM_DISK', 'local'),
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------

104
config/refresh-sitemap.php Normal file
View file

@ -0,0 +1,104 @@
<?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 * * *'
];

View file

@ -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::sentryEventHandler(...),
'before_send' => [\App\Lib\Helpers\ExceptionsHelper::class, 'sentryEventHandler'],
];

View file

@ -18,11 +18,4 @@ 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
]
],
];

View file

@ -17,7 +17,7 @@ class GammeFactory extends Factory
*/
public function definition()
{
$title = $this->faker->text(10) . random_int(1, 100);
$title = $this->faker->text(10) . rand(1, 100);
$picture = new Gamme();
$upload = new SplFileInfo(resource_path('assets/images/gammes/rillettes.png'));

View file

@ -17,62 +17,62 @@ class ProductFactory extends Factory
*/
public function definition()
{
$name = $this->faker->text(10) . random_int(1, 100);
$tabFour = [
$name = $this->faker->text(10) . rand(1, 100);
$tabFour = array(
'id' => 0,
'name' => 'Four',
'url' => '/assets/images/produits_details/four.png',
'time' => '1h30mins.',
'temp' => '200°C',
'status' => true
];
$tabFriteuse = [
);
$tabFriteuse = array(
'id' => 1,
'name' => 'Friteuse',
'url' => '/assets/images/produits_details/friteuse.png',
'time' => '15mins',
'temp' => '100°C',
'status' => true
];
$tabPoele = [
);
$tabPoele = array(
'id' => 2,
'name' => 'Poêle',
'url' => '/assets/images/produits_details/poele.png',
'time' => '5mins sur chaque face',
'temp' => '100°C',
'status' => false
];
$tabCocotte = [
);
$tabCocotte = array(
'id' => 3,
'name' => 'Cocotte',
'url' => '/assets/images/produits_details/cocotte.png',
'time' => '3h',
'temp' => '80°C',
'status' => false
];
$tabPlancha = [
);
$tabPlancha = array(
'id' => 4,
'name' => 'Plancha',
'url' => '/assets/images/produits_details/plancha.png',
'time' => '20mins',
'temp' => '130°C',
'status' => true
];
$tabPlusProduit1 = [
);
$tabPlusProduit1 = array(
'id' => 0,
'name' => 'Lorem ipsum set doloris',
'url' => '',
];
$tabPlusProduit2 = [
);
$tabPlusProduit2 = array(
'id' => 1,
'name' => 'Lorem ipsum set doloris',
'url' => '',
];
$tabPlusProduit3 = [
);
$tabPlusProduit3 = array(
'id' => 2,
'name' => 'Lorem ipsum set doloris',
'url' => '',
];
);
$upload = new SplFileInfo(resource_path('assets/images/gammes/rillettes.png'));
$picture = new Product();

View file

@ -32,8 +32,10 @@ class UserFactory extends Factory
public function unverified()
{
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
return $this->state(fn(array $attributes) => [
'email_verified_at' => null,
]);
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('users', function (Blueprint $table): void {
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
@ -23,6 +23,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -32,4 +33,4 @@ return new class extends Migration
{
Schema::dropIfExists('users');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
@ -13,12 +13,13 @@ return new class extends Migration
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table): void {
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
@ -28,4 +29,4 @@ return new class extends Migration
{
Schema::dropIfExists('password_resets');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table): void {
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
@ -23,6 +23,7 @@ return new class extends Migration
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
@ -32,4 +33,4 @@ return new class extends Migration
{
Schema::dropIfExists('failed_jobs');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateGammesTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('gammes', function (Blueprint $table): void {
Schema::create('gammes', function (Blueprint $table) {
$table->id();
$table->text('title');
$table->string('slug')->unique();
@ -27,6 +27,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -36,4 +37,4 @@ return new class extends Migration
{
Schema::dropIfExists('gammes');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class AlterGammesTable extends Migration
{
/**
* Run the migrations.
@ -13,11 +13,12 @@ return new class extends Migration
*/
public function up()
{
Schema::table('gammes', function (Blueprint $table): void {
Schema::table('gammes', function (Blueprint $table) {
$table->unsignedBigInteger('parent_gamme_id')->nullable()->after('id');
$table->foreign('parent_gamme_id')->references('id')->on('gammes');
});
}
/**
* Reverse the migrations.
*
@ -25,8 +26,8 @@ return new class extends Migration
*/
public function down()
{
Schema::table('gammes', function (Blueprint $table): void {
Schema::table('gammes', function (Blueprint $table) {
$table->dropColumn('parent_gamme_id');
});
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateProductsTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('products', function (Blueprint $table): void {
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->foreignId('gamme_id')->nullable()->constrained();
$table->text('name');
@ -33,6 +33,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -42,4 +43,4 @@ return new class extends Migration
{
Schema::dropIfExists('products');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateBasicTablesTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('basic_tables', function (Blueprint $table): void {
Schema::create('basic_tables', function (Blueprint $table) {
$table->id();
$table->text('title');
$table->string('slug');
@ -21,6 +21,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -30,4 +31,4 @@ return new class extends Migration
{
Schema::dropIfExists('basic_tables');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateHomepageSlidesTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('homepage_slides', function (Blueprint $table): void {
Schema::create('homepage_slides', function (Blueprint $table) {
$table->id();
$table->text('title');
$table->string('picture')->nullable();
@ -23,6 +23,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -32,4 +33,4 @@ return new class extends Migration
{
Schema::dropIfExists('homepage_slides');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateHomepageNewscastsTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('homepage_newscasts', function (Blueprint $table): void {
Schema::create('homepage_newscasts', function (Blueprint $table) {
$table->id();
$table->text('title');
$table->string('picture')->nullable();
@ -27,6 +27,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -36,4 +37,4 @@ return new class extends Migration
{
Schema::dropIfExists('homepage_newscasts');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateHomepageWhoarewesTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('homepage_whoarewes', function (Blueprint $table): void {
Schema::create('homepage_whoarewes', function (Blueprint $table) {
$table->id();
$table->text('slug');
$table->text('title');
@ -27,6 +27,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -36,4 +37,4 @@ return new class extends Migration
{
Schema::dropIfExists('homepage_whoarewes');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateBasicBannersTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('basic_banners', function (Blueprint $table): void {
Schema::create('basic_banners', function (Blueprint $table) {
$table->id();
$table->text('slug');
$table->text('title');
@ -23,6 +23,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -32,4 +33,4 @@ return new class extends Migration
{
Schema::dropIfExists('basic_banners');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateHomepageHooksTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('homepage_hooks', function (Blueprint $table): void {
Schema::create('homepage_hooks', function (Blueprint $table) {
$table->id();
$table->text('slug');
$table->text('title');
@ -25,6 +25,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -34,4 +35,4 @@ return new class extends Migration
{
Schema::dropIfExists('homepage_hooks');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateWhoareweDescriptionsTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('whoarewe_descriptions', function (Blueprint $table): void {
Schema::create('whoarewe_descriptions', function (Blueprint $table) {
$table->id();
$table->text('slug');
$table->text('title');
@ -26,6 +26,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -35,4 +36,4 @@ return new class extends Migration
{
Schema::dropIfExists('whoarewe_descriptions');
}
};
}

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
class CreateWhoareweIconDetailsTable extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ return new class extends Migration
*/
public function up()
{
Schema::create('whoarewe_icon_details', function (Blueprint $table): void {
Schema::create('whoarewe_icon_details', function (Blueprint $table) {
$table->id();
$table->text('slug');
$table->text('title');
@ -23,6 +23,7 @@ return new class extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -32,4 +33,4 @@ return new class extends Migration
{
Schema::dropIfExists('whoarewe_icon_details');
}
};
}

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