feat: rector to php 8.5

This commit is contained in:
Vincent BRIDIER 2026-10-27 09:12:51 +01:00
parent bb85ddc390
commit ae974764c2
98 changed files with 652 additions and 452 deletions

View file

@ -13,6 +13,7 @@ class UserCreate extends Command
*
* @var string
*/
#[\Override]
protected $signature = 'user:create';
/**
@ -20,6 +21,7 @@ class UserCreate extends Command
*
* @var string
*/
#[\Override]
protected $description = 'Create a backend user';
/**

View file

@ -12,6 +12,7 @@ class Kernel extends ConsoleKernel
*
* @var array
*/
#[\Override]
protected $commands = [];
/**

View file

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

View file

@ -43,11 +43,11 @@ class AdviceController extends Controller
}
if (!$advice->saveOrFail()) {
return redirect()->route('bo.advice.edit', $advice->id)
return to_route('bo.advice.edit', $advice->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.advice.edit', $advice->id)
return to_route('bo.advice.edit', $advice->id)
->with('success', trans('Modifications enregistrées !'));
}
}

View file

@ -37,11 +37,11 @@ class EncartsController extends Controller
}
if (!$encart->saveOrFail()) {
return redirect()->route('bo.encarts.edit', $encart->id)
return to_route('bo.encarts.edit', $encart->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.encarts.edit', $encart->id)
return to_route('bo.encarts.edit', $encart->id)
->with('success', trans('Modifications enregistrées !'));
}
}

View file

@ -25,7 +25,7 @@ class GammesController extends Controller
foreach ($dbGammes as $gamme) {
$gammes->push($gamme);
$gamme->childGammes->sortBy('title')
->map(function (Gamme $childGamme) use (&$gammes) {
->map(function (Gamme $childGamme) use (&$gammes): void {
$gammes->push($childGamme);
});
}
@ -69,9 +69,9 @@ class GammesController extends Controller
}
if (!$gamme->saveOrFail()) {
return redirect()->route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee');
return to_route('bo.gammes.edit', $gamme->id)->with('error', 'L\'actualité n\'a pas été créee');
}
return redirect()->route('bo.gammes.edit', $gamme->id)->with('success', 'Gamme créée !');
return to_route('bo.gammes.edit', $gamme->id)->with('success', 'Gamme créée !');
}
/**
@ -111,11 +111,11 @@ class GammesController extends Controller
}
if (!$gamme->saveOrFail()) {
return redirect()->route('bo.gammes.edit', $gamme->id)
return to_route('bo.gammes.edit', $gamme->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.gammes.edit', $gamme->id)
return to_route('bo.gammes.edit', $gamme->id)
->with('success', trans('Modifications enregistrées !'));
}
@ -128,9 +128,9 @@ class GammesController extends Controller
public function destroy(Gamme $gamme)
{
if (!$gamme->delete()) {
return redirect()->route('bo.gammes.index')->with('error', trans('La suppression a échoué'));
return to_route('bo.gammes.index')->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.gammes.index')->with('success', trans('Suppression faite avec succès'));
return to_route('bo.gammes.index')->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -49,11 +49,11 @@ class MomentsController extends Controller
}
if (!$moment->saveOrFail()) {
return redirect()->route('bo.moments.edit', $moment->id)
return to_route('bo.moments.edit', $moment->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.moments.edit', $moment->id)
return to_route('bo.moments.edit', $moment->id)
->with('success', trans('Modifications enregistrées !'));
}
}

View file

@ -49,10 +49,10 @@ class PictoBrandsController extends Controller
}
if (!$pictobrand->saveOrFail()) {
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
return to_route('bo.pictobrands.edit', $pictobrand->id)
->with('error', 'Le pictogramme n\'a pas été crée');
}
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
return to_route('bo.pictobrands.edit', $pictobrand->id)
->with('success', 'Pictogramme créé !');
}
@ -84,11 +84,11 @@ class PictoBrandsController extends Controller
}
if (!$pictobrand->saveOrFail()) {
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
return to_route('bo.pictobrands.edit', $pictobrand->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.pictobrands.edit', $pictobrand->id)
return to_route('bo.pictobrands.edit', $pictobrand->id)
->with('success', trans('Modifications enregistrées !'));
}
@ -101,9 +101,9 @@ class PictoBrandsController extends Controller
public function destroy(PictoBrand $pictobrand)
{
if (!$pictobrand->delete()) {
return redirect()->route('bo.pictobrands.index')->with('error', trans('La suppression a échoué'));
return to_route('bo.pictobrands.index')->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.pictobrands.index')->with('success', trans('Suppression faite avec succès'));
return to_route('bo.pictobrands.index')->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -55,9 +55,9 @@ class PictosController extends Controller
$picto->page = Page::marqueBloc2();
if (!$picto->saveOrFail()) {
return redirect()->route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée');
return to_route('bo.pictos.edit', $picto->id)->with('error', 'Le pictogramme n\'a pas été crée');
}
return redirect()->route('bo.pictos.edit', $picto->id)->with('success', 'Pictogramme créé !');
return to_route('bo.pictos.edit', $picto->id)->with('success', 'Pictogramme créé !');
}
/**
@ -88,11 +88,11 @@ class PictosController extends Controller
}
if (!$picto->saveOrFail()) {
return redirect()->route('bo.pictos.edit', $picto->id)
return to_route('bo.pictos.edit', $picto->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.pictos.edit', $picto->id)
return to_route('bo.pictos.edit', $picto->id)
->with('success', trans('Modifications enregistrées !'));
}
@ -105,11 +105,11 @@ class PictosController extends Controller
public function destroy(Picto $picto)
{
if (!$picto->delete()) {
return redirect()->route('bo.pictos.content', $picto->page)
return to_route('bo.pictos.content', $picto->page)
->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.pictos.content', $picto->page)
return to_route('bo.pictos.content', $picto->page)
->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -55,9 +55,9 @@ class PostsController extends Controller
$response = $post->saveOrFail();
}
if (!$response) {
return redirect()->route('bo.posts.edit', $post->id)->with('error', 'L\'actualité n\'a pas été créee');
return to_route('bo.posts.edit', $post->id)->with('error', 'L\'actualité n\'a pas été créee');
}
return redirect()->route('bo.posts.edit', $post->id)->with('success', 'Actualité créée !');
return to_route('bo.posts.edit', $post->id)->with('success', 'Actualité créée !');
}
/**
@ -95,11 +95,11 @@ class PostsController extends Controller
$response = $post->saveOrFail();
}
if (!$response) {
return redirect()->route('bo.posts.edit', $post->id)
return to_route('bo.posts.edit', $post->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.posts.edit', $post->id)
return to_route('bo.posts.edit', $post->id)
->with('success', trans('Modifications enregistrées !'));
}
@ -112,10 +112,10 @@ class PostsController extends Controller
public function destroy(Post $post)
{
if (!$post->delete()) {
return redirect()->route('bo.posts.index')->with('error', trans('La suppression a échoué'));
return to_route('bo.posts.index')->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.posts.index')->with('success', trans('Suppression faite avec succès'));
return to_route('bo.posts.index')->with('success', trans('Suppression faite avec succès'));
}
/**

View file

@ -36,93 +36,93 @@ class ProductsController extends Controller
{
$gammes = Gamme::all()->sortBy('title');
// Default structure + produits.
$tabFour = array(
$tabFour = [
'id' => 0,
'name' => 'Four',
'url' => '/assets/images/four.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabFriteuse = array(
];
$tabFriteuse = [
'id' => 1,
'name' => 'Friteuse',
'url' => '/assets/images/friteuse.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabPoele = array(
];
$tabPoele = [
'id' => 2,
'name' => 'Poêle',
'url' => '/assets/images/poele.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabCocotte = array(
];
$tabCocotte = [
'id' => 3,
'name' => 'Cocotte',
'url' => '/assets/images/cocotte.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabPlancha = array(
];
$tabPlancha = [
'id' => 4,
'name' => 'Plancha',
'url' => '/assets/images/plancha.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabBainMarie = array(
];
$tabBainMarie = [
'id' => 5,
'name' => 'Bain Marie',
'url' => '/assets/images/bainmarie.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabBarbecue = array(
];
$tabBarbecue = [
'id' => 6,
'name' => 'Barbecue',
'url' => '/assets/images/barbecue.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabMicroOndes = array(
];
$tabMicroOndes = [
'id' => 7,
'name' => 'Micro Ondes',
'url' => '/assets/images/microondes.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabCasserole = array(
];
$tabCasserole = [
'id' => 8,
'name' => 'Casserole',
'url' => '/assets/images/casserole.png',
'time' => '',
'temp' => '',
'status' => false
);
$tabPlusProduit1 = array(
];
$tabPlusProduit1 = [
'id' => 0,
'name' => '',
'url' => '',
);
$tabPlusProduit2 = array(
];
$tabPlusProduit2 = [
'id' => 1,
'name' => '',
'url' => '',
);
$tabPlusProduit3 = array(
];
$tabPlusProduit3 = [
'id' => 2,
'name' => '',
'url' => '',
);
];
//phpcs:ignore Generic.Files.LineLength.TooLong
$product->pictos = json_encode([$tabFour, $tabFriteuse, $tabPoele, $tabCocotte, $tabPlancha, $tabBainMarie, $tabBarbecue, $tabMicroOndes, $tabCasserole]);
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
@ -153,12 +153,9 @@ class ProductsController extends Controller
$product->plusproduit = json_encode($plusproduit);
if (!$product->saveOrFail()) {
return redirect()->route(
'bo.products.edit',
$product->id
)->with('error', 'Le produit n\'a pas été crée');
return to_route('bo.products.edit', $product->id)->with('error', 'Le produit n\'a pas été crée');
}
return redirect()->route('bo.products.edit', $product->id)->with('success', 'Produit créé !');
return to_route('bo.products.edit', $product->id)->with('success', 'Produit créé !');
}
/**
@ -210,11 +207,11 @@ class ProductsController extends Controller
// Encodage avant save.
$product->plusproduit = json_encode($plusproduit);
if (!$product->saveOrFail()) {
return redirect()->route('bo.products.edit', $product->id)
return to_route('bo.products.edit', $product->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.products.edit', $product->id)
return to_route('bo.products.edit', $product->id)
->with('success', trans('Modifications enregistrées !'));
}
@ -227,9 +224,9 @@ class ProductsController extends Controller
public function destroy(Product $product)
{
if (!$product->delete()) {
return redirect()->route('bo.products.index')->with('error', trans('La suppression a échoué'));
return to_route('bo.products.index')->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.products.index')->with('success', trans('Suppression faite avec succès'));
return to_route('bo.products.index')->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -33,7 +33,7 @@ class SeoDataController extends Controller
$SeoDatum->fill($request->validated());
$SeoDatum->save();
return redirect()->route('bo.seo_data.edit', $SeoDatum->page)
return to_route('bo.seo_data.edit', $SeoDatum->page)
->with('success', trans('Modifications enregistrées !'));
}
}

View file

@ -45,9 +45,9 @@ class SlidersController extends Controller
$slider = new Slider($request->validated());
if (!$slider->saveOrFail()) {
return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'Le slider n\'a pas été crée');
return to_route('bo.sliders.edit', $slider->id)->with('error', 'Le slider n\'a pas été crée');
}
return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Slider créé !');
return to_route('bo.sliders.edit', $slider->id)->with('success', 'Slider créé !');
}
/**
@ -75,10 +75,10 @@ class SlidersController extends Controller
$slider->fill($request->validated());
if (!$slider->saveOrFail()) {
return redirect()->route('bo.sliders.edit', $slider->id)->with('error', 'La modification a échoué');
return to_route('bo.sliders.edit', $slider->id)->with('error', 'La modification a échoué');
}
return redirect()->route('bo.sliders.edit', $slider->id)->with('success', 'Modifications enregistrées !');
return to_route('bo.sliders.edit', $slider->id)->with('success', 'Modifications enregistrées !');
}
/**
@ -92,12 +92,12 @@ class SlidersController extends Controller
$count = Slider::count();
if ($count === 1) {
return redirect()->back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider");
return back()->withErrors("Suppression impossible : Vous devez conserver au moins 1 Slider");
}
if (!$slider->delete()) {
return redirect()->route('bo.sliders.index')->with('error', trans('La suppression a échoué'));
return to_route('bo.sliders.index')->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.sliders.index')->with('success', trans('Suppression faite avec succès'));
return to_route('bo.sliders.index')->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -52,7 +52,7 @@ class SlidesController extends Controller
$slide->saveOrFail();
return redirect()->route('bo.slides.edit', $slide->id)->with('success', 'Slide créé !');
return to_route('bo.slides.edit', $slide->id)->with('success', 'Slide créé !');
}
/**
@ -84,10 +84,10 @@ class SlidesController extends Controller
}
if (!$slide->saveOrFail()) {
return redirect()->route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué'));
return to_route('bo.slides.edit', $slide->id)->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !'));
return to_route('bo.slides.edit', $slide->id)->with('success', trans('Modifications enregistrées !'));
}
/**
@ -99,10 +99,10 @@ class SlidesController extends Controller
public function destroy(Slide $slide)
{
if (!$slide->delete()) {
return redirect()->route('bo.slides.index')->with('error', trans('La suppression a échoué'));
return to_route('bo.slides.index')->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.slides.index')->with('success', trans('Suppression faite avec succès'));
return to_route('bo.slides.index')->with('success', trans('Suppression faite avec succès'));
}
/**

View file

@ -46,12 +46,10 @@ class TextsController extends Controller
$text->page = Page::newsQuestions();
if (!$text->saveOrFail()) {
return redirect()
->route('bo.texts.edit', $text->id)
return to_route('bo.texts.edit', $text->id)
->with('error', 'La question/réponse n\'a pas été créée');
}
return redirect()
->route('bo.texts.edit', $text->id)
return to_route('bo.texts.edit', $text->id)
->with('success', 'Question/réponse créée !');
}
@ -80,11 +78,11 @@ class TextsController extends Controller
$text->fill($request->validated());
if (!$text->saveOrFail()) {
return redirect()->route('bo.texts.edit', $text->id)
return to_route('bo.texts.edit', $text->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.texts.edit', $text->id)
return to_route('bo.texts.edit', $text->id)
->with('success', trans('Modifications enregistrées !'));
}
@ -97,11 +95,11 @@ class TextsController extends Controller
public function destroy(Text $text)
{
if (!$text->delete()) {
return redirect()->route('bo.texts.content', $text->page)
return to_route('bo.texts.content', $text->page)
->with('error', trans('La suppression a échoué'));
}
return redirect()->route('bo.texts.content', $text->page)
return to_route('bo.texts.content', $text->page)
->with('success', trans('Suppression faite avec succès'));
}
}

View file

@ -33,11 +33,11 @@ class TitlesController extends Controller
$title->fill($request->validated());
if (!$title->saveOrFail()) {
return redirect()->route('bo.titles.edit', $title->id)
return to_route('bo.titles.edit', $title->id)
->with('error', trans('La modification a échoué'));
}
return redirect()->route('bo.titles.edit', $title->id)
return to_route('bo.titles.edit', $title->id)
->with('success', trans('Modifications enregistrées !'));
}
}

View file

@ -18,13 +18,9 @@ class ContactController extends Controller
*/
public function contact()
{
$listCountries = Cache::remember('listCountries', 86400, function () {
return Country::toArray();
});
$listCountries = Cache::remember('listCountries', 86400, fn() => Country::toArray());
$listDeps = Cache::remember('listDeps', 86400, function () {
return Department::toArray();
});
$listDeps = Cache::remember('listDeps', 86400, fn() => Department::toArray());
return view('front.contact', compact('listCountries', 'listDeps'));
}
@ -47,7 +43,7 @@ class ContactController extends Controller
Mail::to(config('mail.contactsList.contactform'))->send(new SendContactMail($data->all()));
$lang = session()->get('lang', config('app.locale'));
return redirect()->route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")
return to_route(session()->get('lang', config('app.locale')) === 'fr' ? 'contact' : $lang . ".contact")
->with('status', true);
}
}

