From e48a25751350cec8e1b55493f2ce4ff51c105337 Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Wed, 27 Jul 2022 14:33:56 +0200 Subject: [PATCH] passage phpcbf --- app/Exceptions/Handler.php | 4 +- app/Http/Controllers/Auth/LoginController.php | 4 +- app/Http/Controllers/Bo/AdviceController.php | 6 +- app/Http/Controllers/Bo/EncartsController.php | 2 +- app/Http/Controllers/Bo/MomentsController.php | 1 - .../Controllers/Bo/PictoBrandsController.php | 4 +- app/Http/Controllers/Bo/PostsController.php | 8 +- app/Http/Controllers/Bo/SlidesController.php | 4 +- .../Controllers/FoodServiceController.php | 11 +- app/Http/Controllers/GammesController.php | 4 +- app/Http/Controllers/HomeController.php | 2 +- app/Http/Controllers/LegalsController.php | 2 +- app/Http/Controllers/MarqueController.php | 17 ++- app/Http/Controllers/NewsController.php | 4 +- app/Http/Controllers/ProductsController.php | 3 +- app/Http/Middleware/Authenticate.php | 6 +- app/Http/Middleware/FrontEndGlobals.php | 23 ++-- app/Lib/Utils.php | 1 + app/Models/Advice.php | 12 +- app/Models/Encart.php | 4 +- app/Models/Picto.php | 4 +- app/Models/PictoBrand.php | 4 +- app/Models/Post.php | 8 +- app/Models/Slide.php | 4 +- app/Providers/AuthServiceProvider.php | 1 - app/Providers/EventServiceProvider.php | 1 - app/Providers/RouteServiceProvider.php | 9 +- app/Traits/CastsEnumsHasTranslations.php | 14 +- config/app.php | 2 +- config/cache.php | 2 +- config/database.php | 2 +- config/filesystems.php | 2 +- config/sanctum.php | 2 +- config/session.php | 2 +- config/translation.php | 4 +- routes/api.php | 3 - routes/channels.php | 2 +- routes/web.php | 128 +++++++++--------- 38 files changed, 162 insertions(+), 154 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index f34f3c8..1d545c0 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -2,7 +2,7 @@ /** * Undocumented class - * + * * @category Description * @package Category * @author Name @@ -17,7 +17,7 @@ use Kwaadpepper\ExceptionHandler\Exceptions\ExceptionHandler; /** * Undocumented class - * + * * @category Description * @package Category * @author Name diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 6b023f8..96ef86d 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,7 +2,7 @@ /** * Controller pour le login - * + * * @category Description * @package Category * @author Name @@ -19,7 +19,7 @@ use Illuminate\Foundation\Auth\AuthenticatesUsers; /** * Undocumented class - * + * * @category Description * @package Category * @author Name diff --git a/app/Http/Controllers/Bo/AdviceController.php b/app/Http/Controllers/Bo/AdviceController.php index 0d66ac4..4a1aa38 100644 --- a/app/Http/Controllers/Bo/AdviceController.php +++ b/app/Http/Controllers/Bo/AdviceController.php @@ -31,13 +31,13 @@ class AdviceController extends Controller public function update(Advice $advice, UpdateAdviceRequest $request) { $advice->fill($request->validated()); - if (is_a($request->picture1,"SplFileInfo")) { + if (is_a($request->picture1, "SplFileInfo")) { $advice->picture1 = Utils::storeImage($request->picture1, $advice->getTable()); } - if (is_a($request->picture2,"SplFileInfo")) { + if (is_a($request->picture2, "SplFileInfo")) { $advice->picture2 = Utils::storeImage($request->picture2, $advice->getTable()); } - if (is_a($request->picture3,"SplFileInfo")) { + if (is_a($request->picture3, "SplFileInfo")) { $advice->picture3 = Utils::storeImage($request->picture3, $advice->getTable()); } diff --git a/app/Http/Controllers/Bo/EncartsController.php b/app/Http/Controllers/Bo/EncartsController.php index 6cc4f17..faad408 100644 --- a/app/Http/Controllers/Bo/EncartsController.php +++ b/app/Http/Controllers/Bo/EncartsController.php @@ -30,7 +30,7 @@ class EncartsController extends Controller public function update(Encart $encart, UpdateEncartRequest $request) { $encart->fill($request->validated()); - if (is_a($request->picture,"SplFileInfo")) { + if (is_a($request->picture, "SplFileInfo")) { $encart->picture = Utils::storeImage($request->picture, $encart->getTable()); } diff --git a/app/Http/Controllers/Bo/MomentsController.php b/app/Http/Controllers/Bo/MomentsController.php index ffb66e9..d4ab9a2 100644 --- a/app/Http/Controllers/Bo/MomentsController.php +++ b/app/Http/Controllers/Bo/MomentsController.php @@ -9,7 +9,6 @@ use App\Models\Moment; class MomentsController extends Controller { - /** * Display a listing of the resource. * diff --git a/app/Http/Controllers/Bo/PictoBrandsController.php b/app/Http/Controllers/Bo/PictoBrandsController.php index f5aedf2..0da0131 100644 --- a/app/Http/Controllers/Bo/PictoBrandsController.php +++ b/app/Http/Controllers/Bo/PictoBrandsController.php @@ -43,7 +43,7 @@ class PictoBrandsController extends Controller public function store(StorePictoBrandRequest $request) { $pictobrand = new PictoBrand($request->validated()); - if (is_a($request->picture,"SplFileInfo")) { + if (is_a($request->picture, "SplFileInfo")) { $pictobrand->picture = Utils::storeImage($request->picture, $pictobrand->getTable()); } @@ -75,7 +75,7 @@ class PictoBrandsController extends Controller public function update(PictoBrand $pictobrand, UpdatePictoBrandRequest $request) { $pictobrand->fill($request->validated()); - if (is_a($request->picture,"SplFileInfo")) { + if (is_a($request->picture, "SplFileInfo")) { $pictobrand->picture = Utils::storeImage($request->picture, $pictobrand->getTable()); } diff --git a/app/Http/Controllers/Bo/PostsController.php b/app/Http/Controllers/Bo/PostsController.php index a9af0b0..c62a6df 100644 --- a/app/Http/Controllers/Bo/PostsController.php +++ b/app/Http/Controllers/Bo/PostsController.php @@ -43,10 +43,10 @@ class PostsController extends Controller public function store(StorePostRequest $request) { $post = new Post($request->validated()); - if (is_a($request->picture_home,"SplFileInfo")) { + if (is_a($request->picture_home, "SplFileInfo")) { $post->picture_home = Utils::storeImage($request->picture_home, $post->getTable()); } - if (is_a($request->picture_news,"SplFileInfo")) { + if (is_a($request->picture_news, "SplFileInfo")) { $post->picture_news = Utils::storeImage($request->picture_news, $post->getTable()); } $response = $this->changeUniquePostOnTop($post->on_top); @@ -82,10 +82,10 @@ class PostsController extends Controller public function update(Post $post, UpdatePostRequest $request) { $post->fill($request->validated()); - if (is_a($request->picture_home,"SplFileInfo")) { + if (is_a($request->picture_home, "SplFileInfo")) { $post->picture_home = Utils::storeImage($request->picture_home, $post->getTable()); } - if (is_a($request->picture_news,"SplFileInfo")) { + if (is_a($request->picture_news, "SplFileInfo")) { $post->picture_news = Utils::storeImage($request->picture_news, $post->getTable()); } $response = $this->changeUniquePostOnTop($post->on_top); diff --git a/app/Http/Controllers/Bo/SlidesController.php b/app/Http/Controllers/Bo/SlidesController.php index 08354a4..910ecdd 100644 --- a/app/Http/Controllers/Bo/SlidesController.php +++ b/app/Http/Controllers/Bo/SlidesController.php @@ -46,7 +46,7 @@ class SlidesController extends Controller $slide = new Slide($request->validated()); $slide->order = $this->getLastOrder(); - if (is_a($request->picture,"SplFileInfo")) { + if (is_a($request->picture, "SplFileInfo")) { $slide->picture = Utils::storeImage($request->picture, $slide->getTable()); } @@ -79,7 +79,7 @@ class SlidesController extends Controller public function update(StoreSlideRequest $request, Slide $slide) { $slide->fill($request->validated()); - if (is_a($request->picture,"SplFileInfo")) { + if (is_a($request->picture, "SplFileInfo")) { $slide->picture = Utils::storeImage($request->picture, $slide->getTable()); } diff --git a/app/Http/Controllers/FoodServiceController.php b/app/Http/Controllers/FoodServiceController.php index 3e69860..fb78bc4 100644 --- a/app/Http/Controllers/FoodServiceController.php +++ b/app/Http/Controllers/FoodServiceController.php @@ -14,14 +14,19 @@ class FoodServiceController extends Controller public function index() { $page = Page::foodservice(); - $seoDatum = SeoDatum::where('page',$page)->first(); + $seoDatum = SeoDatum::where('page', $page)->first(); $encart_food = Encart::where('page', Page::foodHeader()->value)->first(); $title_foodBloc2 = Title::where('page', Page::foodBloc2()->value)->first(); $pictos_food = Picto::where('page', Page::foodBloc2()->value)->get(); $products_food = Product::where('is_food_service', true)->get(); - return view('front.food-service', compact('seoDatum' , 'encart_food', 'title_foodBloc2', - 'pictos_food', 'products_food')); + return view('front.food-service', compact( + 'seoDatum', + 'encart_food', + 'title_foodBloc2', + 'pictos_food', + 'products_food' + )); } } diff --git a/app/Http/Controllers/GammesController.php b/app/Http/Controllers/GammesController.php index ae6b750..976a0d9 100644 --- a/app/Http/Controllers/GammesController.php +++ b/app/Http/Controllers/GammesController.php @@ -14,11 +14,11 @@ class GammesController extends Controller $gammes = Gamme::whereNull('parent_gamme_id')->orderBy('title')->get(); //remove Food Service from count /** @var \Illuminate\Database\Eloquent\Collection $gammes */ - $gammes = $gammes->whereNotIn('slug','food-service'); + $gammes = $gammes->whereNotIn('slug', 'food-service'); $nb_gammes = $gammes->count(); $page = Page::gammes(); - $seoDatum = SeoDatum::where('page',$page)->first(); + $seoDatum = SeoDatum::where('page', $page)->first(); return view('front.gammes.index', compact('gammes', 'nb_gammes', 'seoDatum')); } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index e0e7dc8..e6d0410 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -17,7 +17,7 @@ class HomeController extends Controller { $page = Page::home(); - $seoDatum = SeoDatum::where('page',$page)->first(); + $seoDatum = SeoDatum::where('page', $page)->first(); $slider = Slider::where('published', 1)->first(); if ($slider) { diff --git a/app/Http/Controllers/LegalsController.php b/app/Http/Controllers/LegalsController.php index 346340b..46f6dbd 100644 --- a/app/Http/Controllers/LegalsController.php +++ b/app/Http/Controllers/LegalsController.php @@ -16,6 +16,6 @@ class LegalsController extends Controller $seoDatum = new SeoDatum(); $seoDatum->title = $mentions_legales->title; - return view('front.legals', compact('seoDatum' ,'mentions_legales')); + return view('front.legals', compact('seoDatum', 'mentions_legales')); } } diff --git a/app/Http/Controllers/MarqueController.php b/app/Http/Controllers/MarqueController.php index 7e41062..390bcdc 100644 --- a/app/Http/Controllers/MarqueController.php +++ b/app/Http/Controllers/MarqueController.php @@ -15,7 +15,7 @@ class MarqueController extends Controller public function index() { $page = Page::marque(); - $seoDatum = SeoDatum::where('page',$page)->first(); + $seoDatum = SeoDatum::where('page', $page)->first(); $encart_marqueHeader = Encart::where('page', Page::marqueHeader()->value)->first(); $encart_marqueBloc4l = Encart::where('page', Page::marqueBloc4l()->value)->first(); @@ -28,8 +28,17 @@ class MarqueController extends Controller $title_marqueBloc4 = Title::where('page', Page::marqueBloc4()->value)->first(); $moments = Moment::where('page', Page::marqueHistory()->value)->get(); - return view('front.a-propos', compact('seoDatum', 'encart_marqueHeader', 'encart_marqueBloc4l', - 'encart_marqueBloc4r', 'encart_marqueFooter', 'pictobrands_marque', 'title_marqueBloc2', - 'pictos_marqueBloc2', 'moments', 'title_marqueBloc4')); + return view('front.a-propos', compact( + 'seoDatum', + 'encart_marqueHeader', + 'encart_marqueBloc4l', + 'encart_marqueBloc4r', + 'encart_marqueFooter', + 'pictobrands_marque', + 'title_marqueBloc2', + 'pictos_marqueBloc2', + 'moments', + 'title_marqueBloc4' + )); } } diff --git a/app/Http/Controllers/NewsController.php b/app/Http/Controllers/NewsController.php index 53a534e..c861436 100644 --- a/app/Http/Controllers/NewsController.php +++ b/app/Http/Controllers/NewsController.php @@ -16,7 +16,7 @@ class NewsController extends Controller public function index() { $page = Page::news(); - $seoDatum = SeoDatum::where('page',$page)->first(); + $seoDatum = SeoDatum::where('page', $page)->first(); $advice_news = Advice::all()->first(); $texts_news = Text::where('page', Page::newsQuestions()->value)->get(); @@ -31,6 +31,6 @@ class NewsController extends Controller $products_news = Product::where('is_news', true)->get(); - return view('front.news', compact('seoDatum', 'advice_news' , 'texts_news', 'title_newsPosts', 'posts', 'products_news')); + return view('front.news', compact('seoDatum', 'advice_news', 'texts_news', 'title_newsPosts', 'posts', 'products_news')); } } diff --git a/app/Http/Controllers/ProductsController.php b/app/Http/Controllers/ProductsController.php index 2fc023a..168cdb1 100644 --- a/app/Http/Controllers/ProductsController.php +++ b/app/Http/Controllers/ProductsController.php @@ -19,7 +19,8 @@ class ProductsController extends Controller return view('front.product', compact('product', 'gamme', 'seoDatum')); } - public function search(Request $request) { + public function search(Request $request) + { $filter = $request->query('filter'); if (!empty($filter)) { diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 9f0ec64..e7cc52d 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -2,7 +2,7 @@ /** * Middleware pour l'auth - * + * * @category Description * @package Category * @author Name @@ -17,7 +17,7 @@ use Illuminate\Auth\Middleware\Authenticate as Middleware; /** * Undocumented class - * + * * @category Description * @package Category * @author Name @@ -30,7 +30,7 @@ class Authenticate extends Middleware * Get the path the user should be redirected to when they are not authenticated. * * @param \Illuminate\Http\Request $request La requĂȘte - * + * * @return string|null */ protected function redirectTo($request) diff --git a/app/Http/Middleware/FrontEndGlobals.php b/app/Http/Middleware/FrontEndGlobals.php index f61f8bd..8e870d8 100644 --- a/app/Http/Middleware/FrontEndGlobals.php +++ b/app/Http/Middleware/FrontEndGlobals.php @@ -23,17 +23,17 @@ 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'); - if (preg_match('/^(en|es)/', $currentRoute )) { - $currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute,1); - $currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute,1); - $currentRouteES = preg_replace('/^(en|es)/', 'es', $currentRoute,1); + array_walk($routeParamsFR, array($this, 'unbind'), ''); + array_walk($routeParamsEN, array($this, 'unbind'), 'en'); + array_walk($routeParamsES, array($this, 'unbind'), 'es'); + if (preg_match('/^(en|es)/', $currentRoute)) { + $currentRouteFR = preg_replace('/^(en|es)\./', '', $currentRoute, 1); + $currentRouteEN = preg_replace('/^(en|es)/', 'en', $currentRoute, 1); + $currentRouteES = preg_replace('/^(en|es)/', 'es', $currentRoute, 1); } else { $currentRouteFR = $currentRoute; - $currentRouteEN = 'en.'.$currentRoute; - $currentRouteES = 'es.'.$currentRoute; + $currentRouteEN = 'en.' . $currentRoute; + $currentRouteES = 'es.' . $currentRoute; } View::share('currentRouteFR', $currentRouteFR); @@ -46,8 +46,9 @@ class FrontEndGlobals return $next($request); } - public function unbind(&$item,$k,$lang) { - if($k=='gammeSlug' || $k=='productSlug') { + public function unbind(&$item, $k, $lang) + { + if ($k == 'gammeSlug' || $k == 'productSlug') { $item = $item->getTranslation('slug', $lang); } } diff --git a/app/Lib/Utils.php b/app/Lib/Utils.php index bd71817..1d539ce 100644 --- a/app/Lib/Utils.php +++ b/app/Lib/Utils.php @@ -7,6 +7,7 @@ use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\File; use Illuminate\Support\Str; use SplFileInfo; + /** * Some utilities methods * diff --git a/app/Models/Advice.php b/app/Models/Advice.php index 82b6b24..5a0a00a 100644 --- a/app/Models/Advice.php +++ b/app/Models/Advice.php @@ -42,25 +42,25 @@ class Advice extends Model protected static function boot() { static::creating(function (Advice $advice) { - if (is_a($advice->picture1,"SplFileInfo")) { + if (is_a($advice->picture1, "SplFileInfo")) { $advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable()); } - if (is_a($advice->picture2,"SplFileInfo")) { + if (is_a($advice->picture2, "SplFileInfo")) { $advice->picture2 = Utils::storeImage($advice->picture2, $advice->getTable()); } - if (is_a($advice->picture3,"SplFileInfo")) { + if (is_a($advice->picture3, "SplFileInfo")) { $advice->picture3 = Utils::storeImage($advice->picture3, $advice->getTable()); } }); static::updating(function (Advice $advice) { - if (is_a($advice->picture1,"SplFileInfo")) { + if (is_a($advice->picture1, "SplFileInfo")) { $advice->picture1 = Utils::storeImage($advice->picture1, $advice->getTable()); } - if (is_a($advice->picture2,"SplFileInfo")) { + if (is_a($advice->picture2, "SplFileInfo")) { $advice->picture2 = Utils::storeImage($advice->picture2, $advice->getTable()); } - if (is_a($advice->picture3,"SplFileInfo")) { + if (is_a($advice->picture3, "SplFileInfo")) { $advice->picture3 = Utils::storeImage($advice->picture3, $advice->getTable()); } }); diff --git a/app/Models/Encart.php b/app/Models/Encart.php index c997309..4dd8794 100644 --- a/app/Models/Encart.php +++ b/app/Models/Encart.php @@ -37,13 +37,13 @@ class Encart extends Model protected static function boot() { static::creating(function (Encart $encart) { - if (is_a($encart->picture,"SplFileInfo")) { + if (is_a($encart->picture, "SplFileInfo")) { $encart->picture = Utils::storeImage($encart->picture, $encart->getTable()); } }); static::updating(function (Encart $encart) { - if (is_a($encart->picture,"SplFileInfo")) { + if (is_a($encart->picture, "SplFileInfo")) { $encart->picture = Utils::storeImage($encart->picture, $encart->getTable()); } }); diff --git a/app/Models/Picto.php b/app/Models/Picto.php index c30a342..70adefc 100644 --- a/app/Models/Picto.php +++ b/app/Models/Picto.php @@ -33,13 +33,13 @@ class Picto extends Model protected static function boot() { static::creating(function (Picto $picto) { - if (is_a($picto->picture,"SplFileInfo")) { + if (is_a($picto->picture, "SplFileInfo")) { $picto->picture = Utils::storeImage($picto->picture, $picto->getTable()); } }); static::updating(function (Picto $picto) { - if (is_a($picto->picture,"SplFileInfo")) { + if (is_a($picto->picture, "SplFileInfo")) { $picto->picture = Utils::storeImage($picto->picture, $picto->getTable()); } }); diff --git a/app/Models/PictoBrand.php b/app/Models/PictoBrand.php index f5232e7..bb08aba 100644 --- a/app/Models/PictoBrand.php +++ b/app/Models/PictoBrand.php @@ -30,13 +30,13 @@ class PictoBrand extends Model protected static function boot() { static::creating(function (PictoBrand $pictoBrand) { - if (is_a($pictoBrand->picture,"SplFileInfo")) { + if (is_a($pictoBrand->picture, "SplFileInfo")) { $pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable()); } }); static::updating(function (PictoBrand $pictoBrand) { - if (is_a($pictoBrand->picture,"SplFileInfo")) { + if (is_a($pictoBrand->picture, "SplFileInfo")) { $pictoBrand->picture = Utils::storeImage($pictoBrand->picture, $pictoBrand->getTable()); } }); diff --git a/app/Models/Post.php b/app/Models/Post.php index 8e22b28..a36ab92 100644 --- a/app/Models/Post.php +++ b/app/Models/Post.php @@ -47,19 +47,19 @@ class Post extends Model protected static function boot() { static::creating(function (Post $post) { - if (is_a($post->picture_home,"SplFileInfo")) { + if (is_a($post->picture_home, "SplFileInfo")) { $post->picture_home = Utils::storeImage($post->picture_home, $post->getTable()); } - if (is_a($post->picture_news,"SplFileInfo")) { + if (is_a($post->picture_news, "SplFileInfo")) { $post->picture_news = Utils::storeImage($post->picture_news, $post->getTable()); } }); static::updating(function (Post $post) { - if (is_a($post->picture_home,"SplFileInfo")) { + if (is_a($post->picture_home, "SplFileInfo")) { $post->picture_home = Utils::storeImage($post->picture_home, $post->getTable()); } - if (is_a($post->picture_news,"SplFileInfo")) { + if (is_a($post->picture_news, "SplFileInfo")) { $post->picture_news = Utils::storeImage($post->picture_news, $post->getTable()); } }); diff --git a/app/Models/Slide.php b/app/Models/Slide.php index 87eebed..8fc4c75 100644 --- a/app/Models/Slide.php +++ b/app/Models/Slide.php @@ -48,13 +48,13 @@ class Slide extends Model protected static function boot() { static::creating(function (Slide $slide) { - if (is_a($slide->picture,"SplFileInfo")) { + if (is_a($slide->picture, "SplFileInfo")) { $slide->picture = Utils::storeImage($slide->picture, $slide->getTable()); } }); static::updating(function (Slide $slide) { - if (is_a($slide->picture,"SplFileInfo")) { + if (is_a($slide->picture, "SplFileInfo")) { $slide->picture = Utils::storeImage($slide->picture, $slide->getTable()); } }); diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index ce74491..d49c386 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -3,7 +3,6 @@ namespace App\Providers; use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; -use Illuminate\Support\Facades\Gate; class AuthServiceProvider extends ServiceProvider { diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index a9f10a6..46acbe0 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -5,7 +5,6 @@ namespace App\Providers; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; -use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index d1397b9..5224fd9 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -50,17 +50,16 @@ class RouteServiceProvider extends ServiceProvider ->group(base_path('routes/web.php')); }); - Route::bind('gammeSlug', function($value, $route) { - $gamme = Gamme::where('slug', 'LIKE', '%:"'.$value.'"%')->firstOrFail(); + Route::bind('gammeSlug', function ($value, $route) { + $gamme = Gamme::where('slug', 'LIKE', '%:"' . $value . '"%')->firstOrFail(); return $gamme; }); - Route::bind('productSlug', function($value, $route) { + Route::bind('productSlug', function ($value, $route) { $gamme = $route->parameter('gammeSlug'); - $product = Product::where('slug', 'LIKE', '%:"'.$value.'"%')->where('gamme_id', $gamme->id)->firstOrFail(); + $product = Product::where('slug', 'LIKE', '%:"' . $value . '"%')->where('gamme_id', $gamme->id)->firstOrFail(); return $product; }); - } /** diff --git a/app/Traits/CastsEnumsHasTranslations.php b/app/Traits/CastsEnumsHasTranslations.php index bc934a7..c81de92 100644 --- a/app/Traits/CastsEnumsHasTranslations.php +++ b/app/Traits/CastsEnumsHasTranslations.php @@ -5,10 +5,9 @@ namespace App\Traits; use Kwaadpepper\Enum\Traits\CastsEnums; use Spatie\Translatable\HasTranslations; -trait CastsEnumsHasTranslations { - - use CastsEnums, HasTranslations - { +trait CastsEnumsHasTranslations +{ + use CastsEnums, HasTranslations { CastsEnums::getAttributeValue as enumGetAttributeValue; CastsEnums::setAttribute as enumSetAttribute; HasTranslations::getAttributeValue as transGetAttributeValue; @@ -21,7 +20,7 @@ trait CastsEnumsHasTranslations { public function getAttributeValue($key) { if ($this->hasEnumCast($key)) { - return $this->enumGetAttributeValue($key); + return $this->enumGetAttributeValue($key); } return $this->transGetAttributeValue($key); @@ -34,9 +33,8 @@ trait CastsEnumsHasTranslations { { if ($this->hasEnumCast($key)) { return $this->enumSetAttribute($key, $value); + } - } - - return $this->transSetAttribute($key,$value); + return $this->transSetAttribute($key, $value); } } diff --git a/config/app.php b/config/app.php index e1f87fb..7f91e09 100644 --- a/config/app.php +++ b/config/app.php @@ -39,7 +39,7 @@ return [ | */ - 'debug' => (bool) env('APP_DEBUG', false), + 'debug' => (bool)env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- diff --git a/config/cache.php b/config/cache.php index 8736c7a..e9eb649 100644 --- a/config/cache.php +++ b/config/cache.php @@ -105,6 +105,6 @@ return [ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'), ]; diff --git a/config/database.php b/config/database.php index b42d9b3..3bfc47a 100644 --- a/config/database.php +++ b/config/database.php @@ -123,7 +123,7 @@ return [ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), ], 'default' => [ diff --git a/config/filesystems.php b/config/filesystems.php index 760ef97..e6b2e79 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -38,7 +38,7 @@ return [ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', ], diff --git a/config/sanctum.php b/config/sanctum.php index 442726a..3c92b7a 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -16,7 +16,7 @@ return [ 'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( '%s%s', 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', - env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' + env('APP_URL') ? ',' . parse_url(env('APP_URL'), PHP_URL_HOST) : '' ))), /* diff --git a/config/session.php b/config/session.php index ac0802b..c487a7e 100644 --- a/config/session.php +++ b/config/session.php @@ -128,7 +128,7 @@ return [ 'cookie' => env( 'SESSION_COOKIE', - Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + Str::slug(env('APP_NAME', 'laravel'), '_') . '_session' ), /* diff --git a/config/translation.php b/config/translation.php index ad5dd37..faf38ec 100644 --- a/config/translation.php +++ b/config/translation.php @@ -52,8 +52,8 @@ return [ 'scan_paths' => [ //app_path(), //resource_path().'\views\back', - resource_path().'/views/front', - resource_path().'/views/layouts/frontend', + resource_path() . '/views/front', + resource_path() . '/views/layouts/frontend', ], /* diff --git a/routes/api.php b/routes/api.php index 1612b32..51535fb 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,8 +1,5 @@ id === (int) $id; + return (int)$user->id === (int)$id; }); diff --git a/routes/web.php b/routes/web.php index e5919c7..e888c48 100644 --- a/routes/web.php +++ b/routes/web.php @@ -54,60 +54,60 @@ Route::prefix('bo') ->name('bo.') ->middleware(['admin-secure']) ->group( - function () { - Auth::routes( - [ - 'login' => true, - 'logout' => true, - 'register' => false, - 'reset' => false, // for resetting passwords - 'confirm' => false, // for additional password confirmations - 'verify' => false, // for email verification - ] - ); - Route::middleware(['auth:web', 'back-end-globals', 'lang-check']) - ->group( - function () { - Route::get( - '/', - [ - HomeController::class, - 'home' - ] - )->name('home'); - Route::resources( - [ - 'sliders' => SlidersController::class, - 'slides' => SlidesController::class, - ] - ); - Route::resource('seo_data', SeoDataController::class) - ->except(['index', 'create', 'store', 'destroy', 'show']); - Route::resource('moments', MomentsController::class) - ->except(['create', 'store', 'destroy', 'show']); - Route::resource('encarts', EncartsController::class) - ->except(['index', 'create', 'store', 'destroy', 'show']); - Route::resource('pictos', PictosController::class)->except(['show']); - Route::resource('posts', PostsController::class)->except(['show']); - Route::resource('pictobrands', PictoBrandsController::class)->except(['show']); - Route::resource('gammes', GammesController::class)->except(['show']); - Route::resource('products', ProductsController::class)->except(['show']); - Route::resource('advice', AdviceController::class) - ->except(['index', 'create', 'store', 'destroy', 'show']); - Route::resource('texts', TextsController::class)->except(['show']); - Route::resource('titles', TitlesController::class) - ->except(['index', 'create', 'store', 'destroy', 'show']); - Route::get( - '/slide/change-order/{slide}/{action}', - [ - SlidesController::class, - 'changeOrder' - ] - )->name('slides.change-order'); - Route::get('/pictos/{page}', [PictosController::class, 'index'])->name('pictos.content'); - Route::get('/texts/{page}', [TextsController::class, 'index'])->name('texts.content'); - } - ); + function () { + Auth::routes( + [ + 'login' => true, + 'logout' => true, + 'register' => false, + 'reset' => false, // for resetting passwords + 'confirm' => false, // for additional password confirmations + 'verify' => false, // for email verification + ] + ); + Route::middleware(['auth:web', 'back-end-globals', 'lang-check']) + ->group( + function () { + Route::get( + '/', + [ + HomeController::class, + 'home' + ] + )->name('home'); + Route::resources( + [ + 'sliders' => SlidersController::class, + 'slides' => SlidesController::class, + ] + ); + Route::resource('seo_data', SeoDataController::class) + ->except(['index', 'create', 'store', 'destroy', 'show']); + Route::resource('moments', MomentsController::class) + ->except(['create', 'store', 'destroy', 'show']); + Route::resource('encarts', EncartsController::class) + ->except(['index', 'create', 'store', 'destroy', 'show']); + Route::resource('pictos', PictosController::class)->except(['show']); + Route::resource('posts', PostsController::class)->except(['show']); + Route::resource('pictobrands', PictoBrandsController::class)->except(['show']); + Route::resource('gammes', GammesController::class)->except(['show']); + Route::resource('products', ProductsController::class)->except(['show']); + Route::resource('advice', AdviceController::class) + ->except(['index', 'create', 'store', 'destroy', 'show']); + Route::resource('texts', TextsController::class)->except(['show']); + Route::resource('titles', TitlesController::class) + ->except(['index', 'create', 'store', 'destroy', 'show']); + Route::get( + '/slide/change-order/{slide}/{action}', + [ + SlidesController::class, + 'changeOrder' + ] + )->name('slides.change-order'); + Route::get('/pictos/{page}', [PictosController::class, 'index'])->name('pictos.content'); + Route::get('/texts/{page}', [TextsController::class, 'index'])->name('texts.content'); + } + ); } ); @@ -120,21 +120,21 @@ foreach ($langs as $lang) { ->group( function () use ($lang) { Route::get('/', [ControllersHomeController::class, 'index'])->name('home'); - Route::get('/'.Str::slug(Lang::get('urls.marque',[], $lang)), [ControllersMarqueController::class, 'index'])->name('wasup'); - Route::get('/'.Str::slug(Lang::get('urls.gammes',[], $lang)), [ControllersGammesController::class, 'index'])->name('gammes.index'); - Route::get('/'.Str::slug(Lang::get('urls.gamme',[], $lang)).'/{gammeSlug}', [ControllersGammesController::class, 'show'])->name('gammes.show'); + Route::get('/' . Str::slug(Lang::get('urls.marque', [], $lang)), [ControllersMarqueController::class, 'index'])->name('wasup'); + Route::get('/' . Str::slug(Lang::get('urls.gammes', [], $lang)), [ControllersGammesController::class, 'index'])->name('gammes.index'); + Route::get('/' . Str::slug(Lang::get('urls.gamme', [], $lang)) . '/{gammeSlug}', [ControllersGammesController::class, 'show'])->name('gammes.show'); Route::get( - '/'.Str::slug(Lang::get('urls.produit',[], $lang)).'/{gammeSlug}/{productSlug}', + '/' . Str::slug(Lang::get('urls.produit', [], $lang)) . '/{gammeSlug}/{productSlug}', [ControllersProductsController::class, 'show'] )->name('product.show'); - Route::get('/'.Str::slug(Lang::get('urls.news',[], $lang)), [ControllersNewsController::class, 'index'])->name('news'); - Route::get('/'.Str::slug(Lang::get('urls.food-service',[], $lang)), [ControllersFoodServiceController::class, 'index'])->name('food'); - Route::get('/'.Str::slug(Lang::get('urls.legals',[], $lang)), [ControllersLegalsController::class, 'index'])->name('cgu'); - Route::get('/'.Str::slug(Lang::get('urls.policy',[], $lang)), [ControllersPolicyController::class, 'index'])->name('policy'); + Route::get('/' . Str::slug(Lang::get('urls.news', [], $lang)), [ControllersNewsController::class, 'index'])->name('news'); + Route::get('/' . Str::slug(Lang::get('urls.food-service', [], $lang)), [ControllersFoodServiceController::class, 'index'])->name('food'); + Route::get('/' . Str::slug(Lang::get('urls.legals', [], $lang)), [ControllersLegalsController::class, 'index'])->name('cgu'); + Route::get('/' . Str::slug(Lang::get('urls.policy', [], $lang)), [ControllersPolicyController::class, 'index'])->name('policy'); //Route::view('/plan-site', 'front.site-map')->name('site-map'); - Route::get('/'.Str::slug(Lang::get('urls.search',[], $lang)), [ControllersProductsController::class, 'search'])->name('search'); + Route::get('/' . Str::slug(Lang::get('urls.search', [], $lang)), [ControllersProductsController::class, 'search'])->name('search'); //Classic - Route::get('/'.Str::slug(Lang::get('urls.contact',[], $lang)), [ControllersContactController::class, 'contact'])->name('contact'); + Route::get('/' . Str::slug(Lang::get('urls.contact', [], $lang)), [ControllersContactController::class, 'contact'])->name('contact'); Route::post('/contact', [ControllersContactController::class, 'contactSubmit'])->name('contact.submit'); } );