View file

@ -45,7 +45,7 @@ class GammesController extends Controller
foreach ($dbGammes as $dbGamme) {
$gammes->push($dbGamme->id);
$dbGamme->childGammes->sortBy('title')
->map(function (Gamme $childGamme) use (&$gammes) {
->map(function (Gamme $childGamme) use (&$gammes): void {
$gammes->push($childGamme->id);
});
}

View file

@ -26,15 +26,15 @@ class HomeController extends Controller
$slider = Slider::where('published', 1)->first();
if ($slider) {
$slides = Slide::whereHas('slider', function ($q) use ($slider) {
$slides = Slide::whereHas('slider', function (\Illuminate\Contracts\Database\Query\Builder $q) use ($slider): void {
$q->whereId($slider->id);
})->where(function ($q) {
})->where(function ($q): void {
$q->where(
function ($q) {
$q->where('date_start', '<=', Carbon::now()->format('Y-m-d H:i:s'))
->where('date_end', '>', Carbon::now()->format('Y-m-d H:i:s'));
function ($q): void {
$q->where('date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s'))
->where('date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s'));
}
)->orWhere(function ($q) {
)->orWhere(function ($q): void {
$q->whereNull('date_start')
->whereNull('date_end');
});
@ -47,8 +47,8 @@ class HomeController extends Controller
$encart_home = Encart::where('page', Page::homeHeader()->value)->first();
$post_home = Post::where([
['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')],
['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')],
['date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
['date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
['on_top', true]
])->first();
// Limitation à 3 produits affichés sur la homepage.

View file

@ -28,8 +28,8 @@ class NewsController extends Controller
$title_newsPosts = Title::where('page', Page::newsPosts()->value)->first();
$posts = Post::where([
['date_start', '<=', Carbon::now()->format('Y-m-d H:i:s')],
['date_end', '>', Carbon::now()->format('Y-m-d H:i:s')],
['date_start', '<=', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
['date_end', '>', \Illuminate\Support\Facades\Date::now()->format('Y-m-d H:i:s')],
])
->orderBy('created_at', 'DESC')
->get();

View file

@ -16,6 +16,7 @@ class Kernel extends HttpKernel
*
* @var array
*/
#[\Override]
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
@ -30,6 +31,7 @@ class Kernel extends HttpKernel
*
* @var array
*/
#[\Override]
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
@ -55,7 +57,8 @@ class Kernel extends HttpKernel
*
* @var array
*/
protected $routeMiddleware = [
#[\Override]
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,

View file

@ -25,20 +25,16 @@ class AdminSecureMiddleware
$client_ip = AdminSecure::fetchClientIp();
$ip_is_allowed = \collect(AdminSecure::getOptions()->getCidrList())
->reduce(function ($initial, $ip_range) use ($client_ip) {
return $initial || IP::contains(
$ip_range,
$client_ip
)->unwrap();
});
->reduce(fn($initial, $ip_range) => $initial || IP::contains(
$ip_range,
$client_ip
)->unwrap());
$ip_is_allowed_by_config = \collect(AdminSecure::getOptions()->getCidrAllowedList())
->reduce(function ($initial, $ip_range) use ($client_ip) {
return $initial || IP::contains(
$ip_range,
$client_ip
)->unwrap();
});
->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);

View file

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

View file

@ -25,9 +25,9 @@ class FrontEndGlobals
$routeParamsFR = Route::current()->parameters();
$routeParamsEN = $routeParamsFR;
$routeParamsES = $routeParamsFR;
array_walk($routeParamsFR, array($this, 'unbind'), '');
array_walk($routeParamsEN, array($this, 'unbind'), 'en');
array_walk($routeParamsES, array($this, 'unbind'), 'es');
array_walk($routeParamsFR, $this->unbind(...), '');
array_walk($routeParamsEN, $this->unbind(...), 'en');
array_walk($routeParamsES, $this->unbind(...), 'es');
if (preg_match('/^(en|es)/', $currentRoute)) {
$currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute, 1);
$currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute, 1);

View file

@ -41,9 +41,9 @@ class LangCheck
if ($this->checkFirstAccess($request)) {
$sess_lang = $request->session()->get('lang', config('app.locale'));
if ($sess_lang === config('app.locale')) {
return redirect()->route($routName, $request->route()->parameters());
return to_route($routName, $request->route()->parameters());
}
return redirect()->route($sess_lang . '.' . $routName, $request->route()->parameters());
return to_route($sess_lang . '.' . $routName, $request->route()->parameters());
}
$this->saveUserLocale(
config('app.locale'),
@ -88,7 +88,7 @@ class LangCheck
*/
private function checkFirstAccess(Request $request)
{
if (\strpos($request->header('User-Agent'), "Uptime-Kuma") !== false) {
if (str_contains($request->header('User-Agent'), "Uptime-Kuma")) {
return false;
}
// Do we have session ?

View file

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

View file

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

View file

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

View file

@ -4,13 +4,14 @@ namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
class VerifyCsrfToken extends \Illuminate\Foundation\Http\Middleware\PreventRequestForgery
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
#[\Override]
protected $except = [
];
}

View file

@ -30,11 +30,11 @@ class StorePostRequest extends FormRequest
{
try {
$this->merge([
'date_start' => Carbon::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
'date_start' => \Illuminate\Support\Facades\Date::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
'date_end' => \Illuminate\Support\Facades\Date::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
'on_top' => $this->on_top ? true : false,
]);
} catch (InvalidFormatException $e) {
} catch (InvalidFormatException) {
$error = ValidationException::withMessages([
'date_start_date' => ['Format de date incorrect'],
'date_end_date' => ['Format de date incorrect'],
@ -58,13 +58,13 @@ class StorePostRequest extends FormRequest
'date_start' => [
'required',
'date_format:Y-m-d H:i:s',
'before:' . Carbon::now()->parse('2037-12-31')
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
],
'date_end' => [
'required',
'date_format:Y-m-d H:i:s',
'after:date_start',
'before:' . Carbon::now()->parse('2037-12-31')
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
],
'picture_home' => 'required|image|mimes:jpeg,png,jpg|max:2048|dimensions:max_width=1030,max_height=239',
'alt_text_picture_home' => 'required|max:255',

View file

@ -26,78 +26,78 @@ class StoreProductRequest extends FormRequest
*/
protected function prepareForValidation()
{
$tabFour = array(
$tabFour = [
'id' => 0,
'name' => 'Four',
'url' => '/assets/images/four.png',
'time' => $this->time_cook0,
'temp' => $this->temp_cook0,
'status' => $this->is_activated0 ? true : false
);
$tabFriteuse = array(
];
$tabFriteuse = [
'id' => 1,
'name' => 'Friteuse',
'url' => '/assets/images/friteuse.png',
'time' => $this->time_cook1,
'temp' => $this->temp_cook1,
'status' => $this->is_activated1 ? true : false
);
$tabPoele = array(
];
$tabPoele = [
'id' => 2,
'name' => 'Poêle',
'url' => '/assets/images/poele.png',
'time' => $this->time_cook2,
'temp' => $this->temp_cook2,
'status' => $this->is_activated2 ? true : false
);
$tabCocotte = array(
];
$tabCocotte = [
'id' => 3,
'name' => 'Cocotte',
'url' => '/assets/images/cocotte.png',
'time' => $this->time_cook3,
'temp' => $this->temp_cook3,
'status' => $this->is_activated3 ? true : false
);
$tabPlancha = array(
];
$tabPlancha = [
'id' => 4,
'name' => 'Plancha',
'url' => '/assets/images/plancha.png',
'time' => $this->time_cook4,
'temp' => $this->temp_cook4,
'status' => $this->is_activated4 ? true : false
);
$tabBainMarie = array(
];
$tabBainMarie = [
'id' => 5,
'name' => 'Bain Marie',
'url' => '/assets/images/bainmarie.png',
'time' => $this->time_cook5,
'temp' => $this->temp_cook5,
'status' => $this->is_activated5 ? true : false
);
$tabBarbecue = array(
];
$tabBarbecue = [
'id' => 6,
'name' => 'Barbecue',
'url' => '/assets/images/barbecue.png',
'time' => $this->time_cook6,
'temp' => $this->temp_cook6,
'status' => $this->is_activated6 ? true : false
);
$tabMicroOndes = array(
];
$tabMicroOndes = [
'id' => 7,
'name' => 'Micro Ondes',
'url' => '/assets/images/micro-onde.png',
'time' => $this->time_cook7,
'temp' => $this->temp_cook7,
'status' => $this->is_activated7 ? true : false
);
$tabCasserole = array(
];
$tabCasserole = [
'id' => 8,
'name' => 'Casserole',
'url' => '/assets/images/casserole.png',
'time' => $this->time_cook8,
'temp' => $this->temp_cook8,
'status' => $this->is_activated8 ? true : false
);
];
$tabCuisson = json_encode([
'four' => $tabFour,
'friteuse' => $tabFriteuse,
@ -114,29 +114,29 @@ class StoreProductRequest extends FormRequest
if ($this->pictogramme0) {
$urlPlusProduit = "/assets/images/" . $this->pictogramme0->getClientOriginalName();
}
$tabPlusProduit1 = array(
$tabPlusProduit1 = [
'id' => 0,
'name' => $this->content0,
'url' => $urlPlusProduit,
);
];
$urlPlusProduit = "";
if ($this->pictogramme1) {
$urlPlusProduit = "/assets/images/" . $this->pictogramme1->getClientOriginalName();
}
$tabPlusProduit2 = array(
$tabPlusProduit2 = [
'id' => 1,
'name' => $this->content1,
'url' => $urlPlusProduit,
);
];
$urlPlusProduit = "";
if ($this->pictogramme2) {
$urlPlusProduit = "/assets/images/" . $this->pictogramme2->getClientOriginalName();
}
$tabPlusProduit3 = array(
$tabPlusProduit3 = [
'id' => 2,
'name' => $this->content2,
'url' => $urlPlusProduit,
);
];
$tabPlusProduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
$this->merge([
'slug' => Str::slug($this->name),

View file

@ -29,10 +29,10 @@ class StoreSlideRequest extends FormRequest
{
try {
$this->merge([
'date_start' => Carbon::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
'date_end' => Carbon::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
'date_start' => \Illuminate\Support\Facades\Date::parse("$this->date_start_date $this->date_start_time:00")->toDateTimeString(),
'date_end' => \Illuminate\Support\Facades\Date::parse("$this->date_end_date $this->date_end_time:00")->toDateTimeString(),
]);
} catch (InvalidFormatException $e) {
} catch (InvalidFormatException) {
$error = \Illuminate\Validation\ValidationException::withMessages([
'date_start_date' => ['Format de date incorrect'],
'date_end_date' => ['Format de date incorrect'],
@ -40,8 +40,8 @@ class StoreSlideRequest extends FormRequest
throw $error;
}
$this->merge([
'title' => 'lorem title ' . rand(),
'text' => 'lorem text ' . rand(),
'title' => 'lorem title ' . random_int(0, mt_getrandmax()),
'text' => 'lorem text ' . random_int(0, mt_getrandmax()),
'link_new_tab' => $this->link_new_tab ? true : false
]);
}
@ -65,13 +65,13 @@ class StoreSlideRequest extends FormRequest
'date_start' => [
'nullable',
'date_format:Y-m-d H:i:s',
'before:' . Carbon::now()->parse('2037-12-31')
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
],
'date_end' => [
'nullable',
'date_format:Y-m-d H:i:s',
'after:date_start',
'before:' . Carbon::now()->parse('2037-12-31')
'before:' . \Illuminate\Support\Facades\Date::now()->parse('2037-12-31')
],
];
}

View file

@ -58,7 +58,7 @@ abstract class AdminSecure
*/
public static function ipIsPrivate($ip_address): bool
{
return \get_class($ip_address) === IPv4Address::class ?
return $ip_address::class === IPv4Address::class ?
self::ipV4IsPrivate($ip_address) : self::ipV6IsPrivate($ip_address);
}
@ -90,12 +90,8 @@ abstract class AdminSecure
{
return \collect(self::$private_ip_v4_cidr_list)
->concat([self::$private_ip_v4_loopback_cidr])
->map(function (string $ipv4_cidr) {
return IPv4Range::Make($ipv4_cidr)->unwrap();
})
->reduce(function ($initial, IPv4Range $ipv4_range) use ($ipv4_address) {
return $initial || $ipv4_range->containsAddress($ipv4_address);
});
->map(fn(string $ipv4_cidr) => IPv4Range::Make($ipv4_cidr)->unwrap())
->reduce(fn($initial, IPv4Range $ipv4_range) => $initial || $ipv4_range->containsAddress($ipv4_address));
}
/**
@ -108,12 +104,8 @@ abstract class AdminSecure
{
return \collect(self::$private_ip_v6_cidr_list)
->concat([self::$private_ip_v6_loopback_cidr])
->map(function (string $ipv6_cidr) {
return IPv6Range::Make($ipv6_cidr)->unwrap();
})
->reduce(function ($initial, IPv6Range $ipv6_range) {
return $initial || $ipv6_range->containsAddress($ipv6_address);
});
->map(fn(string $ipv6_cidr) => IPv6Range::Make($ipv6_cidr)->unwrap())
->reduce(fn($initial, IPv6Range $ipv6_range) => $initial || $ipv6_range->containsAddress($ipv6_address));
}
/**

View file

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

View file

@ -22,40 +22,30 @@ class ToolboxHelper
'g-recaptcha-response' => [
'required', 'string',
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) use ($isV3) {
function ($attribute, $value, $fail) use ($isV3): void {
try {
$response = Http::asForm()->post('https://www.google.com/recaptcha/api/siteverify', [
'secret' => config('services.google.recaptcha.private'),
'response' => \strval($value),
'remoteip' => app('clientIp')
'remoteip' => resolve('clientIp')
]);
if ($e = $response->toException()) {
throw $e;
}
throw_if($e = $response->toException(), $e);
if ($isV3) {
if (
!$response->json('success') or
!$response->json('challenge_ts') or
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or
!$response->json('score')
) {
throw new \RuntimeException();
}
throw_if(!$response->json('success') or
!$response->json('challenge_ts') or
\Illuminate\Support\Facades\Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) or
!$response->json('score'), \RuntimeException::class);
if (\floatval($response->json('score')) < 0.8) {
$fail("Vous n'avez pas obtenu un score assez élevé lors de la validation du recaptcha");
}
return;
}
if (
!$response->json('success') or
!$response->json('challenge_ts') or
Carbon::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST)
) {
throw new \RuntimeException();
}
} catch (\Exception $e) {
throw_if(!$response->json('success') or
!$response->json('challenge_ts') or
\Illuminate\Support\Facades\Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) or
$response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST), \RuntimeException::class);
} catch (\Exception) {
$fail('Erreur lors de la validation du formulaire veuillez réssayer');
} //end try
}

View file

@ -78,8 +78,8 @@ final class Options
'cidrProjectAllowedList' => []
]);
$resolver->setNormalizer('cidrList', \Closure::fromCallable([$this, 'normalizeCidrList']));
$resolver->setNormalizer('cidrProjectAllowedList', \Closure::fromCallable([$this, 'normalizeCidrProjectList']));
$resolver->setNormalizer('cidrList', $this->normalizeCidrList(...));
$resolver->setNormalizer('cidrProjectAllowedList', $this->normalizeCidrProjectList(...));
}
/**
@ -149,11 +149,9 @@ final class Options
}
/** @var array<\Dxw\CIDR\IPv4Range|\Dxw\CIDR\IPv6Range> $allowed_cidr_list */
return \collect(Cache::rememberForever($cacheConfigKey, function() use ($allowed_cidr_list, $allowed_cidr_config_list_hash) {
return [
'list' => $allowed_cidr_list,
'hash' => $allowed_cidr_config_list_hash
];
}))->get('list');
return \collect(Cache::rememberForever($cacheConfigKey, fn() => [
'list' => $allowed_cidr_list,
'hash' => $allowed_cidr_config_list_hash
]))->get('list');
}
}

View file

@ -29,7 +29,7 @@ class Utils
*/
public static function storeImage($image, string $folderName): string
{
if (\is_object($image) and get_class($image) === UploadedFile::class) {
if (\is_object($image) and $image::class === UploadedFile::class) {
/** @var UploadedFile */
$image = $image;
$newPath = self::prepareMoveFile($image->getClientOriginalName(), $folderName);
@ -37,7 +37,7 @@ class Utils
$image->storePubliclyAs(pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME));
return '/storage' . str_replace('/public', '', $newPath);
}
if (\is_object($image) and get_class($image) === SplFileInfo::class) {
if (\is_object($image) and $image::class === SplFileInfo::class) {
/** @var SplFileInfo */
$image = $image;
$newPath = self::prepareMoveFile($image->getBaseName(), $folderName);

View file

@ -18,6 +18,7 @@ class Advice extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title1',
'title2',
@ -57,7 +58,7 @@ class Advice extends Model
*/
protected static function boot()
{
static::creating(function (Advice $advice) {
static::creating(function (Advice $advice): void {
if (is_a($advice->picture1, "SplFileInfo")) {
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
}
@ -69,7 +70,7 @@ class Advice extends Model
}
});
static::updating(function (Advice $advice) {
static::updating(function (Advice $advice): void {
if (is_a($advice->picture1, "SplFileInfo")) {
$advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable());
}
@ -81,7 +82,7 @@ class Advice extends Model
}
});
static::deleted(function (Advice $advice) {
static::deleted(function (Advice $advice): void {
if ($advice->picture1) {
$urlPicture = public_path() . $advice->picture1;
if ($urlPicture) {

View file

@ -28,6 +28,7 @@ class Encart extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'subtitle',
@ -56,19 +57,19 @@ class Encart extends Model
*/
protected static function boot()
{
static::creating(function (Encart $encart) {
static::creating(function (Encart $encart): void {
if (is_a($encart->picture, "SplFileInfo")) {
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
}
});
static::updating(function (Encart $encart) {
static::updating(function (Encart $encart): void {
if (is_a($encart->picture, "SplFileInfo")) {
$encart->picture = Utils::storeImage($encart->picture, $encart->getTable());
}
});
static::deleted(function (Encart $encart) {
static::deleted(function (Encart $encart): void {
if ($encart->picture) {
$urlPicture = public_path() . $encart->picture;
if ($urlPicture) {

View file

@ -18,6 +18,7 @@ class Gamme extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'parent_gamme_id',
'title',
@ -53,7 +54,7 @@ class Gamme extends Model
*/
protected static function boot()
{
static::creating(function (Gamme $gamme) {
static::creating(function (Gamme $gamme): void {
if (is_a($gamme->picture, "SplFileInfo")) {
$gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable());
}
@ -67,7 +68,7 @@ class Gamme extends Model
}
});
static::updating(function (Gamme $gamme) {
static::updating(function (Gamme $gamme): void {
if (is_a($gamme->picture, "SplFileInfo")) {
$gamme->picture = Utils::storeImage($gamme->picture, $gamme->getTable());
}
@ -93,14 +94,14 @@ class Gamme extends Model
}
});
static::deleting(function (Gamme $gamme) {
static::deleting(function (Gamme $gamme): void {
if ($gamme->childGammes()->exists()) {
Gamme::whereParentGammeId($gamme->id)
->update(['parent_gamme_id' => null]);
}
});
static::deleted(function (Gamme $gamme) {
static::deleted(function (Gamme $gamme): void {
if ($gamme->picture) {
$urlPicture = public_path() . $gamme->picture;
if ($urlPicture) {
@ -126,7 +127,7 @@ class Gamme extends Model
*
* @return string
*/
public function getRgbaColorAttribute()
protected function getRgbaColorAttribute()
{
$color = $this->color;
@ -136,7 +137,7 @@ class Gamme extends Model
if ($color[0] == '#') {
$color = substr($color, 1);
}
list($r, $g, $b) = array_map("hexdec", str_split($color, (strlen($color) / 3)));
[$r, $g, $b] = array_map(hexdec(...), str_split($color, (strlen($color) / 3)));
return "rgba($r,$g,$b,1)";
}

View file

@ -28,6 +28,7 @@ class Moment extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'subtitle',
@ -56,19 +57,19 @@ class Moment extends Model
*/
protected static function boot()
{
static::creating(function (Moment $moment) {
static::creating(function (Moment $moment): void {
if (is_a($moment->picture, "SplFileInfo")) {
$moment->picture = Utils::storeImage($moment->picture, $moment->getTable());
}
});
static::updating(function (Moment $moment) {
static::updating(function (Moment $moment): void {
if (is_a($moment->picture, "SplFileInfo")) {
$moment->picture = Utils::storeImage($moment->picture, $moment->getTable());
}
});
static::deleted(function (Moment $moment) {
static::deleted(function (Moment $moment): void {
if ($moment->picture) {
$urlPicture = public_path() . $moment->picture;
if ($urlPicture) {

View file

@ -28,6 +28,7 @@ class Picto extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'picture',
'alt_text_picture',
@ -52,19 +53,19 @@ class Picto extends Model
*/
protected static function boot()
{
static::creating(function (Picto $picto) {
static::creating(function (Picto $picto): void {
if (is_a($picto->picture, "SplFileInfo")) {
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
}
});
static::updating(function (Picto $picto) {
static::updating(function (Picto $picto): void {
if (is_a($picto->picture, "SplFileInfo")) {
$picto->picture = Utils::storeImage($picto->picture, $picto->getTable());
}
});
static::deleted(function (Picto $picto) {
static::deleted(function (Picto $picto): void {
if ($picto->picture) {
$urlPicture = public_path() . $picto->picture;
if ($urlPicture) {

View file

@ -18,6 +18,7 @@ class PictoBrand extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'picture',
@ -44,19 +45,19 @@ class PictoBrand extends Model
*/
protected static function boot()
{
static::creating(function (PictoBrand $pictoBrand) {
static::creating(function (PictoBrand $pictoBrand): void {
if (is_a($pictoBrand->picture, "SplFileInfo")) {
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
}
});
static::updating(function (PictoBrand $pictoBrand) {
static::updating(function (PictoBrand $pictoBrand): void {
if (is_a($pictoBrand->picture, "SplFileInfo")) {
$pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable());
}
});
static::deleted(function (PictoBrand $pictoBrand) {
static::deleted(function (PictoBrand $pictoBrand): void {
if ($pictoBrand->picture) {
$urlPicture = public_path() . $pictoBrand->picture;
if ($urlPicture) {

View file

@ -18,6 +18,7 @@ class Post extends Model
*
* @var array
*/
#[\Override]
protected $casts = [
'date_start' => 'datetime',
'date_end' => 'datetime',
@ -28,6 +29,7 @@ class Post extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',
@ -62,7 +64,7 @@ class Post extends Model
*/
protected static function boot()
{
static::creating(function (Post $post) {
static::creating(function (Post $post): void {
if (is_a($post->picture_home, "SplFileInfo")) {
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
}
@ -71,7 +73,7 @@ class Post extends Model
}
});
static::updating(function (Post $post) {
static::updating(function (Post $post): void {
if (is_a($post->picture_home, "SplFileInfo")) {
$post->picture_home = Utils::storeImage($post->picture_home, $post->getTable());
}
@ -80,7 +82,7 @@ class Post extends Model
}
});
static::deleted(function (Post $post) {
static::deleted(function (Post $post): void {
if ($post->picture_home) {
$urlPicture = public_path() . $post->picture_home;
if ($urlPicture) {

View file

@ -18,6 +18,7 @@ class Product extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'gamme_id',
'name',
@ -60,19 +61,19 @@ class Product extends Model
*/
protected static function boot()
{
static::creating(function (Product $product) {
static::creating(function (Product $product): void {
if (is_a($product->picture, "SplFileInfo")) {
$product->picture = Utils::storeImage($product->picture, $product->getTable());
}
});
static::updating(function (Product $product) {
static::updating(function (Product $product): void {
if (is_a($product->picture, "SplFileInfo")) {
$product->picture = Utils::storeImage($product->picture, $product->getTable());
}
});
static::deleted(function (Product $product) {
static::deleted(function (Product $product): void {
if ($product->picture) {
$urlPicture = public_path() . $product->picture;
if ($urlPicture) {

View file

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

View file

@ -18,6 +18,7 @@ class Slide extends Model
*
* @var array
*/
#[\Override]
protected $casts = [
'date_start' => 'datetime',
'date_end' => 'datetime',
@ -28,6 +29,7 @@ class Slide extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'title',
'text',
@ -62,19 +64,19 @@ class Slide extends Model
*/
protected static function boot()
{
static::creating(function (Slide $slide) {
static::creating(function (Slide $slide): void {
if (is_a($slide->picture, "SplFileInfo")) {
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
}
});
static::updating(function (Slide $slide) {
static::updating(function (Slide $slide): void {
if (is_a($slide->picture, "SplFileInfo")) {
$slide->picture = Utils::storeImage($slide->picture, $slide->getTable());
}
});
static::deleted(function (Slide $slide) {
static::deleted(function (Slide $slide): void {
if ($slide->picture) {
$urlPicture = public_path() . $slide->picture;
if ($urlPicture) {

View file

@ -17,6 +17,7 @@ class Slider extends Model
*
* @var array
*/
#[\Override]
protected $fillable = [
'label',
'slug',
@ -52,12 +53,12 @@ class Slider extends Model
*/
public function showableSlides()
{
$now = Carbon::now();
$now = \Illuminate\Support\Facades\Date::now();
return $this->hasMany(Slide::class, 'slider_id')
->orderBy('order', 'ASC')->where(function ($q) use ($now) {
->orderBy('order', 'ASC')->where(function ($q) use ($now): void {
$q->whereDate('date_start', '<=', $now)
->orWhereNull('date_start');
})->where(function ($q) use ($now) {
})->where(function ($q) use ($now): void {
$q->whereDate('date_end', '>=', $now)
->orWhereNull('date_end');
});

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -26,7 +26,7 @@ class RouteServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->routes(function () {
$this->routes(function (): void {
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
@ -37,7 +37,7 @@ class RouteServiceProvider extends ServiceProvider
$vars = $this->getRouteBinderVars($value);
\extract($vars);
/** @var \App\Models\Gamme */
$gamme = Gamme::where(function (Builder $q) use ($locale, $defaultLocale, $value) {
$gamme = Gamme::where(function (Builder $q) use ($locale, $defaultLocale, $value): void {
$q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'")
->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'");
})->firstOrFail();
@ -52,7 +52,7 @@ class RouteServiceProvider extends ServiceProvider
$vars = $this->getRouteBinderVars($value);
\extract($vars);
/** @var \App\Models\Product */
$product = Product::where(function (Builder $q) use ($locale, $defaultLocale, $value) {
$product = Product::where(function (Builder $q) use ($locale, $defaultLocale, $value): void {
$q->whereRaw("JSON_EXTRACT(slug, '$.$locale') = '$value'")
->orWhereRaw("JSON_EXTRACT(slug, '$.$defaultLocale') = '$value'");
})->where('gamme_id', $gamme->id)

View file

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

View file

@ -24,6 +24,7 @@
"uwil/k8s-laravel": "^1.2"
},
"require-dev": {
"driftingly/rector-laravel": "^2.5",
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel-lang/lang": "^10.9",
@ -32,6 +33,7 @@
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10",
"rector/rector": "^2.8",
"slevomat/coding-standard": "^8.5"
},
"autoload": {

159
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "bf80b4c19ea353a96fe885a27183dea9",
"content-hash": "ba2caf5f0d1e4c429b3fbaceba79a084",
"packages": [
{
"name": "asm89/stack-cors",
@ -7398,6 +7398,42 @@
],
"time": "2022-04-01T17:14:16+00:00"
},
{
"name": "driftingly/rector-laravel",
"version": "2.5.0",
"source": {
"type": "git",
"url": "https://github.com/driftingly/rector-laravel.git",
"reference": "0dbdd842dfdbc821cfe5f47ca7326e2502b2a107"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/0dbdd842dfdbc821cfe5f47ca7326e2502b2a107",
"reference": "0dbdd842dfdbc821cfe5f47ca7326e2502b2a107",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
"rector/rector": "^2.2.7",
"webmozart/assert": "^1.11 || ^2.0"
},
"type": "rector-extension",
"autoload": {
"psr-4": {
"RectorLaravel\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Rector upgrades rules for Laravel Framework",
"support": {
"issues": "https://github.com/driftingly/rector-laravel/issues",
"source": "https://github.com/driftingly/rector-laravel/tree/2.5.0"
},
"time": "2026-06-02T16:22:14+00:00"
},
{
"name": "facade/flare-client-php",
"version": "1.10.0",
@ -8416,6 +8452,70 @@
},
"time": "2024-10-13T11:25:22+00:00"
},
{
"name": "phpstan/phpstan",
"version": "2.3.2",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/18bc23a0682f08591529377d271b5c4dfe9ed1dd",
"reference": "18bc23a0682f08591529377d271b5c4dfe9ed1dd",
"shasum": ""
},
"require": {
"php": "^7.4|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ondřej Mirtes"
},
{
"name": "Markus Staab"
},
{
"name": "Vincent Langlet"
}
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues",
"security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
}
],
"time": "2026-10-24T11:36:00+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.32",
@ -8838,6 +8938,63 @@
],
"time": "2024-12-05T13:48:26+00:00"
},
{
"name": "rector/rector",
"version": "2.8.1",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "10c96546bb72b38b4e2e9960fcd3f884d7fa02eb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/10c96546bb72b38b4e2e9960fcd3f884d7fa02eb",
"reference": "10c96546bb72b38b4e2e9960fcd3f884d7fa02eb",
"shasum": ""
},
"require": {
"php": "^7.4|^8.0",
"phpstan/phpstan": "^2.3.2"
},
"conflict": {
"rector/rector-doctrine": "*",
"rector/rector-downgrade-php": "*",
"rector/rector-phpunit": "*",
"rector/rector-symfony": "*"
},
"bin": [
"bin/rector"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Instant Upgrade and Automated Refactoring of any PHP code",
"homepage": "https://getrector.com/",
"keywords": [
"automation",
"dev",
"migration",
"refactoring"
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/2.8.1"
},
"funding": [
{
"url": "https://github.com/tomasvotruba",
"type": "github"
}
],
"time": "2026-10-26T13:03:01+00:00"
},
{
"name": "sebastian/cli-parser",
"version": "1.0.2",

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

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

View file

@ -14,6 +14,7 @@ class AdviceFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Advice::class;
/**

View file

@ -14,6 +14,7 @@ class EncartFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Encart::class;
/**

View file

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

View file

@ -13,6 +13,7 @@ class MomentFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Moment::class;
/**

View file

@ -14,6 +14,7 @@ class PictoBrandFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = PictoBrand::class;
/**

View file

@ -14,6 +14,7 @@ class PictoFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Picto::class;
/**

View file

@ -31,8 +31,8 @@ class PostFactory extends Factory
'alt_text_picture_home' => $this->faker->sentence(10),
'picture_news' => $imgnewspath,
'alt_text_picture_news' => $this->faker->sentence(10),
'date_start' => Carbon::now(),
'date_end' => Carbon::now()->addDays(2),
'date_start' => \Illuminate\Support\Facades\Date::now(),
'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2),
'on_top' => true
];
}

View file

@ -17,94 +17,94 @@ class ProductFactory extends Factory
*/
public function definition()
{
$name = $this->faker->text(10) . rand(1, 100);
$tabFour = array(
$name = $this->faker->text(10) . random_int(1, 100);
$tabFour = [
'id' => 0,
'name' => 'Four',
'url' => '/assets/images/four.png',
'time' => '1h30mins.',
'temp' => '200°C',
'status' => true
);
$tabFriteuse = array(
];
$tabFriteuse = [
'id' => 1,
'name' => 'Friteuse',
'url' => '/assets/images/friteuse.png',
'time' => '15 minutes',
'temp' => '100°C',
'status' => true
);
$tabPoele = array(
];
$tabPoele = [
'id' => 2,
'name' => 'Poêle',
'url' => '/assets/images/poele.png',
'time' => '5 minutes sur chaque face',
'temp' => '100°C',
'status' => false
);
$tabCocotte = array(
];
$tabCocotte = [
'id' => 3,
'name' => 'Cocotte',
'url' => '/assets/images/cocotte.png',
'time' => '3 h',
'temp' => '80°C',
'status' => true
);
$tabPlancha = array(
];
$tabPlancha = [
'id' => 4,
'name' => 'Plancha',
'url' => '/assets/images/plancha.png',
'time' => '20mins',
'temp' => '130°C',
'status' => false
);
$tabBainMarie = array(
];
$tabBainMarie = [
'id' => 5,
'name' => 'Bain Marie',
'url' => '/assets/images/bainmarie.png',
'time' => '30 mins à 45 mins',
'temp' => '80°C',
'status' => false
);
$tabBarbecue = array(
];
$tabBarbecue = [
'id' => 6,
'name' => 'Barbecue',
'url' => '/assets/images/barbecue.png',
'time' => '30 minutes',
'temp' => '200°C',
'status' => false
);
$tabMicroOndes = array(
];
$tabMicroOndes = [
'id' => 7,
'name' => 'Micro Ondes',
'url' => '/assets/images/microondes.png',
'time' => '3mins',
'temp' => '900 Watts',
'status' => false
);
$tabCasserole = array(
];
$tabCasserole = [
'id' => 8,
'name' => 'Casserole',
'url' => '/assets/images/casserole.png',
'time' => '10mins',
'temp' => '90°C',
'status' => false
);
$tabPlusProduit1 = array(
];
$tabPlusProduit1 = [
'id' => 0,
'name' => 'Lorem ipsum set doloris',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit2 = array(
];
$tabPlusProduit2 = [
'id' => 1,
'name' => 'Lorem ipsum set doloris',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit3 = array(
];
$tabPlusProduit3 = [
'id' => 2,
'name' => 'Lorem ipsum set doloris',
'url' => '/assets/images/sans-label.jpg',
);
];
$upload = new SplFileInfo(resource_path('assets/images/product_sample_01.png'));
$picture = new Product();
@ -129,10 +129,10 @@ class ProductFactory extends Factory
]),
'plusproduit' => json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]),
'is_published' => true,
'is_on_top' => rand(true, false),
'is_news' => rand(true, false),
'is_food_service' => rand(true, false),
'is_halal' => rand(true, false),
'is_on_top' => random_int(true, false),
'is_news' => random_int(true, false),
'is_food_service' => random_int(true, false),
'is_halal' => random_int(true, false),
'seo_title' => $this->faker->text(5),
'seo_description' => $this->faker->sentence(20),
];

View file

@ -15,6 +15,7 @@ class SlideFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Slide::class;
/**
@ -34,9 +35,9 @@ class SlideFactory extends Factory
'text' => $this->faker->realText(25),
'link_label' => $this->faker->text(128),
'link' => 'route(\'wasup\')',
'link_new_tab' => rand(0, 1),
'date_start' => Carbon::now(),
'date_end' => Carbon::now()->addDays(2),
'link_new_tab' => random_int(0, 1),
'date_start' => \Illuminate\Support\Facades\Date::now(),
'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2),
'picture' => $imgpath,
'alt_text_picture' => $this->faker->sentence(10),
];

View file

@ -13,6 +13,7 @@ class SliderFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Slider::class;
/**

View file

@ -12,6 +12,7 @@ class TextFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Text::class;
/**

View file

@ -12,6 +12,7 @@ class TitleFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = Title::class;
/**

View file

@ -13,6 +13,7 @@ class UserFactory extends Factory
*
* @var string
*/
#[\Override]
protected $model = User::class;
/**
@ -40,10 +41,8 @@ class UserFactory extends Factory
public function unverified()
{
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
return $this->state(fn(array $attributes) => [
'email_verified_at' => null,
]);
}
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSlidesTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
@ -13,7 +13,7 @@ class CreateSlidesTable extends Migration
*/
public function up()
{
Schema::create('slides', function (Blueprint $table) {
Schema::create('slides', function (Blueprint $table): void {
$table->id();
$table->foreignId('slider_id')->default(1)->constrained('sliders');
@ -32,7 +32,6 @@ class CreateSlidesTable extends Migration
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
@ -42,4 +41,4 @@ class CreateSlidesTable extends Migration
{
Schema::dropIfExists('slides');
}
}
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class DropuniqueslugOnProducts extends Migration
return new class extends Migration
{
/**
* Run the migrations.
@ -13,11 +13,10 @@ class DropuniqueslugOnProducts extends Migration
*/
public function up()
{
Schema::table('products', function (Blueprint $table) {
Schema::table('products', function (Blueprint $table): void {
$table->dropUnique('products_slug_unique');
});
}
/**
* Reverse the migrations.
*
@ -27,4 +26,4 @@ class DropuniqueslugOnProducts extends Migration
{
//
}
}
};

View file

@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddIsNewsOnProducts extends Migration
return new class extends Migration
{
/**
* Run the migrations.
@ -13,11 +13,10 @@ class AddIsNewsOnProducts extends Migration
*/
public function up()
{
Schema::table('products', function (Blueprint $table) {
Schema::table('products', function (Blueprint $table): void {
$table->boolean('is_news')->after('is_on_top');
});
}
/**
* Reverse the migrations.
*
@ -25,8 +24,8 @@ class AddIsNewsOnProducts extends Migration
*/
public function down()
{
Schema::table('products', function (Blueprint $table) {
Schema::table('products', function (Blueprint $table): void {
$table->dropColumn('is_news');
});
}
}
};

View file

@ -5,7 +5,7 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSeoDataTable extends Migration
return new class extends Migration
{
/**
* Run the migrations.
@ -14,7 +14,7 @@ class CreateSeoDataTable extends Migration
*/
public function up()
{
Schema::create('seo_data', function (Blueprint $table) {
Schema::create('seo_data', function (Blueprint $table): void {
$table->id();
$table->smallInteger('page')->unique();
$table->text('title')->nullable();
@ -26,7 +26,6 @@ class CreateSeoDataTable extends Migration
$seeder = new SeoDataSeeder();
$seeder->run();
}
/**
* Reverse the migrations.
*
@ -36,4 +35,4 @@ class CreateSeoDataTable extends Migration
{
Schema::dropIfExists('seo_data');
}
}
};

View file

@ -26,7 +26,7 @@ class EncartsSeeder extends Seeder
$i = 0;
Encart::factory(6)->make()
->each(function (Encart $encart) use ($tabEncarts, &$i) {
->each(function (Encart $encart) use ($tabEncarts, &$i): void {
$encart->page = $tabEncarts[$i++]->value;
$encart->save();
});

View file

@ -18,93 +18,93 @@ class GammesSeeder extends Seeder
*/
public function run()
{
$tabFour = array(
$tabFour = [
'id' => 0,
'name' => 'Four',
'url' => '/assets/images/four.png',
'time' => '1h30mins.',
'temp' => '200°C',
'status' => true
);
$tabFriteuse = array(
];
$tabFriteuse = [
'id' => 1,
'name' => 'Friteuse',
'url' => '/assets/images/friteuse.png',
'time' => '15 minutes',
'temp' => '100°C',
'status' => true
);
$tabPoele = array(
];
$tabPoele = [
'id' => 2,
'name' => 'Poêle',
'url' => '/assets/images/poele.png',
'time' => '5 minutes sur chaque face',
'temp' => '101°C',
'status' => true
);
$tabCocotte = array(
];
$tabCocotte = [
'id' => 3,
'name' => 'Cocotte',
'url' => '/assets/images/cocotte.png',
'time' => '3 h',
'temp' => '80°C',
'status' => false
);
$tabPlancha = array(
];
$tabPlancha = [
'id' => 4,
'name' => 'Plancha',
'url' => '/assets/images/plancha.png',
'time' => '20mins',
'temp' => '130°C',
'status' => false
);
$tabBainMarie = array(
];
$tabBainMarie = [
'id' => 5,
'name' => 'Bain Marie',
'url' => '/assets/images/bainmarie.png',
'time' => '30 mins à 45 mins',
'temp' => '80°C',
'status' => false
);
$tabBarbecue = array(
];
$tabBarbecue = [
'id' => 6,
'name' => 'Barbecue',
'url' => '/assets/images/barbecue.png',
'time' => '30 minutes',
'temp' => '200°C',
'status' => false
);
$tabMicroOndes = array(
];
$tabMicroOndes = [
'id' => 7,
'name' => 'Micro Ondes',
'url' => '/assets/images/microondes.png',
'time' => '3mins',
'temp' => '900 Watts',
'status' => false
);
$tabCasserole = array(
];
$tabCasserole = [
'id' => 8,
'name' => 'Casserole',
'url' => '/assets/images/casserole.png',
'time' => '10mins',
'temp' => '90°C',
'status' => false
);
$tabPlusProduit1 = array(
];
$tabPlusProduit1 = [
'id' => 0,
'name' => 'Lorem ipsum set doloris',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit2 = array(
];
$tabPlusProduit2 = [
'id' => 1,
'name' => 'Lorem ipsum set doloris',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit3 = array(
];
$tabPlusProduit3 = [
'id' => 2,
'name' => 'Lorem ipsum set doloris',
'url' => '/assets/images/sans-label.jpg',
);
];
$gamme = new Gamme();
$gamme->parent_gamme_id = null;
@ -140,16 +140,16 @@ class GammesSeeder extends Seeder
$gamme->alt_text_banner = $gamme->title;
$gamme->save();
$tabPlusProduit1 = array(
$tabPlusProduit1 = [
'id' => 0,
'name' => 'Multiplier les recettes avec ce produit : plats mijotés, hot dog, salades...',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit2 = array(
];
$tabPlusProduit2 = [
'id' => 1,
'name' => 'Une recette garantie sans colorant',
'url' => '/assets/images/sans-label.jpg',
);
];
$product = new Product();
$product->gamme_id = $gamme->id;
$product->name = 'Chicken Franks Original';
@ -163,10 +163,10 @@ class GammesSeeder extends Seeder
$product->pictos = '';
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2]);
$product->is_published = true;
$product->is_on_top = rand(true, false);
$product->is_news = rand(true, false);
$product->is_food_service = rand(true, false);
$product->is_halal = rand(true, false);
$product->is_on_top = random_int(true, false);
$product->is_news = random_int(true, false);
$product->is_food_service = random_int(true, false);
$product->is_halal = random_int(true, false);
$product->seo_title = 'Chicken franks, poulet, recettes, qualité';
$product->seo_description = 'Doux vous propose des Chicken Franks Original préparées en France';
$product->save();
@ -188,32 +188,32 @@ class GammesSeeder extends Seeder
$gamme->alt_text_banner = $gamme->title;
$gamme->save();
$tabMicroOndes = array(
$tabMicroOndes = [
'id' => 0,
'name' => 'Micro Ondes',
'url' => '/assets/images/micro-onde.png',
'time' => '3mins',
'temp' => '900 Watts',
'status' => true
);
$tabCasserole = array(
];
$tabCasserole = [
'id' => 1,
'name' => 'Casserole',
'url' => '/assets/images/casserole.png',
'time' => '5mins',
'temp' => 'Au bain marie',
'status' => true
);
$tabPlusProduit1 = array(
];
$tabPlusProduit1 = [
'id' => 0,
'name' => 'La gourmandise à emporter partout !',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit2 = array(
];
$tabPlusProduit2 = [
'id' => 1,
'name' => 'Le goût fromage, le petit plus qui fait qu\'on l\'adore',
'url' => '/assets/images/sans-label.jpg',
);
];
$product = new Product();
$product->gamme_id = $gamme->id;
$product->name = 'Mini Chicken Franks Cheese';
@ -230,10 +230,10 @@ class GammesSeeder extends Seeder
]);
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2]);
$product->is_published = true;
$product->is_on_top = rand(true, false);
$product->is_news = rand(true, false);
$product->is_food_service = rand(true, false);
$product->is_halal = rand(true, false);
$product->is_on_top = random_int(true, false);
$product->is_news = random_int(true, false);
$product->is_food_service = random_int(true, false);
$product->is_halal = random_int(true, false);
$product->seo_title = 'recette, qualité, Chicken franks, plaisir, gourmandise';
$product->seo_description = 'Doux vous propose des Mini Chicken Franks Cheese préparées en France';
$product->save();
@ -260,10 +260,10 @@ class GammesSeeder extends Seeder
]);
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
$product->is_published = true;
$product->is_on_top = rand(true, false);
$product->is_news = rand(true, false);
$product->is_food_service = rand(true, false);
$product->is_halal = rand(true, false);
$product->is_on_top = random_int(true, false);
$product->is_news = random_int(true, false);
$product->is_food_service = random_int(true, false);
$product->is_halal = random_int(true, false);
$product->seo_title = 'recette, qualité, Chicken franks, plaisir, gourmandise';
$product->seo_description = 'Doux vous propose des Mini Chicken Franks Cheese préparées en France';
$product->save();
@ -284,29 +284,29 @@ class GammesSeeder extends Seeder
$gamme->alt_text_banner = $gamme->title;
$gamme->save();
$tabPoele = array(
$tabPoele = [
'id' => 0,
'name' => 'Poêle',
'url' => '/assets/images/poele.png',
'time' => '10mins',
'temp' => '',
'status' => true
);
$tabPlusProduit1 = array(
];
$tabPlusProduit1 = [
'id' => 0,
'name' => 'Un hachage façon bouchère pour un goût et une texture exceptionnelle !',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit2 = array(
];
$tabPlusProduit2 = [
'id' => 1,
'name' => '100% cuisse, 100% qualité',
'url' => '/assets/images/sans-label.jpg',
);
$tabPlusProduit3 = array(
];
$tabPlusProduit3 = [
'id' => 2,
'name' => 'Une recette sans colorant, sans exhausteur de goût et sans conservateur',
'url' => '/assets/images/sans-label.jpg',
);
];
$product = new Product();
$product->gamme_id = $gamme->id;
$product->name = 'Steak haché de poulet';
@ -321,10 +321,10 @@ class GammesSeeder extends Seeder
$product->pictos = json_encode(['poele' => $tabPoele]);
$product->plusproduit = json_encode([$tabPlusProduit1, $tabPlusProduit2, $tabPlusProduit3]);
$product->is_published = true;
$product->is_on_top = rand(true, false);
$product->is_news = rand(true, false);
$product->is_food_service = rand(true, false);
$product->is_halal = rand(true, false);
$product->is_on_top = random_int(true, false);
$product->is_news = random_int(true, false);
$product->is_food_service = random_int(true, false);
$product->is_halal = random_int(true, false);
$product->seo_title = 'recette, qualité, viande, cuisse, steak haché, poulet';
$product->seo_description = 'Doux vous propose un Steak haché de poulet préparé en France';
$product->save();
@ -345,11 +345,11 @@ class GammesSeeder extends Seeder
$gamme->alt_text_banner = $gamme->title;
$gamme->save();
$tabPlusProduit1 = array(
$tabPlusProduit1 = [
'id' => 0,
'name' => 'Volailles nourries exclusivement avec des végétaux, des minéraux et des vitamines',
'url' => '/assets/images/sans-label.jpg',
);
];
$product = new Product();
$product->gamme_id = $gamme->id;
$product->name = 'Poulet sans abats';
@ -363,10 +363,10 @@ class GammesSeeder extends Seeder
$product->pictos = '';
$product->plusproduit = json_encode([$tabPlusProduit1]);
$product->is_published = true;
$product->is_on_top = rand(true, false);
$product->is_news = rand(true, false);
$product->is_food_service = rand(true, false);
$product->is_halal = rand(true, false);
$product->is_on_top = random_int(true, false);
$product->is_news = random_int(true, false);
$product->is_food_service = random_int(true, false);
$product->is_halal = random_int(true, false);
$product->seo_title = 'volaille, poulet, Doux, qualités';
$product->seo_description = 'Doux vous propose des Poulets entiers congelés, nés, élevés et préparés en France';
$product->save();

View file

@ -26,7 +26,7 @@ class PictosSeeder extends Seeder
$picto = new Picto();
$imgpath = Utils::storeImage($upload, $picto->getTable());
foreach ($tabEncarts as $key => $value) {
foreach ($tabEncarts as $value) {
for ($i = 0; $i < 5; $i++) {
$picto = new Picto();
$picto->page = $value;

View file

@ -16,11 +16,11 @@ class SlidersSeeder extends Seeder
public function run()
{
Slider::factory(1)->create()
->each(function (Slider $slider) {
->each(function (Slider $slider): void {
$i = 0;
Slide::factory(3)->make()
->each(function (Slide $slide) use ($slider, &$i) {
->each(function (Slide $slide) use ($slider, &$i): void {
$slide->order = $i++;
$slide->slider()->associate($slider);
$slide->save();

View file

@ -21,7 +21,7 @@ class TextsSeeder extends Seeder
$i = 0;
Text::factory(3)->make()
->each(function (Text $encart) use ($tabEncarts, &$i) {
->each(function (Text $encart) use ($tabEncarts, &$i): void {
$encart->page = $tabEncarts[$i]->value;
$encart->save();
});

57
rector.php Normal file
View file

@ -0,0 +1,57 @@
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use RectorLaravel\Rector\Class_\CommandHiddenPropertyToHiddenAttributeRector;
use RectorLaravel\Rector\Class_\DescriptionPropertyToDescriptionAttributeRector;
use RectorLaravel\Rector\Class_\FillablePropertyToFillableAttributeRector;
use RectorLaravel\Rector\Class_\HiddenPropertyToHiddenAttributeRector;
use RectorLaravel\Rector\Class_\ModelCastsPropertyToCastsMethodRector;
use RectorLaravel\Rector\Class_\SignaturePropertyToSignatureAttributeRector;
use RectorLaravel\Rector\Class_\TablePropertyToTableAttributeRector;
use RectorLaravel\Rector\Class_\WithoutTimestampsPropertyToWithoutTimestampsAttributeRector;
use RectorLaravel\Rector\MethodCall\ValidationRuleArrayStringValueToArrayRector;
use RectorLaravel\Set\LaravelLevelSetList;
use RectorLaravel\Set\LaravelSetList;
return RectorConfig::configure()
->withAutoloadPaths([
__DIR__ . '/app',
__DIR__ . '/vendor/laravel/framework/src',
])
->withPaths([
__DIR__ . '/app',
__DIR__ . '/bootstrap',
__DIR__ . '/config',
__DIR__ . '/database',
__DIR__ . '/routes',
])
->withPhpSets(php85: true)
->withComposerBased(laravel: true)
->withSets([
LaravelLevelSetList::UP_TO_LARAVEL_130,
LaravelSetList::LARAVEL_ARRAYACCESS_TO_METHOD_CALL,
LaravelSetList::LARAVEL_CODE_QUALITY,
LaravelSetList::LARAVEL_COLLECTION,
LaravelSetList::LARAVEL_IF_HELPERS,
LaravelSetList::LARAVEL_LEGACY_FACTORIES_TO_CLASSES,
LaravelSetList::LARAVEL_TYPE_DECLARATIONS,
])
->withTypeCoverageLevel(0)
->withDeadCodeLevel(0)
->withCodeQualityLevel(0)
->withSkip([
// Disable Laravel notations.
CommandHiddenPropertyToHiddenAttributeRector::class,
DescriptionPropertyToDescriptionAttributeRector::class,
FillablePropertyToFillableAttributeRector::class,
HiddenPropertyToHiddenAttributeRector::class,
ModelCastsPropertyToCastsMethodRector::class,
SignaturePropertyToSignatureAttributeRector::class,
TablePropertyToTableAttributeRector::class,
WithoutTimestampsPropertyToWithoutTimestampsAttributeRector::class,
// Validation.
ValidationRuleArrayStringValueToArrayRector::class,
]);

View file

@ -14,6 +14,6 @@ use Illuminate\Support\Facades\Artisan;
|
*/
Artisan::command('inspire', function () {
Artisan::command('inspire', function (): void {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

View file

@ -54,7 +54,7 @@ Route::prefix('bo')
->name('bo.')
->middleware(['admin-secure'])
->group(
function () {
function (): void {
Auth::routes(
[
'login' => true,
@ -70,7 +70,7 @@ Route::prefix('bo')
);
Route::middleware(['auth:web', 'back-end-globals'])
->group(
function () {
function (): void {
Route::get(
'/',
[
@ -122,7 +122,7 @@ if (!app()->runningInConsole()) {
->prefix($lang)
->name($lang == '' ? '' : $lang . '.')
->group(
function () use ($lang) {
function () use ($lang): void {
Route::get('/', [ControllersHomeController::class, 'index'])->name('home');
Route::get(