diff --git a/.gitignore b/.gitignore index a65d235..7d5d5d3 100644 --- a/.gitignore +++ b/.gitignore @@ -31,16 +31,42 @@ resources/theme .npm/ .composer/ .zshrc +.rector-cache/ # Ignore public favicon /public/android-chrome-192x192.png /public/android-chrome-512x512.png +/public/android-icon-144x144.png +/public/android-icon-192x192.png +/public/android-icon-36x36.png +/public/android-icon-48x48.png +/public/android-icon-72x72.png +/public/android-icon-96x96.png +/public/apple-chrome-192x192.png +/public/apple-chrome-512x512.png +/public/apple-icon-114x114.png +/public/apple-icon-120x120.png +/public/apple-icon-144x144.png +/public/apple-icon-152x152.png +/public/apple-icon-180x180.png +/public/apple-icon-57x57.png +/public/apple-icon-60x60.png +/public/apple-icon-72x72.png +/public/apple-icon-76x76.png +/public/apple-icon-precomposed.png +/public/apple-icon.png /public/apple-touch-icon.png /public/browserconfig.xml /public/browserconfig.xml /public/favicon-16x16.png /public/favicon-32x32.png +/public/favicon-96x96.png /public/favicon.ico +/public/manifest.json +/public/ms-icon-144x144.png +/public/ms-icon-150x150.png +/public/ms-icon-310x310.png +/public/ms-icon-70x70.png /public/mstile-150x150.png /public/safari-pinned-tab.svg /public/site.webmanifest diff --git a/app/Auth/CrmUserProvider.php b/app/Auth/CrmUserProvider.php index e6bc622..500fd5d 100644 --- a/app/Auth/CrmUserProvider.php +++ b/app/Auth/CrmUserProvider.php @@ -1,19 +1,27 @@ getCustomer($credentials['email']); - if (!$crmCustomer) { + if (! $crmCustomer) { // * Customer is not found on CRM. return null; } @@ -62,40 +66,38 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra } report($e); Log::error('Unhandled response ' . $e->getApiError()->label()); - } catch (CrmException | \Exception $e) { + } catch (CrmException | Exception $e) { report($e); + // Une erreur critique est survenue avec la CRM. return null; - } //end try - Log::error(__CLASS__ . '::retrieveByCredentials reached end of possibilities.'); + } // end try + Log::error(self::class . '::retrieveByCredentials reached end of possibilities.'); + return null; } /** * Validate a user against the given credentials. * - * @param UserContract $model - * @param array $credentials - * @return boolean|null - * @throws \RuntimeException If model provided is not a Customer or connection to server fails. - * @throws \LDC\LDCCRM\Exceptions\CrmException On CRM call error. - * @throws \Exception On CRM call error. + * @throws RuntimeException If model provided is not a Customer or connection to server fails. + * @throws CrmException On CRM call error. + * @throws Exception On CRM call error. */ - public function validateCredentials(UserContract $model, array $credentials): bool|null + public function validateCredentials(UserContract $model, array $credentials): ?bool { - /** @var \App\Models\Customer $model */ - if (\get_class($model) !== $this->usedModel) { - throw new \RuntimeException('Cannot authenticate any thing else than ' . $this->usedModel); + /** @var Customer $model */ + if ($model::class !== $this->usedModel) { + throw new RuntimeException('Cannot authenticate any thing else than ' . $this->usedModel); } try { - /** @var \LDC\LDCCRM\CrmApiV4 */ - $crm = app('crmAPI'); + /** @var CrmApiV4 */ + $crm = resolve('crmAPI'); // * If has trait soft delete and customer trashed, then restore customer. if ( - \in_array(\Illuminate\Database\Eloquent\SoftDeletes::class, \class_uses_recursive($model)) and - $model->trashed() + \in_array(SoftDeletes::class, \class_uses_recursive($model)) && $model->trashed() ) { $model->restore(); } @@ -104,10 +106,10 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra return $crm->login($credentials['email'], $credentials['password']); } catch (ApiErrorException $e) { if ( - $e->getApiError()->equals(ApiError::modelNotFound) || - ($e->getApiError()->equals(ApiError::authFailed) && !$model->existsInCrm()) + $e->getApiError()->equals(ApiError::modelNotFound) || ($e->getApiError()->equals(ApiError::authFailed) && ! $model->existsInCrm()) ) { $model->delete(); + return false; } if ($e->getApiError()->equals(ApiError::authFailed)) { @@ -119,31 +121,27 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra $model->save(); $model->sendEmailVerificationNotification(); Session::flash('warning', \trans('front.messages.account_not_activated')); + return true; } - } catch (CrmException | \Exception $e) { + } catch (CrmException | Exception $e) { report($e); - if (config('app.debug')) { - throw $e; - } - return false; - } //end try + throw_if(config('app.debug'), $e); + + return false; + } // end try + + Log::error(self::class . '::validateCredentials reached end of possibilities.'); - Log::error(__CLASS__ . '::validateCredentials reached end of possibilities.'); return null; } - + /** * CRM customer passwordless (Laravel 11 introduces password rehashing after login). - * - * @param \Illuminate\Contracts\Auth\Authenticatable $user - * @param array $credentials - * @param boolean $force - * @return void */ public function rehashPasswordIfRequired( UserContract $user, - #[\SensitiveParameter] array $credentials, + #[SensitiveParameter] array $credentials, bool $force = false ): void { // @@ -152,15 +150,13 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra /** * Create a local customer. * - * @param \LDC\LDCCRM\Models\Customer $crmCustomer - * @return \Illuminate\Database\Eloquent\Model - * @throws \Throwable If saving to DB failed. + * @throws Throwable If saving to DB failed. */ private function createLocalCustomer(\LDC\LDCCRM\Models\Customer $crmCustomer): Model { - /** @var \App\Models\Customer $model */ + /** @var Customer $model */ $model = $this->usedModel::withTrashed()->firstOrNew([ - 'email' => $crmCustomer->email + 'email' => $crmCustomer->email, ]); $model->hashcode = $crmCustomer->hashcode; $model->email_verified_at = $crmCustomer->status ? now() : null; @@ -175,14 +171,12 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra /** * Retrieve a trashed customer by the given credentials. * - * @param array $credentials - * @return \Illuminate\Contracts\Auth\Authenticatable|null - * @throws \ErrorException If cannot connect to LDAP. + * @throws ErrorException If cannot connect to LDAP. */ - private function retrieveTrashed(array $credentials): ?Authenticatable + private function retrieveTrashed(array $credentials): ?UserContract { // * Make changes - if (empty($credentials)) { + if ($credentials === []) { return null; } @@ -192,12 +186,12 @@ class CrmUserProvider extends EloquentUserProvider implements UserProviderContra $query = $this->createModel()->newQuery(); foreach ($credentials as $key => $value) { - if (!Str::contains($key, 'password')) { + if (! Str::contains($key, 'password')) { $query->where($key, $value); } } - /** @var \App\Models\Customer|null $query */ + /** @var Customer|null $query */ return $query->withTrashed()->first(); } } diff --git a/app/Casts/AsArrayOfDiscount.php b/app/Casts/AsArrayOfDiscount.php index ca92c0a..9ae7e97 100644 --- a/app/Casts/AsArrayOfDiscount.php +++ b/app/Casts/AsArrayOfDiscount.php @@ -1,26 +1,30 @@ + * @param Model $model + * @param mixed $value + * @return array + * * @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing */ public function get($model, string $key, $value, array $attributes): array { // phpcs:enable - return \collect(\json_decode($value, true))->map(function ($input) use ($model, $key, $attributes) { + return \collect(\json_decode($value, true))->map(function ($input) use ($model, $key, $attributes): Discount { $inputCast = new AsDiscount(); + return $inputCast->get($model, $key, \json_encode($input), $attributes); })->all(); } @@ -28,11 +32,10 @@ class AsArrayOfDiscount implements CastsAttributes /** * Prepare the given value for storage. * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string $key - * @param \App\Lib\Discount $value - * @param array $attributes + * @param Model $model + * @param Discount $value * @return string Json encoded array<\App\Lib\Discount> + * * @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing */ public function set($model, string $key, $value, array $attributes) @@ -40,6 +43,7 @@ class AsArrayOfDiscount implements CastsAttributes // phpcs:enable return \json_encode(\collect($value)->map(function ($input) use ($model, $key, $attributes) { $inputCast = new AsDiscount(); + return \json_decode($inputCast->set($model, $key, $input, $attributes)); })->all()); } diff --git a/app/Casts/AsDiscount.php b/app/Casts/AsDiscount.php index 9ca7789..0dee7b4 100644 --- a/app/Casts/AsDiscount.php +++ b/app/Casts/AsDiscount.php @@ -1,64 +1,69 @@ assertIsInput($value); - /** @var \App\Lib\Discount $value */ + + /** @var Discount $value */ return $value->toJson(); } /** * Assert is instance of \App\Lib\Discount * - * @param mixed $value - * @return void - * @throws \RuntimeException If the value is not an input. + * @throws RuntimeException If the value is not an input. */ private function assertIsInput(mixed $value): void { - if (!\is_object($value) or !($value instanceof Discount)) { + if (! \is_object($value) || ! ($value instanceof Discount)) { $value = \json_encode($value); - throw new \RuntimeException( - __CLASS__ . ' needs value to be array of \'' . Discount::class . "' given is {$value}" + throw new RuntimeException( + self::class . ' needs value to be array of \'' . Discount::class . "' given is {$value}" ); } } diff --git a/app/Casts/Ip.php b/app/Casts/Ip.php index 19087cb..b37e139 100644 --- a/app/Casts/Ip.php +++ b/app/Casts/Ip.php @@ -1,9 +1,14 @@ $attributes - * @return \IPLib\Address\AddressInterface|null + * @param array $attributes + * @return AddressInterface|null + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceAfterLastUsed */ public function get(Model $model, string $key, mixed $value, array $attributes) { // phpcs:enable - return \IPLib\Factory::parseAddressString($value); + return Factory::parseAddressString($value); } /** * Transform the attribute to its underlying model values. * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string $key - * @param \IPLib\Address\AddressInterface|string|null $value - * @param array $attributes + * @param AddressInterface|string|null $value + * @param array $attributes * @return mixed - * @throws \RuntimeException If value is not or instance of \IPLib\Address\AddressInterface. + * + * @throws RuntimeException If value is not or instance of \IPLib\Address\AddressInterface. + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceAfterLastUsed + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInImplementedInterfaceBeforeLastUsed */ public function set(Model $model, string $key, mixed $value, array $attributes) @@ -47,15 +52,12 @@ class Ip implements CastsAttributes return null; } if (is_string($value)) { - $value = \IPLib\Factory::parseAddressString($value); - } - if (!is_object($value) or !($value instanceof \IPLib\Address\AddressInterface)) { - throw new \RuntimeException( - "{$key} has to be instance of " . - \IPLib\Address\AddressInterface::class - ); + $value = Factory::parseAddressString($value); } + throw_if(! is_object($value) || ! ($value instanceof AddressInterface), RuntimeException::class, "{$key} has to be instance of " . + AddressInterface::class); $value->getAddressType(); + return $value; } } diff --git a/app/Console/Commands/TestMail.php b/app/Console/Commands/TestMail.php index 176f35a..763ab94 100644 --- a/app/Console/Commands/TestMail.php +++ b/app/Console/Commands/TestMail.php @@ -1,5 +1,7 @@ to('equipe.web@ldc.fr')->subject('Test Email'); }); } diff --git a/app/Console/Commands/Theme/SwitchCommand.php b/app/Console/Commands/Theme/SwitchCommand.php index b746674..79a8a24 100644 --- a/app/Console/Commands/Theme/SwitchCommand.php +++ b/app/Console/Commands/Theme/SwitchCommand.php @@ -1,5 +1,7 @@ fn () => search( + 'theme' => fn (): int | string => search( label: 'Search for a theme:', - placeholder: 'default-theme', options: fn (string $value): array => \collect(File::directories(\resource_path('theme'))) - ->map(fn (string $dir_path) => \pathinfo($dir_path, \PATHINFO_BASENAME)) + ->map(fn (string $dir_path): string => \pathinfo($dir_path, \PATHINFO_BASENAME)) ->filter(fn (string $dir_path) => $value ? Str::of($dir_path)->contains($value) : true) - ->filter(fn (string $dir_path) => $dir_path !== 'mounted') - ->all() - ) + ->filter(fn (string $dir_path): bool => $dir_path !== 'mounted') + ->all(), + placeholder: 'default-theme' + ), ]; } /** * Execute the console command. - * - * @return void */ public function handle(): void { @@ -65,7 +67,7 @@ class SwitchCommand extends Command implements PromptsForMissingInput "{$mount_path} is not a link, cannot remove it" ); \throw_if( - !File::delete($mount_path), + ! File::delete($mount_path), "{$mount_path} Failed to remove file" ); } diff --git a/app/Console/Commands/UserCreate.php b/app/Console/Commands/UserCreate.php index 811e378..61a015c 100644 --- a/app/Console/Commands/UserCreate.php +++ b/app/Console/Commands/UserCreate.php @@ -1,11 +1,13 @@ addRole(); $user = new User([ - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'email' => $this->email, - 'password' => $this->password, - 'role' => $this->role, - 'published' => true, - 'published_at' => Carbon::now(), + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'email' => $this->email, + 'password' => $this->password, + 'role' => $this->role, + 'published' => true, + 'published_at' => Date::now(), ]); $user->saveOrFail(); @@ -100,8 +102,6 @@ class UserCreate extends Command /** * Add a first name to the user. - * - * @return void */ private function addFirstName(): void { @@ -109,7 +109,7 @@ class UserCreate extends Command try { $tmp = $this->ask('Type the wanted user first name', 'Admin'); $validator = Validator::make(['first_name' => $tmp], [ - 'first_name' => 'required|min:3|max:255' + 'first_name' => 'required|min:3|max:255', ]); $validator->validate(); $this->first_name = $tmp; @@ -118,15 +118,14 @@ class UserCreate extends Command 'Please provide a valid first name %s', \implode(',', collect($e->errors())->flatten()->all()) )); + continue; - } //end try - }; //end while + } // end try + } // end while } /** * Add a last name to the user. - * - * @return void */ private function addLastName(): void { @@ -134,7 +133,7 @@ class UserCreate extends Command try { $tmp = $this->ask('Type the wanted user last name', 'Saïtama'); $validator = Validator::make(['last_name' => $tmp], [ - 'last_name' => 'required|min:3|max:255' + 'last_name' => 'required|min:3|max:255', ]); $validator->validate(); $this->last_name = $tmp; @@ -143,15 +142,14 @@ class UserCreate extends Command 'Please provide a valid last_name %s', \implode(',', collect($e->errors())->flatten()->all()) )); + continue; - } //end try - }; //end while + } // end try + } // end while } /** * Add an email to the user. - * - * @return void */ private function addEmail(): void { @@ -159,7 +157,7 @@ class UserCreate extends Command try { $tmp = $this->ask('Type the wanted user email', 'equipe.web@ldc.fr'); $validator = Validator::make(['email' => $tmp], [ - 'email' => 'required|unique:users,email|email:rfc,dns' + 'email' => 'required|unique:users,email|email:rfc,dns', ]); $validator->validate(); $this->email = $tmp; @@ -168,31 +166,26 @@ class UserCreate extends Command 'Please provide a valid email %s', \implode(',', collect($e->errors())->flatten()->all()) )); + continue; - } //end try - }; //end while + } // end try + } // end while } /** * Add a password to the user. - * - * @return void */ private function addPassword(): void { - while ( - ($this->password = $this->secret( - (!\is_null($this->password) ? 'Failed to confirm, ' : '') . 'Type the wanted user password' - )) !== $this->secret('Confirm the password') - ) { - continue; - }; //end while + do { + $prefix = $this->password !== null ? 'Failed to confirm, ' : ''; + $this->password = $this->secret($prefix . 'Type the wanted user password'); + $confirmation = $this->secret('Confirm the password'); + } while ($this->password !== $confirmation); } /** * Add a role to the user. - * - * @return void */ private function addRole(): void { @@ -215,7 +208,7 @@ class UserCreate extends Command $tmp = RoleEnum::marketing; } $validator = Validator::make(['role' => $tmp], [ - 'role' => 'required' + 'role' => 'required', ]); $validator->validate(); $this->role = $tmp; @@ -224,8 +217,9 @@ class UserCreate extends Command 'Please choose from the selection %s', \implode(',', collect($e->errors())->flatten()->all()) )); + continue; - } //end try - }; //end while + } // end try + } // end while } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 32f6421..0becb5f 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,8 +1,9 @@ name => 'Suppression', ]; - /** * Custom added classes definition */ @@ -38,8 +39,6 @@ enum ActivityLogsEventEnum: int /** * Get Class - * - * @return string */ public function bootstrapClass(): string { diff --git a/app/Enums/CodeType.php b/app/Enums/CodeType.php index e2424d3..85a18be 100644 --- a/app/Enums/CodeType.php +++ b/app/Enums/CodeType.php @@ -1,5 +1,7 @@ , \Psr\Log\LogLevel::*> + * @var array, \Psr\Log\LogLevel::*> */ + #[\Override] protected $levels = []; /** * A list of the exception types that are not reported. * - * @var array> + * @var array> */ + #[\Override] protected $dontReport = []; /** @@ -26,6 +30,7 @@ class Handler extends ExceptionHandler * * @var array */ + #[\Override] protected $dontFlash = [ 'current_password', 'password', @@ -34,14 +39,12 @@ class Handler extends ExceptionHandler /** * Register the exception handling callbacks for the application. - * - * @return void */ - public function register() + public function register(): void { - $this->reportable(function (Throwable $e) { + $this->reportable(function (Throwable $e): void { if (app()->bound('sentry')) { - app('sentry')->captureException($e); + resolve('sentry')->captureException($e); } }); } diff --git a/app/Http/Controllers/Bo/ActivityLogController.php b/app/Http/Controllers/Bo/ActivityLogController.php index 957dc19..90ad4ae 100644 --- a/app/Http/Controllers/Bo/ActivityLogController.php +++ b/app/Http/Controllers/Bo/ActivityLogController.php @@ -1,11 +1,15 @@ authorize('isConceptor'); - /** @var \Illuminate\Database\Eloquent\Builder $query */ + + /** @var Builder $query */ $query = ActivityLog::query()->with('user'); /** @var string $search Search field */ @@ -45,25 +47,32 @@ class ActivityLogController extends Controller /** Custom pagination */ $activitylogModels = $this->paginate($query); - return view('back::pages.activity_logs.index', compact('activitylogModels', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.activity_logs.index'; + + return view($view, [ + 'activitylogModels' => $activitylogModels, + 'search' => $search, + 'searchFields' => $searchFields, + ]); } /** * Show the form for editing the specified resource. - * - * @param \App\Models\ActivityLog $activity_log - * @return \Illuminate\Contracts\View\View */ - public function show(ActivityLog $activity_log): \Illuminate\Contracts\View\View + public function show(ActivityLog $activity_log): View { $this->authorize('isConceptor'); $targetModelClass = $activity_log->model_class; $targetModel = $activity_log->model_class::where( - (new $targetModelClass())->getRouteKeyName(), + new $targetModelClass()->getRouteKeyName(), $activity_log->model_id )->first(); - return view('back::pages.activity_logs.show', [ + /** @var view-string $view */ + $view = 'back::pages.activity_logs.show'; + + return view($view, [ 'activitylogModel' => $activity_log, 'targetModel' => $targetModel, ]); diff --git a/app/Http/Controllers/Bo/Auth/LoginController.php b/app/Http/Controllers/Bo/Auth/LoginController.php index 7c9aad3..4e0fbc2 100644 --- a/app/Http/Controllers/Bo/Auth/LoginController.php +++ b/app/Http/Controllers/Bo/Auth/LoginController.php @@ -1,5 +1,7 @@ credentials($request); // * Attempt login only using published users. $credentials['published'] = true; + return $this->guard()->attempt( $credentials, $request->boolean('remember') diff --git a/app/Http/Controllers/Bo/Auth/ResetPasswordController.php b/app/Http/Controllers/Bo/Auth/ResetPasswordController.php index 03340fc..27a6ac1 100644 --- a/app/Http/Controllers/Bo/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Bo/Auth/ResetPasswordController.php @@ -1,5 +1,7 @@ paginate($bannedipModels); - return view('back::pages.banned-ips.index', compact('bannedipModels', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.banned-ips.index'; + + return view($view, ['bannedipModels' => $bannedipModels, 'search' => $search, 'searchFields' => $searchFields]); } /** * Show the form for creating a new resource. - * - * @param \App\Models\BannedIp $banned_ip - * @return \Illuminate\Contracts\View\View */ - public function create(BannedIp $banned_ip): \Illuminate\Contracts\View\View + public function create(BannedIp $banned_ip): View { - return view('back::pages.banned-ips.create', [ + /** @var view-string $view */ + $view = 'back::pages.banned-ips.create'; + + return view($view, [ 'bannedipModel' => $banned_ip, ]); } /** * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\BannedIps\StoreBannedIpRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function store(StoreBannedIpRequest $request): \Illuminate\Http\RedirectResponse + public function store(StoreBannedIpRequest $request): RedirectResponse { return DB::transaction(function () use ($request) { $banned_ip = new BannedIp(); $banned_ip->fill($request->validated()); if ($banned_ip->saveOrFail()) { - return redirect() - ->route('bo.banned_ips.edit', $banned_ip) + return to_route('bo.banned_ips.edit', $banned_ip) ->with('success', trans( 'crud.messages.has_been_created', ['model' => Str::singular(trans('models.classes.banned_ips'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_created', ['model' => Str::singular(trans('models.classes.banned_ips'))] @@ -95,38 +96,33 @@ class BannedIpController extends Controller /** * Show the form for editing the specified resource. - * - * @param \App\Models\BannedIp $banned_ip - * @return \Illuminate\Contracts\View\View */ - public function edit(BannedIp $banned_ip): \Illuminate\Contracts\View\View + public function edit(BannedIp $banned_ip): View { - return view('back::pages.banned-ips.edit', [ + /** @var view-string $view */ + $view = 'back::pages.banned-ips.edit'; + + return view($view, [ 'bannedipModel' => $banned_ip, ]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\BannedIps\UpdateBannedIpRequest $request - * @param \App\Models\BannedIp $banned_ip - * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdateBannedIpRequest $request, BannedIp $banned_ip): \Illuminate\Http\RedirectResponse + public function update(UpdateBannedIpRequest $request, BannedIp $banned_ip): RedirectResponse { return DB::transaction(function () use ($request, $banned_ip) { $banned_ip->fill($request->validated()); if ($banned_ip->saveOrFail()) { - return redirect() - ->route('bo.banned_ips.edit', $banned_ip) + return to_route('bo.banned_ips.edit', $banned_ip) ->with('success', trans( 'crud.messages.has_been_updated', ['model' => Str::singular(trans('models.classes.banned_ips'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_updated', ['model' => Str::singular(trans('models.classes.banned_ips'))] @@ -136,23 +132,19 @@ class BannedIpController extends Controller /** * Remove the specified resource from storage. - * - * @param \App\Models\BannedIp $banned_ip - * @return \Illuminate\Http\RedirectResponse */ - public function destroy(BannedIp $banned_ip): \Illuminate\Http\RedirectResponse + public function destroy(BannedIp $banned_ip): RedirectResponse { return DB::transaction(function () use ($banned_ip) { if ($banned_ip->deleteOrFail()) { - return redirect() - ->route('bo.banned_ips.index') + return to_route('bo.banned_ips.index') ->with('success', __( 'crud.messages.has_been_deleted', ['model' => Str::singular(trans('models.classes.banned_ips'))] )); } - return redirect() - ->back() + + return back() ->with('error', __( ':crud.messages.cannot_be_deleted', ['model' => Str::singular(trans('models.classes.banned_ips'))] diff --git a/app/Http/Controllers/Bo/CodeController.php b/app/Http/Controllers/Bo/CodeController.php index 2e23567..e5c5634 100644 --- a/app/Http/Controllers/Bo/CodeController.php +++ b/app/Http/Controllers/Bo/CodeController.php @@ -1,5 +1,7 @@ authorize('generate', Code::class); - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); $nbCodeBase = Code::query()->max('id'); $nbCodeUsed = Code::query()->whereHas( 'participations', @@ -35,22 +38,23 @@ class CodeController extends Controller )->count(); $nbCodeExported = Code::query()->where('code_exported', true)->count(); $nbCodeRemainingToExport = Code::query()->where('code_exported', false)->count(); - return view('back::pages.codes.index', compact( - 'settings', - 'nbCodeBase', - 'nbCodeUsed', - 'nbCodeExported', - 'nbCodeRemainingToExport' - )); + + /** @var view-string $view */ + $view = 'back::pages.codes.index'; + + return view($view, [ + 'settings' => $settings, + 'nbCodeBase' => $nbCodeBase, + 'nbCodeUsed' => $nbCodeUsed, + 'nbCodeExported' => $nbCodeExported, + 'nbCodeRemainingToExport' => $nbCodeRemainingToExport, + ]); } /** * Run generate codes action - * - * @param \App\Http\Requests\Bo\Codes\GenerateCodesRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function generate(GenerateCodesRequest $request): \Illuminate\Http\RedirectResponse + public function generate(GenerateCodesRequest $request): RedirectResponse { $this->authorize('generate', Code::class); Queue::push( @@ -66,7 +70,7 @@ class CodeController extends Controller // phpcs:ignore Generic.Files.LineLength.TooLong 'La tache de génération à été ajoutée, un mail de notification sera envoyé à l\'adresse :email lorsque le traitement sera terminé.', [ - 'email' => config('mail.admin') + 'email' => config('mail.admin'), ] ) ); @@ -74,11 +78,8 @@ class CodeController extends Controller /** * Run export codes - * - * @param \App\Http\Requests\Bo\Codes\ExportCodesRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function export(ExportCodesRequest $request): \Illuminate\Http\RedirectResponse + public function export(ExportCodesRequest $request): RedirectResponse { $this->authorize('export', Code::class); Queue::push( @@ -93,25 +94,22 @@ class CodeController extends Controller 'success', // phpcs:ignore Generic.Files.LineLength.TooLong __('L\'export des codes à commencé, un mail de notification sera envoyé à l\'adresse :emaillorsque le traitement sera terminé.', [ - 'email' => config('mail.admin') + 'email' => config('mail.admin'), ]) ); } /** * Search for a specific code. - * - * @param \App\Http\Requests\Bo\Codes\CodeSearchRequest $request - * @return \Illuminate\Contracts\View\View */ - public function search(CodeSearchRequest $request): \Illuminate\Contracts\View\View + public function search(CodeSearchRequest $request): View { $this->authorize('search', Code::class); $code = null; try { $code = Code::query()->where('id', Code::serialToInt($request->code))->first(); - } catch (\Throwable $e) { - if (\get_class($e) === SerialCasterException::class) { + } catch (Throwable $e) { + if ($e::class === SerialCasterException::class) { $code = false; } } finally { @@ -126,10 +124,13 @@ class CodeController extends Controller $used_counter = null; if ($code) { $used_counter = Participation::query() - ->whereHas('code', fn(Builder $q) => $q->where('id', $code->id)) + ->whereHas('code', fn (Builder $q) => $q->where('id', $code->id)) ->count(); } - return view('back::pages.codes.search', compact('code', 'used_counter')); + /** @var view-string $view */ + $view = 'back::pages.codes.search'; + + return view($view, ['code' => $code, 'used_counter' => $used_counter]); } } diff --git a/app/Http/Controllers/Bo/DashboardController.php b/app/Http/Controllers/Bo/DashboardController.php index 1c39070..9c4af2d 100644 --- a/app/Http/Controllers/Bo/DashboardController.php +++ b/app/Http/Controllers/Bo/DashboardController.php @@ -1,60 +1,62 @@ getTable()); - $dateFrmtr = function (object $row) { - $row->date = Carbon::parse($row->date)->isoFormat('DD/MM/YYYY'); + $query = DB::table(new Participation()->getTable()); + $dateFrmtr = function (object $row): object { + $row->date = Date::parse($row->date)->isoFormat('DD/MM/YYYY'); + return $row; }; - /** @var \Illuminate\Support\Collection */ + /** @var Collection */ $participationsPerDay = (clone $query) ->selectRaw('COUNT(*) AS count, DATE(created_at) AS date') ->groupByRaw('DATE(created_at)')->get()->map($dateFrmtr)->keyBy('date'); - /** @var \Illuminate\Support\Collection */ + /** @var Collection */ $participationsUniquePerDay = (clone $query) ->selectRaw('DISTINCT customer_id AS user, COUNT(*) AS count, DATE(created_at) AS date') ->groupByRaw('DATE(created_at), user')->get()->map($dateFrmtr); - /** @var \Illuminate\Support\Collection */ + /** @var Collection */ $participationsUniquePerCustomer = (clone $query) - ->selectRaw("DISTINCT customer_id AS user, COUNT(*) AS count") + ->selectRaw('DISTINCT customer_id AS user, COUNT(*) AS count') ->groupBy('user')->orderBy('user')->get(); $participationsTotal = Participation::query()->count(); - /** @var \Illuminate\Support\Collection 3 codes EAN les plus utilisés */ + /** @var Collection 3 codes EAN les plus utilisés */ $codesEan = (clone $query) ->selectRaw('COUNT(product_id) AS nb_usage, product_id, ean_code') ->join('products', 'product_id', '=', 'products.id') ->groupBy('product_id', 'ean_code') ->orderByDesc('nb_usage')->limit(3)->get(); - $participationsUniquePerDay->each(function (object $row) use (&$statsUnique) { + $participationsUniquePerDay->each(function (object $row) use (&$statsUnique): void { Arr::set($statsUnique, $row->date, (Arr::get($statsUnique, $row->date) ?? 0) + 1); }); @@ -62,23 +64,22 @@ class DashboardController extends Controller if ($participationsUniquePerCustomer->count() > 0) { $avgParticipUser = round($participationsTotal / $participationsUniquePerCustomer->count(), 1); } - - // * Création des tableaux avec toutes les dates depuis le début du jeu - // * et le nombre de participations associées pour le graph JS. - $start_date = $settings->start_date; - $end_date = now()->lt($settings->end_date) ? now() : $settings->end_date; + now()->lt($settings->end_date) ? now() : $settings->end_date; $dates = $participationsPerDay->keys(); $count = $participationsPerDay->pluck('count'); $countUnique = $dates->map(fn (string $formated_date) => Arr::get($statsUnique, $formated_date, 0)); - return view('back::pages.dashboard.index', compact( - 'dates', - 'count', - 'countUnique', - 'participationsTotal', - 'avgParticipUser', - 'codesEan', - 'settings' - )); + /** @var view-string $view */ + $view = 'back::pages.dashboard.index'; + + return view($view, [ + 'dates' => $dates, + 'count' => $count, + 'countUnique' => $countUnique, + 'participationsTotal' => $participationsTotal, + 'avgParticipUser' => $avgParticipUser, + 'codesEan' => $codesEan, + 'settings' => $settings, + ]); } } diff --git a/app/Http/Controllers/Bo/FaqQuestionController.php b/app/Http/Controllers/Bo/FaqQuestionController.php index 650c953..dc82935 100644 --- a/app/Http/Controllers/Bo/FaqQuestionController.php +++ b/app/Http/Controllers/Bo/FaqQuestionController.php @@ -1,5 +1,7 @@ paginate($faqQuestionModels); - return view('back::pages.faq-questions.index', compact('faqQuestionModels', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.faq-questions.index'; + + return view($view, [ + 'faqQuestionModels' => $faqQuestionModels, + 'search' => $search, + 'searchFields' => $searchFields, + ]); } /** * Show the form for creating a new resource. - * - * @param \App\Models\FaqQuestion $faqQuestion - * @return \Illuminate\Contracts\View\View */ - public function create(FaqQuestion $faqQuestion): \Illuminate\Contracts\View\View + public function create(FaqQuestion $faqQuestion): View { $faqThemeModels = FaqTheme::all(); - return view('back::pages.faq-questions.create', [ + + /** @var view-string $view */ + $view = 'back::pages.faq-questions.create'; + + return view($view, [ 'faqQuestionModel' => $faqQuestion, - 'faqThemeModels' => $faqThemeModels + 'faqThemeModels' => $faqThemeModels, ]); } /** * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\FaqQuestions\StoreFaqQuestionRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function store(StoreFaqQuestionRequest $request): \Illuminate\Http\RedirectResponse + public function store(StoreFaqQuestionRequest $request): RedirectResponse { return DB::transaction(function () use ($request) { $faqQuestion = new FaqQuestion(); $faqQuestion->fill($request->validated()); if ($faqQuestion->saveOrFail()) { - return redirect() - ->route('bo.faq-questions.edit', $faqQuestion) + return to_route('bo.faq-questions.edit', $faqQuestion) ->with( 'success', trans( @@ -95,8 +101,8 @@ class FaqQuestionController extends Controller ) ); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_created', ['model' => trans_choice('models.classes.faq-questions', 1)] @@ -106,45 +112,38 @@ class FaqQuestionController extends Controller /** * Show the form for editing the specified resource. - * - * @param \App\Models\FaqQuestion $faqQuestion - * @return \Illuminate\Contracts\View\View */ - public function edit(FaqQuestion $faqQuestion): \Illuminate\Contracts\View\View + public function edit(FaqQuestion $faqQuestion): View { $faqThemeModels = FaqTheme::all(); - return view('back::pages.faq-questions.edit', [ + + /** @var view-string $view */ + $view = 'back::pages.faq-questions.edit'; + + return view($view, [ 'faqQuestionModel' => $faqQuestion, - 'faqThemeModels' => $faqThemeModels + 'faqThemeModels' => $faqThemeModels, ]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\FaqQuestions\UpdateFaqQuestionRequest $request - * @param \App\Models\FaqQuestion $faqQuestion - * @return \Illuminate\Http\RedirectResponse */ public function update( UpdateFaqQuestionRequest $request, FaqQuestion $faqQuestion - ): \Illuminate\Http\RedirectResponse { + ): RedirectResponse { return DB::transaction(function () use ($request, $faqQuestion) { $faqQuestion->fill($request->validated()); if ($faqQuestion->saveOrFail()) { - return redirect() - ->route( - 'bo.faq-questions.edit', - $faqQuestion - ) + return to_route('bo.faq-questions.edit', $faqQuestion) ->with('success', trans( 'crud.messages.has_been_updated', ['model' => trans_choice('models.classes.faq-questions', 1)] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_updated', ['model' => trans_choice('models.classes.faq-questions', 1)] @@ -154,23 +153,19 @@ class FaqQuestionController extends Controller /** * Remove the specified resource from storage. - * - * @param \App\Models\FaqQuestion $faqQuestion - * @return \Illuminate\Http\RedirectResponse */ - public function destroy(FaqQuestion $faqQuestion): \Illuminate\Http\RedirectResponse + public function destroy(FaqQuestion $faqQuestion): RedirectResponse { return DB::transaction(function () use ($faqQuestion) { if ($faqQuestion->deleteOrFail()) { - return redirect() - ->route('bo.faq-questions.index') + return to_route('bo.faq-questions.index') ->with('success', __( 'crud.messages.has_been_deleted', ['model' => trans_choice('models.classes.faq-questions', 1)] )); } - return redirect() - ->back() + + return back() ->with('error', __( ':crud.messages.cannot_be_deleted', ['model' => trans_choice('models.classes.faq-questions', 1)] diff --git a/app/Http/Controllers/Bo/FaqThemeController.php b/app/Http/Controllers/Bo/FaqThemeController.php index dd01a67..3044bb9 100644 --- a/app/Http/Controllers/Bo/FaqThemeController.php +++ b/app/Http/Controllers/Bo/FaqThemeController.php @@ -1,11 +1,16 @@ paginate($faqThemeModels); - return view('back::pages.faq-themes.index', compact('faqThemeModels', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.faq-themes.index'; + + return view($view, ['faqThemeModels' => $faqThemeModels, 'search' => $search, 'searchFields' => $searchFields]); } /** * Show the form for creating a new resource. - * - * @param \App\Models\FaqTheme $faqTheme - * @return \Illuminate\Contracts\View\View */ - public function create(FaqTheme $faqTheme): \Illuminate\Contracts\View\View + public function create(FaqTheme $faqTheme): View { - return view('back::pages.faq-themes.create', [ + /** @var view-string $view */ + $view = 'back::pages.faq-themes.create'; + + return view($view, [ 'faqThemeModel' => $faqTheme, ]); } /** * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\FaqThemes\StoreFaqThemeRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function store(StoreFaqThemeRequest $request): \Illuminate\Http\RedirectResponse + public function store(StoreFaqThemeRequest $request): RedirectResponse { return DB::transaction(function () use ($request) { $faqTheme = new FaqTheme(); $faqTheme->fill($request->validated()); if ($faqTheme->saveOrFail()) { - return redirect() - ->route('bo.faq-themes.edit', $faqTheme) + return to_route('bo.faq-themes.edit', $faqTheme) ->with( 'success', trans( @@ -87,8 +88,8 @@ class FaqThemeController extends Controller ) ); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_created', ['model' => trans_choice('models.classes.faq-themes', 1)] @@ -98,43 +99,35 @@ class FaqThemeController extends Controller /** * Show the form for editing the specified resource. - * - * @param \App\Models\FaqTheme $faqTheme - * @return \Illuminate\Contracts\View\View */ - public function edit(FaqTheme $faqTheme): \Illuminate\Contracts\View\View + public function edit(FaqTheme $faqTheme): View { - return view('back::pages.faq-themes.edit', [ + /** @var view-string $view */ + $view = 'back::pages.faq-themes.edit'; + + return view($view, [ 'faqThemeModel' => $faqTheme, ]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\FaqThemes\UpdateFaqThemeRequest $request - * @param \App\Models\FaqTheme $faqTheme - * @return \Illuminate\Http\RedirectResponse */ public function update( UpdateFaqThemeRequest $request, FaqTheme $faqTheme - ): \Illuminate\Http\RedirectResponse { + ): RedirectResponse { return DB::transaction(function () use ($request, $faqTheme) { $faqTheme->fill($request->validated()); if ($faqTheme->saveOrFail()) { - return redirect() - ->route( - 'bo.faq-themes.edit', - $faqTheme - ) + return to_route('bo.faq-themes.edit', $faqTheme) ->with('success', trans( 'crud.messages.has_been_updated', ['model' => trans_choice('models.classes.faq-themes', 1)] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_updated', ['model' => trans_choice('models.classes.faq-themes', 1)] @@ -144,23 +137,19 @@ class FaqThemeController extends Controller /** * Remove the specified resource from storage. - * - * @param \App\Models\FaqTheme $faqTheme - * @return \Illuminate\Http\RedirectResponse */ - public function destroy(FaqTheme $faqTheme): \Illuminate\Http\RedirectResponse + public function destroy(FaqTheme $faqTheme): RedirectResponse { return DB::transaction(function () use ($faqTheme) { if ($faqTheme->deleteOrFail()) { - return redirect() - ->route('bo.faq-themes.index') + return to_route('bo.faq-themes.index') ->with('success', __( 'crud.messages.has_been_deleted', ['model' => trans_choice('models.classes.faq-themes', 1)] )); } - return redirect() - ->back() + + return back() ->with('error', __( 'crud.messages.cannot_be_deleted', ['model' => trans_choice('models.classes.faq-themes', 1)] diff --git a/app/Http/Controllers/Bo/InstantWinController.php b/app/Http/Controllers/Bo/InstantWinController.php index 5c2bad5..497a649 100644 --- a/app/Http/Controllers/Bo/InstantWinController.php +++ b/app/Http/Controllers/Bo/InstantWinController.php @@ -1,15 +1,21 @@ orderBy('available_at')->get(); + $instantWinModelList = InstantWin::query()->oldest('available_at')->get(); - return view('back::pages.instant-win.index', [ - 'instantWinModelList' => $instantWinModelList + /** @var view-string $view */ + $view = 'back::pages.instant-win.index'; + + return view($view, [ + 'instantWinModelList' => $instantWinModelList, ]); } /** * Returns generated instant win. - * - * @return \Illuminate\Http\JsonResponse */ public function generate(): JsonResponse { @@ -56,23 +61,20 @@ class InstantWinController extends Controller */ $day_end = now()->setTime(22, 29); - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); $prizeModelList = Prize::all(); - /** @var \Illuminate\Support\Collection */ + /** @var Collection */ $datesGlobal = collect(); - /** - * @var \Illuminate\Support\Collection - * Liste de tous les lots à gagner - */ + /** @var Collection Liste de tous les lots à gagner */ $lotsGlobal = collect(); // * Seed srand ! \mt_srand(time()); // * Init prize list - $prizeModelList->each(function (Prize $prize) use ($lotsGlobal, $day_start, $day_end) { + $prizeModelList->each(function (Prize $prize) use ($lotsGlobal, $day_start, $day_end): void { for ($i = 0; $i < $prize->quantity; $i++) { $el = new WinTimeElement(); $el->prize = $prize; @@ -84,7 +86,7 @@ class InstantWinController extends Controller } }); - $lotsGlobal->shuffle(time()); + $lotsGlobal->shuffle(); // * Init days calendar foreach ($settings->start_date->toPeriod($settings->end_date, CarbonInterval::make('1day')) as $date) { @@ -95,8 +97,8 @@ class InstantWinController extends Controller } // * Save Instant wins - $this->generateArray($lotsGlobal, $datesGlobal, 0)->each(function (WinDayCalendar $winDayCalendar) { - $winDayCalendar->lots->each(function (WinTimeElement $winTimeElement) { + $this->generateArray($lotsGlobal, $datesGlobal, 0)->each(function (WinDayCalendar $winDayCalendar): void { + $winDayCalendar->lots->each(function (WinTimeElement $winTimeElement): void { $instantWin = new InstantWin(); $instantWin->available_at = $winTimeElement->time; $instantWin->prize()->associate($winTimeElement->prize); @@ -114,11 +116,11 @@ class InstantWinController extends Controller * * Même algo que celui implémenté par Romain. * - * @param \Illuminate\Support\Collection $lotsGlobal - * Liste de tous les lots à gagner - * @param \Illuminate\Support\Collection $dateGlobal - * @param integer $prizesDone - * @return \Illuminate\Support\Collection + * @param Collection $lotsGlobal + * Liste de tous les lots à gagner + * @param Collection $dateGlobal + * @return Collection + * * @phpcs:disable Squiz.Commenting.FunctionComment.IncorrectTypeHint */ private function generateArray(Collection $lotsGlobal, Collection $dateGlobal, int $prizesDone): Collection @@ -129,7 +131,7 @@ class InstantWinController extends Controller // ? À-t-on déjà assigné un lot par jour (au moins) ? // ? Le jour aléatoire sélectionné à déja un lot ? - if ($prizesDone < $dateGlobal->count() and $dateGlobal->get($rKey)->lots->count() > 0) { + if ($prizesDone < $dateGlobal->count() && $dateGlobal->get($rKey)->lots->count() > 0) { return $this->generateArray($lotsGlobal, $dateGlobal, $prizesDone); } @@ -142,15 +144,15 @@ class InstantWinController extends Controller } // * Tri par heure et assignation du jour correct. - $dateGlobal->each(function (WinDayCalendar $date) { - $date->lots = $date->lots->sort(fn (WinTimeElement $a, WinTimeElement $b) => - $a->time->timestamp - $b->time->timestamp) - ->map(function (WinTimeElement $time) use ($date) { + $dateGlobal->each(function (WinDayCalendar $date): void { + $date->lots = $date->lots->sort(fn (WinTimeElement $a, WinTimeElement $b): int | float => $a->time->timestamp - $b->time->timestamp) + ->map(function (WinTimeElement $time) use ($date): WinTimeElement { $time->time->setDate( $date->time->year, $date->time->month, $date->time->day ); + return $time; }); }); @@ -160,23 +162,25 @@ class InstantWinController extends Controller } /** - * @property \App\Models\Prize $prize Le lot à gagner. - * @property \Carbon\Carbon $time Une heure aléatoire. + * @property Prize $prize Le lot à gagner. + * @property Carbon $time Une heure aléatoire. + * * @phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses */ -class WinTimeElement extends \stdClass +class WinTimeElement extends stdClass { // phpcs:enable } /** - * @property \Carbon\Carbon|\Carbon\CarbonInterface $time - * Un jour dans le temps. - * @property \Illuminate\Support\Collection $lots - * Liste des lots tombant ce jour. + * @property Carbon|CarbonInterface $time + * Un jour dans le temps. + * @property Collection $lots + * Liste des lots tombant ce jour. + * * @phpcs:disable PSR1.Classes.ClassDeclaration.MultipleClasses */ -class WinDayCalendar extends \stdClass +class WinDayCalendar extends stdClass { // phpcs:enable } diff --git a/app/Http/Controllers/Bo/ParticipationController.php b/app/Http/Controllers/Bo/ParticipationController.php index 9bba139..c4cf6e8 100644 --- a/app/Http/Controllers/Bo/ParticipationController.php +++ b/app/Http/Controllers/Bo/ParticipationController.php @@ -1,10 +1,13 @@ authorize('viewWinnerList', Participation::class); - /** @var \Illuminate\Database\Eloquent\Builder $participationModels */ - $participationModels = Participation::query()->with(['customer', 'code', 'instantWin', 'product'])->whereHas('instantWin'); + /** @var Builder $participationModels */ + $participationModels = Participation::query() + ->with(['customer', 'code', 'instantWin', 'product']) + ->whereHas('instantWin'); /** Sort columns with a query */ $this->sortQuery($participationModels); @@ -35,36 +38,37 @@ class ParticipationController extends Controller /** Custom pagination */ $participationModels = $this->paginate($participationModels); - return view('back::pages.winners-list.index', compact( - 'participationModels' - )); + /** @var view-string $view */ + $view = 'back::pages.winners-list.index'; + + return view($view, ['participationModels' => $participationModels]); } /** * Display participation form - * - * @param \App\Models\Participation $participation - * @return \Illuminate\Contracts\View\View */ public function setComment(Participation $participation): View { $this->authorize('setComment', $participation); - return view('back::pages.winners-list.set-comment', [ - 'participationModel' => $participation + + /** @var view-string $view */ + $view = 'back::pages.winners-list.set-comment'; + + return view($view, [ + 'participationModel' => $participation, ]); } /** * Set Comment - * - * @param \App\Models\Participation $participation - * @return \Illuminate\Http\RedirectResponse */ public function setCommentSubmit(Participation $participation): RedirectResponse { $this->authorize('setComment', $participation); - $participation->comment = request()->string('comment'); + + $participation->comment = request()->string('comment')->toString(); $participation->saveOrFail(); + return back()->with('success', \trans( 'Le commentaire à bien été mis à jour' )); @@ -72,15 +76,13 @@ class ParticipationController extends Controller /** * Change prize sent - * - * @param \App\Models\Participation $participation - * @return \Illuminate\Http\RedirectResponse */ public function changePrizeSent(Participation $participation): RedirectResponse { $this->authorize('changePrizeSent', $participation); $participation->prize_sent = true; $participation->saveOrFail(); + return back()->with('success', \trans( 'Le lot est bien marqué comme envoyé et une notification à été envoyé au gagant' )); diff --git a/app/Http/Controllers/Bo/PrizeController.php b/app/Http/Controllers/Bo/PrizeController.php index b2b598f..8b1ea27 100644 --- a/app/Http/Controllers/Bo/PrizeController.php +++ b/app/Http/Controllers/Bo/PrizeController.php @@ -1,11 +1,16 @@ paginate($prizeModels); - return view('back::pages.prizes.index', compact('prizeModels', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.prizes.index'; + + return view($view, ['prizeModels' => $prizeModels, 'search' => $search, 'searchFields' => $searchFields]); } /** * Display the specified resource. - * - * @param \App\Models\Prize $prize - * @return \Illuminate\Contracts\View\View */ - public function show(Prize $prize): \Illuminate\Contracts\View\View + public function show(Prize $prize): View { - return view('back::pages.prizes.show', ['prizeModel' => $prize]); + /** @var view-string $view */ + $view = 'back::pages.prizes.show'; + + return view($view, ['prizeModel' => $prize]); } /** * Show the form for creating a new resource. - * - * @param \App\Models\Prize $prize - * @return \Illuminate\Contracts\View\View */ - public function create(Prize $prize): \Illuminate\Contracts\View\View + public function create(Prize $prize): View { - return view('back::pages.prizes.create', [ - 'prizeModel' => $prize + /** @var view-string $view */ + $view = 'back::pages.prizes.create'; + + return view($view, [ + 'prizeModel' => $prize, ]); } /** * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\Prizes\StorePrizeRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function store(StorePrizeRequest $request): \Illuminate\Http\RedirectResponse + public function store(StorePrizeRequest $request): RedirectResponse { return DB::transaction(function () use ($request) { $prize = new Prize(); $prize->fill($request->validated()); if ($prize->saveOrFail()) { - return redirect() - ->route('bo.prizes.edit', $prize) + return to_route('bo.prizes.edit', $prize) ->with('success', trans( 'crud.messages.has_been_created', ['model' => Str::singular(__('models.classes.prize'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_created', ['model' => Str::singular(__('models.classes.prize'))] @@ -109,38 +110,33 @@ class PrizeController extends Controller /** * Show the form for editing the specified resource. - * - * @param \App\Models\Prize $prize - * @return \Illuminate\Contracts\View\View */ - public function edit(Prize $prize): \Illuminate\Contracts\View\View + public function edit(Prize $prize): View { - return view('back::pages.prizes.edit', [ - 'prizeModel' => $prize + /** @var view-string $view */ + $view = 'back::pages.prizes.edit'; + + return view($view, [ + 'prizeModel' => $prize, ]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\Prizes\UpdatePrizeRequest $request - * @param \App\Models\Prize $prize - * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdatePrizeRequest $request, Prize $prize): \Illuminate\Http\RedirectResponse + public function update(UpdatePrizeRequest $request, Prize $prize): RedirectResponse { return DB::transaction(function () use ($request, $prize) { $prize->fill($request->validated()); if ($prize->saveOrFail()) { - return redirect() - ->route('bo.prizes.edit', $prize) + return to_route('bo.prizes.edit', $prize) ->with('success', trans( 'crud.messages.has_been_updated', ['model' => Str::singular(__('models.classes.prize'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_updated', ['model' => Str::singular(__('models.classes.prize'))] @@ -150,23 +146,19 @@ class PrizeController extends Controller /** * Remove the specified resource from storage. - * - * @param \App\Models\Prize $prize - * @return \Illuminate\Http\RedirectResponse */ - public function destroy(Prize $prize): \Illuminate\Http\RedirectResponse + public function destroy(Prize $prize): RedirectResponse { return DB::transaction(function () use ($prize) { if ($prize->deleteOrFail()) { - return redirect() - ->route('bo.prizes.index') + return to_route('bo.prizes.index') ->with('success', __( 'crud.messages.has_been_deleted', ['model' => Str::singular(__('models.classes.prize'))] )); } - return redirect() - ->back() + + return back() ->with('error', __( ':crud.messages.cannot_be_deleted', ['model' => Str::singular(__('models.classes.prize'))] diff --git a/app/Http/Controllers/Bo/ProductController.php b/app/Http/Controllers/Bo/ProductController.php index 1956395..d44150d 100644 --- a/app/Http/Controllers/Bo/ProductController.php +++ b/app/Http/Controllers/Bo/ProductController.php @@ -1,5 +1,7 @@ with('range'); /** @var string $search Search field */ @@ -55,63 +57,63 @@ class ProductController extends Controller /** Custom pagination */ $productModels = $this->paginate($productModels); - return view('back::pages.products.index', compact('productModels', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.products.index'; + + return view($view, ['productModels' => $productModels, 'search' => $search, 'searchFields' => $searchFields]); } /** * Display the specified resource. - * - * @param \App\Models\Product $product - * @return \Illuminate\Contracts\View\View */ - public function show(Product $product): \Illuminate\Contracts\View\View + public function show(Product $product): View { - return view('back::pages.products.show', ['productModel' => $product]); + /** @var view-string $view */ + $view = 'back::pages.products.show'; + + return view($view, ['productModel' => $product]); } /** * Show the form for creating a new resource. - * - * @param \App\Models\Product $product - * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse */ - public function create(Product $product): \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse + public function create(Product $product): View | RedirectResponse { $rangeModels = Range::all(); - if (!count($rangeModels)) { - return \redirect()->route('bo.ranges.index') + if (! count($rangeModels)) { + return to_route('bo.ranges.index') ->with( 'error', 'Vous devez ajouter une gamme avant de pouvoir ajouter un produit' ); } - return view('back::pages.products.create', [ + + /** @var view-string $view */ + $view = 'back::pages.products.create'; + + return view($view, [ 'productModel' => $product, - 'rangeModels' => $rangeModels + 'rangeModels' => $rangeModels, ]); } /** * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\Products\StoreProductRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function store(StoreProductRequest $request): \Illuminate\Http\RedirectResponse + public function store(StoreProductRequest $request): RedirectResponse { return DB::transaction(function () use ($request) { $product = new Product(); $product->fill($request->validated()); if ($product->saveOrFail()) { - return redirect() - ->route('bo.products.edit', $product) + return to_route('bo.products.edit', $product) ->with('success', trans( 'crud.messages.has_been_created', ['model' => Str::singular(__('models.classes.product'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_created', ['model' => Str::singular(__('models.classes.product'))] @@ -121,40 +123,36 @@ class ProductController extends Controller /** * Show the form for editing the specified resource. - * - * @param \App\Models\Product $product - * @return \Illuminate\Contracts\View\View */ - public function edit(Product $product): \Illuminate\Contracts\View\View + public function edit(Product $product): View { $rangeModels = Range::all(); - return view('back::pages.products.edit', [ + + /** @var view-string $view */ + $view = 'back::pages.products.edit'; + + return view($view, [ 'productModel' => $product, - 'rangeModels' => $rangeModels + 'rangeModels' => $rangeModels, ]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\Products\UpdateProductRequest $request - * @param \App\Models\Product $product - * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdateProductRequest $request, Product $product): \Illuminate\Http\RedirectResponse + public function update(UpdateProductRequest $request, Product $product): RedirectResponse { return DB::transaction(function () use ($request, $product) { $product->fill($request->validated()); if ($product->saveOrFail()) { - return redirect() - ->route('bo.products.edit', $product) + return to_route('bo.products.edit', $product) ->with('success', trans( 'crud.messages.has_been_updated', ['model' => Str::singular(__('models.classes.product'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_updated', ['model' => Str::singular(__('models.classes.product'))] @@ -164,23 +162,19 @@ class ProductController extends Controller /** * Remove the specified resource from storage. - * - * @param \App\Models\Product $product - * @return \Illuminate\Http\RedirectResponse */ - public function destroy(Product $product): \Illuminate\Http\RedirectResponse + public function destroy(Product $product): RedirectResponse { return DB::transaction(function () use ($product) { if ($product->deleteOrFail()) { - return redirect() - ->route('bo.products.index') + return to_route('bo.products.index') ->with('success', __( 'crud.messages.has_been_deleted', ['model' => Str::singular(__('models.classes.product'))] )); } - return redirect() - ->back() + + return back() ->with('error', __( ':crud.messages.cannot_be_deleted', ['model' => Str::singular(__('models.classes.product'))] diff --git a/app/Http/Controllers/Bo/RangeController.php b/app/Http/Controllers/Bo/RangeController.php index 90abc64..7500e95 100644 --- a/app/Http/Controllers/Bo/RangeController.php +++ b/app/Http/Controllers/Bo/RangeController.php @@ -1,11 +1,16 @@ paginate($rangeModels); - return view('back::pages.ranges.index', compact('rangeModels', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.ranges.index'; + + return view($view, ['rangeModels' => $rangeModels, 'search' => $search, 'searchFields' => $searchFields]); } /** * Display the specified resource. - * - * @param \App\Models\Range $range - * @return \Illuminate\Contracts\View\View */ - public function show(Range $range): \Illuminate\Contracts\View\View + public function show(Range $range): View { - return view('back::pages.ranges.show', ['rangeModel' => $range]); + /** @var view-string $view */ + $view = 'back::pages.ranges.show'; + + return view($view, ['rangeModel' => $range]); } /** * Show the form for creating a new resource. - * - * @param \App\Models\Range $range - * @return \Illuminate\Contracts\View\View */ - public function create(Range $range): \Illuminate\Contracts\View\View + public function create(Range $range): View { - return view('back::pages.ranges.create', [ + /** @var view-string $view */ + $view = 'back::pages.ranges.create'; + + return view($view, [ 'rangeModel' => $range, ]); } /** * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\Ranges\StoreRangeRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function store(StoreRangeRequest $request): \Illuminate\Http\RedirectResponse + public function store(StoreRangeRequest $request): RedirectResponse { return DB::transaction(function () use ($request) { $range = new Range(); $range->fill($request->validated()); if ($range->saveOrFail()) { - return redirect() - ->route('bo.ranges.edit', $range) + return to_route('bo.ranges.edit', $range) ->with('success', trans( 'crud.messages.has_been_created', ['model' => Str::singular(__('models.classes.range'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_created', ['model' => Str::singular(__('models.classes.range'))] @@ -106,38 +107,33 @@ class RangeController extends Controller /** * Show the form for editing the specified resource. - * - * @param \App\Models\Range $range - * @return \Illuminate\Contracts\View\View */ - public function edit(Range $range): \Illuminate\Contracts\View\View + public function edit(Range $range): View { - return view('back::pages.ranges.edit', [ - 'rangeModel' => $range + /** @var view-string $view */ + $view = 'back::pages.ranges.edit'; + + return view($view, [ + 'rangeModel' => $range, ]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\Ranges\UpdateRangeRequest $request - * @param \App\Models\Range $range - * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdateRangeRequest $request, Range $range): \Illuminate\Http\RedirectResponse + public function update(UpdateRangeRequest $request, Range $range): RedirectResponse { return DB::transaction(function () use ($request, $range) { $range->fill($request->validated()); if ($range->saveOrFail()) { - return redirect() - ->route('bo.ranges.edit', $range) + return to_route('bo.ranges.edit', $range) ->with('success', trans( 'crud.messages.has_been_updated', ['model' => Str::singular(__('models.classes.range'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_updated', ['model' => Str::singular(__('models.classes.range'))] @@ -147,28 +143,25 @@ class RangeController extends Controller /** * Remove the specified resource from storage. - * - * @param \App\Models\Range $range - * @return \Illuminate\Http\RedirectResponse */ - public function destroy(Range $range): \Illuminate\Http\RedirectResponse + public function destroy(Range $range): RedirectResponse { if ($range->products()->count()) { return back()->withError( 'Cette gamme est associé a des produits, la supression n\'est pas possible' ); } + return DB::transaction(function () use ($range) { if ($range->deleteOrFail()) { - return redirect() - ->route('bo.ranges.index') + return to_route('bo.ranges.index') ->with('success', __( 'crud.messages.has_been_deleted', ['model' => Str::singular(__('models.classes.range'))] )); } - return redirect() - ->back() + + return back() ->with('error', __( ':crud.messages.cannot_be_deleted', ['model' => Str::singular(__('models.classes.range'))] diff --git a/app/Http/Controllers/Bo/Re7Controller.php b/app/Http/Controllers/Bo/Re7Controller.php index 81e541d..0701e3b 100644 --- a/app/Http/Controllers/Bo/Re7Controller.php +++ b/app/Http/Controllers/Bo/Re7Controller.php @@ -1,16 +1,20 @@ middleware(function (Request $request, \Closure $next) { + $this->middleware(function (Request $request, Closure $next) { $this->authorize('fo.showRe7'); + return $next($request); }); } /** * Show Home page - * - * @return \Illuminate\Contracts\View\View */ public function home(): View { - return view('theme::pages.home'); + /** @var view-string $view */ + $view = 'theme::pages.home'; + + return view($view); } /** * Show Teaser page - * - * @return \Illuminate\Contracts\View\View */ public function teaser(): View { - return view('theme::pages.teaser'); + /** @var view-string $view */ + $view = 'theme::pages.teaser'; + + return view($view); } /** * Show Teaser page - * - * @return \Illuminate\Contracts\View\View */ public function endGame(): View { - return view('theme::pages.end-game'); + /** @var view-string $view */ + $view = 'theme::pages.end-game'; + + return view($view); } /** * Show code input page - * - * @return \Illuminate\Contracts\View\View */ public function participate(): View { - return view('theme::pages.participation.participate'); + /** @var view-string $view */ + $view = 'theme::pages.participation.participate'; + + return view($view); } /** * Show code input page - * - * @return \Illuminate\Contracts\View\View */ public function participationExhausted(): View { - return view('theme::pages.participation.participation-exhausted'); + /** @var view-string $view */ + $view = 'theme::pages.participation.participation-exhausted'; + + return view($view); } // * -- Participation /** * Show prize page - * - * @param \App\Models\Prize $prize - * @return \Illuminate\Contracts\View\View */ public function prize(Prize $prize): View { // * Fake participation model $participationModel = new Participation(); $participationModel = 9999999; - return view('theme::pages.participation.won', [ - 'prizeModel' => $prize, - 'participationModel' => $participationModel + + /** @var view-string $view */ + $view = 'theme::pages.participation.won'; + + return view($view, [ + 'prizeModel' => $prize, + 'participationModel' => $participationModel, ]); } /** * Show discount page - * - * @return \Illuminate\Contracts\View\View */ public function discount(): View { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - /** @var \App\Lib\Discount */ + /** @var Settings */ + $settings = resolve(Settings::class); + /** @var Discount */ $discount = Arr::get( $settings->web_coupons, $this->getRandomWeightedElementIndex($settings->web_coupons) ); - if (!$settings->discounts_activated) { + if (! $settings->discounts_activated) { return abort(404); } $mesBrDiscount = new Discount(); - return view('theme::pages.participation.won', compact('discount', 'mesBrDiscount')); + + /** @var view-string $view */ + $view = 'theme::pages.participation.won'; + + return view($view, ['discount' => $discount, 'mesBrDiscount' => $mesBrDiscount]); } /** * Show loose page - * - * @return \Illuminate\Contracts\View\View */ public function loose(): View { - return view('theme::pages.participation.loose'); + /** @var view-string $view */ + $view = 'theme::pages.home'; + + return view($view); } // * -- END Participation /** * View won prize mail - * - * @param \App\Models\Prize $prize - * @return \Illuminate\Contracts\View\View */ public function mailPrize(Prize $prize): View { - return view('back::pages.re7-preview-mail', [ + /** @var view-string $view */ + $view = 'back::pages.re7-preview-mail'; + + return view($view, [ 'render_url' => route('re7.mail-print', [ - 'type' => 'prize', - 'prize' => $prize - ]) + 'type' => 'prize', + 'prize' => $prize, + ]), ]); } /** * View won discount mail - * - * @return \Illuminate\Contracts\View\View */ public function mailDiscount(): View { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - if (!$settings->discounts_activated) { + /** @var Settings */ + $settings = resolve(Settings::class); + if (! $settings->discounts_activated) { return abort(404); } - return view('back::pages.re7-preview-mail', [ + /** @var view-string $view */ + $view = 'back::pages.re7-preview-mail'; + + return view($view, [ 'render_url' => route('re7.mail-print', [ - 'type' => 'discount' - ]) + 'type' => 'discount', + ]), ]); } /** * View proof mail received mail - * - * @return \Illuminate\Contracts\View\View */ public function mailProofReceived(): View { - return view('back::pages.re7-preview-mail', [ + /** @var view-string $view */ + $view = 'back::pages.re7-preview-mail'; + + return view($view, [ 'render_url' => route('re7.mail-print', [ - 'type' => 'proof' - ]) + 'type' => 'proof', + ]), ]); } /** * View sent prize mail - * - * @return \Illuminate\Contracts\View\View */ public function mailPrizeSent(): View { - return view('back::pages.re7-preview-mail', [ + /** @var view-string $view */ + $view = 'back::pages.re7-preview-mail'; + + return view($view, [ 'render_url' => route('re7.mail-print', [ - 'type' => 'prize-sent' - ]) + 'type' => 'prize-sent', + ]), ]); } /** * Print a specific mail - * - * @param string $type - * @param \App\Models\Prize|null $prize - * @return \Illuminate\Http\Response */ - public function mailPrint(string $type, Prize|null $prize = null): Response + public function mailPrint(string $type, ?Prize $prize = null): Response { - /** @var \App\Models\User */ + /** @var User */ $user = auth('backend')->user(); - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); switch ($type) { case 'discount': - /** @var \App\Lib\Discount */ + /** @var Discount */ $discount = Arr::get( $settings->web_coupons, $this->getRandomWeightedElementIndex($settings->web_coupons) ); - return response((new DiscountWonMail( + return response(new DiscountWonMail( new Address( $user->email, $user->first_name @@ -232,9 +243,9 @@ class Re7Controller extends Controller $discount, config('app.url'), $settings->company, - ))->render()); + )->render()); case 'prize': - return response((new PrizeWonMail( + return response(new PrizeWonMail( new Address( $user->email, $user->first_name @@ -243,27 +254,27 @@ class Re7Controller extends Controller $prize, config('app.url'), $settings->company, - ))->render()); + )->render()); case 'prize-sent': - return response((new PrizeIsSentMail( + return response(new PrizeIsSentMail( new Address( $user->email, $user->first_name ), $settings->name, $settings->company, - ))->render()); + )->render()); case 'proof': - return response((new WinningProofSubmitedMail( + return response(new WinningProofSubmitedMail( new Address( $user->email, $user->first_name ), $settings->name, $settings->company, - ))->render()); + )->render()); default: return response('', 404); - } //end switch + } // end switch } } diff --git a/app/Http/Controllers/Bo/SettingsController.php b/app/Http/Controllers/Bo/SettingsController.php index 7c458ad..9ac7432 100644 --- a/app/Http/Controllers/Bo/SettingsController.php +++ b/app/Http/Controllers/Bo/SettingsController.php @@ -1,5 +1,7 @@ $settings + /** @var view-string $view */ + $view = 'back::pages.settings.edit'; + return view($view, [ + 'settingsModel' => $settings, ]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\Settings\UpdateSettingsRequest $request - * @param \App\Models\Settings $settings - * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdateSettingsRequest $request, Settings $settings): \Illuminate\Http\RedirectResponse + public function update(UpdateSettingsRequest $request, Settings $settings): RedirectResponse { return DB::transaction(function () use ($request, $settings) { $data = $request->validated(); // * Assign parsed Web coupon objects Arr::set($data, 'web_coupons', collect(Arr::get($data, 'web_coupons'))->filter() - ->map(fn (array $coupon) => $this->parseWebCoupon($coupon)) + ->map(fn (array $coupon): ?\App\Lib\Discount => $this->parseWebCoupon($coupon)) ->filter()->all()); $settings->fill($data); if ($settings->saveOrFail()) { - return redirect() - ->route('bo.settings.edit', $settings) + return to_route('bo.settings.edit', $settings) ->with('success', trans( 'crud.messages.has_been_updated', ['model' => Str::singular(__('models.classes.settings'))] )); } - return redirect() - ->back() + + return back() ->with('error', trans( 'crud.messages.cannot_be_updated', ['model' => Str::singular(__('models.classes.settings'))] @@ -69,18 +70,16 @@ class SettingsController extends Controller }); } - /** * Try to parse webCoupon * - * @param array $coupon - * @return \App\Lib\Discount|null + * @param array $coupon */ - private function parseWebCoupon(array $coupon): Discount | null + private function parseWebCoupon(array $coupon): ?Discount { - /** @var \Illuminate\Http\UploadedFile|string */ + /** @var UploadedFile|string */ $picture = Arr::get($coupon, 'picture'); - if (is_object($picture) and ($picture instanceof \Illuminate\Http\UploadedFile)) { + if ($picture instanceof UploadedFile) { $picture = FileStorageHelper::storeFile( new Settings(), $picture, @@ -96,7 +95,7 @@ class SettingsController extends Controller Arr::get($coupon, 'percentage'), Arr::get($coupon, 'web_coupon_identifiant'), ); - } catch (\RuntimeException | \TypeError) { + } catch (RuntimeException | TypeError) { return null; } } diff --git a/app/Http/Controllers/Bo/StaticPageController.php b/app/Http/Controllers/Bo/StaticPageController.php index e390009..98f11c2 100644 --- a/app/Http/Controllers/Bo/StaticPageController.php +++ b/app/Http/Controllers/Bo/StaticPageController.php @@ -1,10 +1,15 @@ paginate($query); - return view('back::pages.static_pages.index', compact('staticPageModelList', 'search', 'searchFields')); + /** @var view-string $view */ + $view = 'back::pages.static_pages.index'; + + return view($view, [ + 'staticPageModelList' => $staticPageModelList, + 'search' => $search, + 'searchFields' => $searchFields, + ]); } /** * Show the form for editing the specified resource. - * - * @param \App\Models\StaticPage $static_page - * @return \Illuminate\Contracts\View\View */ - public function edit(StaticPage $static_page): \Illuminate\Contracts\View\View + public function edit(StaticPage $static_page): View { - return view('back::pages.static_pages.edit', ['staticPageModel' => $static_page]); + /** @var view-string $view */ + $view = 'back::pages.static_pages.edit'; + return view($view, ['staticPageModel' => $static_page]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\StaticPages\UpdateStaticPageRequest $request - * @param \App\Models\StaticPage $static_page - * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdateStaticPageRequest $request, StaticPage $static_page): \Illuminate\Http\RedirectResponse + public function update(UpdateStaticPageRequest $request, StaticPage $static_page): RedirectResponse { return DB::transaction(function () use ($request, $static_page) { $static_page->fill($request->validated()); if ($static_page->saveOrFail()) { - return redirect()->route('bo.static_pages.edit', $static_page) + return to_route('bo.static_pages.edit', $static_page) ->with('success', __('crud.messages.has_been_updated', [ - 'model' => Str::ucfirst(\trans_choice('models.classes.static_page', 1)) + 'model' => Str::ucfirst(\trans_choice('models.classes.static_page', 1)), ])); } - return redirect()->route('bo.static_pages.edit', $static_page) + + return to_route('bo.static_pages.edit', $static_page) ->with('error', __('crud.messages.cannot_be_updated', [ - 'model' => Str::ucfirst(\trans_choice('models.classes.static_page', 1)) + 'model' => Str::ucfirst(\trans_choice('models.classes.static_page', 1)), ])); }); } diff --git a/app/Http/Controllers/Bo/UserController.php b/app/Http/Controllers/Bo/UserController.php index b9f7675..9073126 100644 --- a/app/Http/Controllers/Bo/UserController.php +++ b/app/Http/Controllers/Bo/UserController.php @@ -1,5 +1,7 @@ paginate($userModels); - return view('back::pages.users.index', compact('userModels', 'search', 'searchFields')); - } + /** @var view-string $view */ + $view = 'back::pages.users.index'; + return view($view, ['userModels' => $userModels, 'search' => $search, 'searchFields' => $searchFields]); + } /** * Show the form for creating a new resource. - * - * @param \App\Models\User $user - * @return \Illuminate\Contracts\View\View */ - public function create(User $user): \Illuminate\Contracts\View\View + public function create(User $user): View { - return view('back::pages.users.create', ['userModel' => $user]); + /** @var view-string $view */ + $view = 'back::pages.users.create'; + + return view($view, ['userModel' => $user]); } /** * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\Users\StoreUserRequest $request - * @return \Illuminate\Http\RedirectResponse */ - public function store(StoreUserRequest $request): \Illuminate\Http\RedirectResponse + public function store(StoreUserRequest $request): RedirectResponse { return DB::transaction(function () use ($request) { $user = new User(); $user->fill($request->validated()); if ($user->saveOrFail()) { - return redirect()->route('bo.users.edit', $user) + return to_route('bo.users.edit', $user) ->with('success', __('crud.messages.has_been_created', [ - 'model' => Str::ucfirst(__('models.classes.user')) + 'model' => Str::ucfirst(__('models.classes.user')), ])); } - return redirect()->back() + + return back() ->with('error', __('crud.messages.cannot_be_created', [ - 'model' => Str::ucfirst(__('models.classes.user')) + 'model' => Str::ucfirst(__('models.classes.user')), ])); }); } /** * Show the form for editing the specified resource. - * - * @param \App\Models\User $user - * @return \Illuminate\Contracts\View\View */ - public function edit(User $user): \Illuminate\Contracts\View\View + public function edit(User $user): View { - return view('back::pages.users.edit', ['userModel' => $user]); + /** @var view-string $view */ + $view = 'back::pages.users.edit'; + + return view($view, ['userModel' => $user]); } /** * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\Users\UpdateUserRequest $request - * @param \App\Models\User $user - * @return \Illuminate\Http\RedirectResponse */ - public function update(UpdateUserRequest $request, User $user): \Illuminate\Http\RedirectResponse + public function update(UpdateUserRequest $request, User $user): RedirectResponse { return DB::transaction(function () use ($request, $user) { $user->fill($request->validated()); if ($user->saveOrFail()) { - return redirect()->route('bo.users.edit', $user) + return to_route('bo.users.edit', $user) ->with('success', __('crud.messages.has_been_updated', [ - 'model' => Str::ucfirst(__('models.classes.user')) + 'model' => Str::ucfirst(__('models.classes.user')), ])); } - return redirect()->route('bo.users.edit', $user) + + return to_route('bo.users.edit', $user) ->with('error', __('crud.messages.cannot_be_updated', [ - 'model' => Str::ucfirst(__('models.classes.user')) + 'model' => Str::ucfirst(__('models.classes.user')), ])); }); } /** * Remove the specified resource from storage. - * - * @param \App\Models\User $user - * @return \Illuminate\Http\RedirectResponse */ - public function destroy(User $user): \Illuminate\Http\RedirectResponse + public function destroy(User $user): RedirectResponse { if ($user->deleteOrFail()) { - return redirect()->route('bo.users.index') + return to_route('bo.users.index') ->with('success', __('crud.messages.has_been_deleted', [ - 'model' => Str::ucfirst(__('models.classes.user')) + 'model' => Str::ucfirst(__('models.classes.user')), ])); } - return redirect()->back() + + return back() ->with('error', __('crud.messages.cannot_be_deleted', [ - 'model' => Str::ucfirst(__('models.classes.user')) + 'model' => Str::ucfirst(__('models.classes.user')), ])); } /** * Duplicate the specified resource. - * - * @param \App\Models\User $user - * @return \Illuminate\Contracts\View\View */ - public function duplicate(User $user): \Illuminate\Contracts\View\View + public function duplicate(User $user): View { return $this->create($user->replicate()); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 3f1dd61..e0021dd 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -1,13 +1,18 @@ 5, 'B'=>45, 'C'=>50) @@ -30,8 +34,9 @@ class Controller extends BaseController * weight was 2, and the other weight of 1, the value with the weight of 2 has about a 66% * chance of being selected. Also note that weights should be integers. * - * @param array<\App\Lib\Discount> $weightedValues - * @return integer The winning key + * @param array $weightedValues + * @return int The winning key + * * @url https://stackoverflow.com/a/11872928/4355295 */ protected function getRandomWeightedElementIndex(array $weightedValues): int @@ -45,13 +50,12 @@ class Controller extends BaseController return $key; } } + return $rand; } /** * Gives the redirection path for FO Auth controllers - * - * @return string */ protected function authLoggedRedirectPath(): string { @@ -62,63 +66,57 @@ class Controller extends BaseController * Build Search query on specified fields * splitting search into words or using whole sentence * - * @param \Illuminate\Database\Eloquent\Builder $query The eloquent query builder. - * @param string $search The query string. - * @param callable $searchQuery The query string. - * @param string ...$fields Either a simple array or a string - * in case of a string the two fields - * would be concatenate to make the search. - * @return \Illuminate\Database\Eloquent\Builder + * @param Builder $query The eloquent query builder. + * @param string $search The query string. + * @param callable $searchQuery The query string. + * @param string ...$fields Either a simple array or a string + * in case of a string the two fields + * would be concatenate to make the search. */ protected function searchQuery( Builder $query, string $search, - callable $searchQuery = null, + ?callable $searchQuery = null, string ...$fields - ): \Illuminate\Database\Eloquent\Builder { + ): Builder { if (count($fields)) { // Search using words. $words = explode(' ', $search); - $query->where(function ($query) use ($searchQuery, $words, $search, $fields) { + $query->where(function (\Illuminate\Contracts\Database\Query\Builder $query) use ($searchQuery, $words, $search, $fields): void { foreach ($words as $word) { - if (!strlen($word)) { + if (! strlen($word)) { continue; } $this->searchOnFields($query, $word, $fields); - } //end foreach + } // end foreach // Search whole using whole sentence. $this->searchOnFields($query, $search, $fields); if ($searchQuery) { $searchQuery($query); } }); - } //end if + } // end if + return $query; } /** * Build query search on all fields - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param string $search - * @param array $fields - * @return \Illuminate\Database\Eloquent\Builder */ private function searchOnFields( Builder $query, string $search, array $fields - ): \Illuminate\Database\Eloquent\Builder { + ): Builder { $table = $query->getModel()->getTable(); foreach ($fields as $field) { $field = str_replace('?', '\?', $field); if (is_array($field)) { $query->orWhereRaw( - sprintf("UPPER(CONCAT(%s)) LIKE UPPER(?)", collect($field)->map(function ($q) use ($table) { - return "`$table`.`$q`"; - })->implode(', \' \', ')), + sprintf('UPPER(CONCAT(%s)) LIKE UPPER(?)', collect($field)->map(fn ($q): string => "`$table`.`$q`")->implode(', \' \', ')), ['%' . htmlspecialchars($search) . '%'] ); + return $query; } // Get models woth enum's label. @@ -129,62 +127,56 @@ class Controller extends BaseController ['%' . htmlspecialchars($array->value) . '%'] ); } + return $query; } // Get models with relation's name/label. if (Str::endsWith($field, '_id')) { - $query->orWhereHas(Str::remove('_id', $field), function ($queryRelation) use ($field, $search) { - if (Schema::hasColumn(Str::remove('_id', $field) . 's', 'name')) { - $queryRelation->where('name', 'like', '%' . $search . '%'); - } elseif (Schema::hasColumn(Str::remove('_id', $field) . 's', 'label')) { - $queryRelation->where('label', 'like', '%' . $search . '%'); + $query->orWhereHas( + Str::remove('_id', $field), + function (\Illuminate\Contracts\Database\Query\Builder $queryRelation) use ($field, $search): void { + if (Schema::hasColumn(Str::remove('_id', $field) . 's', 'name')) { + $queryRelation->where('name', 'like', '%' . $search . '%'); + } elseif (Schema::hasColumn(Str::remove('_id', $field) . 's', 'label')) { + $queryRelation->where('label', 'like', '%' . $search . '%'); + } } - }); + ); + return $query; } $query->orWhereRaw( "UPPER(`$table`.`$field`) LIKE UPPER(?)", ['%' . htmlspecialchars($this->getSearchValue($query, $search, $field)) . '%'] ); - } //end foreach + } // end foreach + return $query; } /** * Get the search value (on string or Enum). - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param string $search - * @param string $field - * @return string|array */ - protected function getSearchValue(Builder $query, string $search, string $field): string|array + protected function getSearchValue(Builder $query, string $search, string $field): string | array { $cast = $query->getModel()->getCasts()[$field] ?? null; if ( - count($query->getModel()->getCasts()) and // Check if the model has casts. - $cast and // Check if there is cast about specific field. - enum_exists($cast) // Check if the cast is an enum. + count($query->getModel()->getCasts()) && $cast && enum_exists($cast) // Check if the cast is an enum. ) { // @phpstan-ignore-next-line $cases = collect($cast::toArray()); - $enum = $cases->filter(function ($item) use ($search) { - return preg_match('/' . Str::lower($search) . '/', Str::lower($item->label)); - }); + $enum = $cases->filter(fn ($item): int | false => preg_match('/' . Str::lower($search) . '/', Str::lower($item->label))); + return $enum->toArray(); - } else { - return $search; } + + return $search; } /** * Sort columns with a query. - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param array $ignore - * @return \Illuminate\Database\Eloquent\Builder */ - protected function sortQuery(Builder $query, array $ignore = []): \Illuminate\Database\Eloquent\Builder + protected function sortQuery(Builder $query, array $ignore = []): Builder { $rName = request()->route()->getName(); $table = $query->getModel()->getTable(); @@ -201,8 +193,8 @@ class Controller extends BaseController Session::remove("$rName.sort_col"); Session::remove("$rName.sort_way"); } - if (request()->sort_col and request()->sort_way and Schema::hasColumn($table, request()->sort_col)) { - if (!in_array(request()->sort_col, $ignore)) { + if (request()->sort_col && request()->sort_way && Schema::hasColumn($table, request()->sort_col)) { + if (! in_array(request()->sort_col, $ignore)) { $query = $query->orderBy(\sprintf("$table.%s", request()->sort_col), request()->sort_way); } } elseif (Schema::hasColumn($table, 'order')) { @@ -210,59 +202,55 @@ class Controller extends BaseController Session::put("$rName.sort_col", 'order'); Session::put("$rName.sort_way", 'asc'); } elseif (Schema::hasColumn($table, 'updated_at')) { - $query = $query->orderBy('updated_at', 'DESC'); + $query = $query->latest('updated_at'); Session::put("$rName.sort_col", 'updated_at'); Session::put("$rName.sort_way", 'desc'); } elseif (Schema::hasColumn($table, 'created_at')) { - $query = $query->orderBy('created_at', 'DESC'); + $query = $query->latest(); Session::put("$rName.sort_col", 'created_at'); Session::put("$rName.sort_way", 'desc'); } + return $query; } /** * Customize pagination with cache or config (default). - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @param \App\Enums\Pagination\ItemsPerPaginationEnum|null $pagination - * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator */ protected function paginate( Builder $query, - ItemsPerPaginationEnum $pagination = null - ): \Illuminate\Contracts\Pagination\LengthAwarePaginator { + ?ItemsPerPaginationEnum $pagination = null + ): LengthAwarePaginator { $currentRoutePath = Str::slug(request()->route()->getName()); $cacheKey = "pagination.{$currentRoutePath}"; - $pagination = $pagination ?? ItemsPerPaginationEnum::twelve; + $pagination ??= ItemsPerPaginationEnum::twelve; $pagination = ToolboxHelper::getValidatedEnum( Cache::get($cacheKey, $pagination->value()), 'pagination', - '\App\Enums\Pagination\ItemsPerPaginationEnum', + ItemsPerPaginationEnum::class, ); if (Cache::get($cacheKey) !== $pagination) { Cache::put($cacheKey, $pagination); } $query = $query->paginate($pagination); + return $query; } /** * Set the bootstrap theme or light (default). - * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\RedirectResponse */ - protected function setTheme(Request $request): \Illuminate\Http\RedirectResponse + protected function setTheme(Request $request): RedirectResponse { $theme = ToolboxHelper::getValidatedEnum( $request->theme ?: Cache::get('theme', BootstrapThemeEnum::light->value()), 'theme', '\App\Http\Controllers\BootstrapThemeEnum', ); - if (Cache::get("theme") !== $theme) { - Cache::put("theme", $theme); + if (Cache::get('theme') !== $theme) { + Cache::put('theme', $theme); } - return redirect()->back()->with('success', __('crud.messages.theme_updated')); + + return back()->with('success', __('crud.messages.theme_updated')); } } diff --git a/app/Http/Controllers/Fo/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Fo/Auth/ConfirmPasswordController.php index f5b2138..0bb5376 100644 --- a/app/Http/Controllers/Fo/Auth/ConfirmPasswordController.php +++ b/app/Http/Controllers/Fo/Auth/ConfirmPasswordController.php @@ -1,20 +1,21 @@ check()) { return \response()->redirectToRoute('home'); } - return view('theme::auth.passwords.confirm'); + + /** @var view-string $view */ + $view = 'theme::auth.passwords.confirm'; + + return view($view); } /** * Get the post register / login redirect path. - * - * @return string */ public function redirectPath(): string { diff --git a/app/Http/Controllers/Fo/Auth/ForgotPasswordController.php b/app/Http/Controllers/Fo/Auth/ForgotPasswordController.php index 711eb57..33264ba 100644 --- a/app/Http/Controllers/Fo/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Fo/Auth/ForgotPasswordController.php @@ -1,11 +1,14 @@ with('info', trans($this->message)); } + // * Renvoyer les autres message d'erreur style throttle. return back() ->withInput($request->only('email')) diff --git a/app/Http/Controllers/Fo/Auth/LoginController.php b/app/Http/Controllers/Fo/Auth/LoginController.php index c6b3b83..657b86e 100644 --- a/app/Http/Controllers/Fo/Auth/LoginController.php +++ b/app/Http/Controllers/Fo/Auth/LoginController.php @@ -1,5 +1,7 @@ api_data; - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); $countries = $settings->authorized_countries; - if (count($countries) && !in_array($crmCustomer->country->value, $countries)) { + if (count($countries) && ! in_array($crmCustomer->country->value, $countries)) { $this->logout($request); Session::flash('info', trans('front.messages.game_not_available_in_country')); } else { @@ -86,8 +84,6 @@ class LoginController extends Controller /** * The user has logged out of the application. * - * @param \Illuminate\Http\Request $request - * @return void * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ protected function loggedOut(Request $request): void @@ -97,8 +93,6 @@ class LoginController extends Controller /** * Get the post register / login redirect path. - * - * @return string */ public function redirectPath(): string { diff --git a/app/Http/Controllers/Fo/Auth/RegisterController.php b/app/Http/Controllers/Fo/Auth/RegisterController.php index 812c344..b01ef1b 100644 --- a/app/Http/Controllers/Fo/Auth/RegisterController.php +++ b/app/Http/Controllers/Fo/Auth/RegisterController.php @@ -1,10 +1,13 @@ prepareForValidation(); + return Validator::make( $request->validationData(), $request->rules(), @@ -77,10 +83,8 @@ class RegisterController extends Controller /** * Create a new user instance after a valid registration. * - * @param array $data - * @return \App\Models\Customer * @throws IlluminateValidationException If there are validation errors. - * @throws \RuntimeException On unhandled api Error. + * @throws RuntimeException On unhandled api Error. */ protected function create(array $data): Customer { @@ -107,7 +111,7 @@ class RegisterController extends Controller // * Enregistrement du Hashcode /** @var \App\Models\Customer $customer */ $customer = Customer::withTrashed()->firstOrNew([ - 'email' => $data['email'] + 'email' => $data['email'], ]); $customer->fill(Arr::only($data, $customer->getFillable())); $customer->hashcode = $crmCustomer->hashcode; @@ -127,30 +131,28 @@ class RegisterController extends Controller } catch (ApiErrorException $e) { if ($e->getApiError()->equals(ApiError::customerExists)) { throw IlluminateValidationException::withMessages([ - 'error' => trans('front.messages.email_already_in_use') + 'error' => trans('front.messages.email_already_in_use'), ]); } if ($e->getApiError()->equals(ApiError::validationFailed)) { throw IlluminateValidationException::withMessages([ - 'error' => $e->getMessage() + 'error' => $e->getMessage(), ]); } report($e); - Log::error(__CLASS__ . '::create reached end of possibilities.'); - throw new \RuntimeException(__CLASS__ . '::create reached end of possibilities.'); + Log::error(self::class . '::create reached end of possibilities.'); + throw new RuntimeException(self::class . '::create reached end of possibilities.', $e->getCode(), $e); } catch (CrmValidationException $e) { throw IlluminateValidationException::withMessages([ - 'error' => $e->getMessage() + 'error' => $e->getMessage(), ]); - } //end try + } // end try } /** * Get the post register / login redirect path. - * - * @return string */ - public function redirectPath() + public function redirectPath(): string { return $this->authLoggedRedirectPath(); } diff --git a/app/Http/Controllers/Fo/Auth/ResetPasswordController.php b/app/Http/Controllers/Fo/Auth/ResetPasswordController.php index 5d6475e..0c14d3a 100644 --- a/app/Http/Controllers/Fo/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Fo/Auth/ResetPasswordController.php @@ -1,20 +1,26 @@ route()->parameter('token'); - return view('theme::auth.passwords.reset')->with( + /** @var view-string $view */ + $view = 'theme::auth.passwords.reset'; + + return view($view)->with( ['token' => $token, 'email' => $request->email] ); } @@ -62,32 +64,29 @@ class ResetPasswordController extends Controller /** * Reset the given user's password. * - * @param \App\Models\Customer $customer - * @param string $password - * @return void * @throws \Illuminate\Validation\ValidationException If something goes wrong. */ - protected function resetPassword(\App\Models\Customer $customer, string $password): void + protected function resetPassword(Customer $customer, string $password): void { - /** @var \LDC\LDCCRM\CrmApiV4 */ - $crm = app('crmAPI'); + /** @var CrmApiV4 */ + $crm = resolve('crmAPI'); try { - if (!($crmCustomer = $crm->getCustomer($customer->hashcode))) { + if (! ($crmCustomer = $crm->getCustomer($customer->hashcode))) { throw ValidationException::withMessages([ - 'error' => trans('Changement impossible, compte inexistant.') + 'error' => trans('Changement impossible, compte inexistant.'), ]); } $crmCustomer->password = $password; $crmCustomer->save(); - } catch (\TypeError | CrmException | ApiErrorException $e) { + } catch (TypeError | CrmException | ApiErrorException $e) { report($e); throw ValidationException::withMessages([ - 'error' => trans('front.messages.unexpected_error_try_later') + 'error' => trans('front.messages.unexpected_error_try_later'), ]); } catch (ExceptionsValidationException $e) { throw ValidationException::withMessages([ - 'password' => $e->getMessage() + 'password' => $e->getMessage(), ]); } @@ -102,8 +101,6 @@ class ResetPasswordController extends Controller /** * Get the post register / login redirect path. - * - * @return string */ public function redirectPath(): string { @@ -112,8 +109,6 @@ class ResetPasswordController extends Controller /** * Get the broker to be used during password reset. - * - * @return \Illuminate\Contracts\Auth\PasswordBroker */ public function broker(): PasswordBroker { diff --git a/app/Http/Controllers/Fo/Auth/VerificationController.php b/app/Http/Controllers/Fo/Auth/VerificationController.php index 38d10b5..defb5c2 100644 --- a/app/Http/Controllers/Fo/Auth/VerificationController.php +++ b/app/Http/Controllers/Fo/Auth/VerificationController.php @@ -1,5 +1,7 @@ user('frontend')->hasVerifiedEmail() ? redirect($this->redirectPath()) - : view('theme::auth.verify'); + : view($view); } /** @@ -51,22 +52,16 @@ class VerificationController extends Controller * * ! Overloaded trait * - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse - * @throws \Illuminate\Auth\Access\AuthorizationException If request is invalid. + * @throws AuthorizationException If request is invalid. */ - public function verify(Request $request): JsonResponse|RedirectResponse + public function verify(Request $request): JsonResponse | RedirectResponse { - /** @var \App\Models\Customer */ + /** @var Customer */ $user = Customer::findOrFail($request->route('id')); - if (!hash_equals((string) $request->route('id'), (string) $user->getKey())) { - throw new AuthorizationException(); - } + throw_unless(hash_equals((string) $request->route('id'), (string) $user->getKey()), AuthorizationException::class); - if (!hash_equals((string) $request->route('hash'), sha1($user->getEmailForVerification()))) { - throw new AuthorizationException(); - } + throw_unless(hash_equals((string) $request->route('hash'), sha1($user->getEmailForVerification())), AuthorizationException::class); if ($user->hasVerifiedEmail()) { return $request->wantsJson() @@ -74,7 +69,7 @@ class VerificationController extends Controller : redirect($this->redirectPath()); } - DB::transaction(function () use ($user) { + DB::transaction(function () use ($user): void { if ($user->markEmailAsVerified()) { $this->setCrmCustomerAsVerified($user); event(new Verified($user)); @@ -93,8 +88,8 @@ class VerificationController extends Controller /** * The user has been verified. * - * @param \Illuminate\Http\Request $request * @return mixed + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ protected function verified(Request $request) @@ -107,8 +102,6 @@ class VerificationController extends Controller /** * Get the post register / login redirect path. - * - * @return string */ public function redirectPath(): string { @@ -118,9 +111,7 @@ class VerificationController extends Controller /** * Set Crm Customer active * - * @param \App\Models\Customer $customer - * @return void - * @throws \Illuminate\Http\Exceptions\HttpResponseException In case of failure. + * @throws HttpResponseException In case of failure. */ private function setCrmCustomerAsVerified(Customer $customer): void { @@ -137,12 +128,11 @@ class VerificationController extends Controller if ($e->getApiError()->equals(ApiError::customerAlreadyActive)) { // * Ignore this and continue, as it may be activated via another CRM service. return; - } else { - report($e); - redirect($this->redirectPath())->with('error', trans( - 'front.messages.unexpected_error_try_later' - ))->throwResponse(); } + report($e); + redirect($this->redirectPath())->with('error', trans( + 'front.messages.unexpected_error_try_later' + ))->throwResponse(); } } } diff --git a/app/Http/Controllers/Fo/CustomerController.php b/app/Http/Controllers/Fo/CustomerController.php index 8a12bc5..4873302 100644 --- a/app/Http/Controllers/Fo/CustomerController.php +++ b/app/Http/Controllers/Fo/CustomerController.php @@ -1,11 +1,16 @@ user(); $crmCustomer = $customer->api_data; - return view('theme::auth.profil-verify', compact('crmCustomer')); + /** @var view-string $view */ + $view = 'theme::auth.profil-verify'; + + return view($view, ['crmCustomer' => $crmCustomer]); } /** * Profile verify * - * @param \App\Http\Requests\Fo\Customers\VerifyInformationsRequest $request - * @return \Illuminate\Http\RedirectResponse * @throws IlluminateValidationException In case of any error validation or within the crm. */ public function profilVerifySubmit(VerifyInformationsRequest $request): RedirectResponse @@ -65,7 +67,7 @@ class CustomerController extends Controller try { return DB::transaction(function () use ($request) { // * --- FILL AND SAVE CUSTOMER - /** @var \App\Models\Customer */ + /** @var Customer */ $customer = auth('frontend')->user(); // * Màj, on ne mets pas à jour le mdp ou l'adresse email, juste les champs pour mesBr @@ -89,86 +91,93 @@ class CustomerController extends Controller } catch (CrmValidationException $e) { // * Local Validation failure throw IlluminateValidationException::withMessages([ - 'error' => $e->getMessage() + 'error' => $e->getMessage(), ]); } catch (ApiErrorException $e) { if ($e->getApiError()->equals(ApiError::validationFailed)) { throw IlluminateValidationException::withMessages([ - 'error' => $e->getMessage() + 'error' => $e->getMessage(), ]); } report($e); - Log::error(__CLASS__ . '::update reached end of possibilities.'); + Log::error(self::class . '::update reached end of possibilities.'); } catch (CrmException $e) { report($e); - Log::error(__CLASS__ . '::error occured on calling crm.'); + Log::error(self::class . '::error occured on calling crm.'); throw IlluminateValidationException::withMessages([ - 'error' => trans('Une erreur est survenue, veuillez réssayer plus tard') + 'error' => trans('Une erreur est survenue, veuillez réssayer plus tard'), ]); - } //end try + } // end try + return back()->withInput()->withErrors(trans('front.messages.unexpected_error_try_later')); } /** * View all customer winnig participations - * - * @return \Illuminate\Contracts\View\View */ public function viewWinningParticipations(): View { - $this->authorize('viewWonList', \App\Models\Participation::class); + $this->authorize('viewWonList', Participation::class); - /** @var \App\Models\Customer */ + /** @var Customer */ $customer = auth('frontend')->user(); // * Recupération des informations CRM - /** @var \LDC\LDCCRM\Models\Customer*/ + /** @var \LDC\LDCCRM\Models\Customer */ $crmUser = $this->crmRepository->fetchCrmCustomer($customer); - /** @var \LDC\MESBR\MesBr */ - $mesBr = app('mesBrAPI'); + /** @var MesBr $mesBr */ + $mesBr = resolve('mesBrAPI'); + + /** @var array{coupons?: list} $brBasket */ $brBasket = $mesBr->getBasket($crmUser); - if (!empty($brBasket['coupons'])) { - $canPrint = (collect($brBasket['coupons'])->sum('quantity') - collect($brBasket['coupons'])->sum('printed')); + + if (! empty($brBasket['coupons'])) { + $coupons = collect($brBasket['coupons']); + $canPrint = $coupons->sum('quantity') - $coupons->sum('printed'); } $winningList = $customer->participations() - ->with(['instantWin'])->where(function (Builder $q) { + ->with(['instantWin'])->where(function (Builder $q): void { $q->whereHas('instantWin'); })->get(); - return view('theme::pages.participation.winning-participations', [ + /** @var view-string $view */ + $view = 'theme::pages.participation.winning-participations'; + + return view($view, [ 'winningList' => $winningList, - 'canPrint' => $canPrint ?? null + 'canPrint' => $canPrint ?? null, ]); } /** * Call the CRM to add a single optin * - * @param \App\Http\Requests\Fo\Customers\SingleOptinRequest $request - * @return string|array|null|\Illuminate\Contracts\Translation\Translator * @throws \LDC\LDCCRM\Exceptions\ValidationException ValidationException. - * @throws \Illuminate\Contracts\Container\BindingResolutionException BindingResolutionException. + * @throws BindingResolutionException BindingResolutionException. */ - public function addOptIn(SingleOptinRequest $request) + public function addOptIn(SingleOptinRequest $request): Response | string { try { SingleOptin::setStatus($request->email, true); - return \response(trans("front.messages.newsletter_subscription_success"), 200); + + return \response(trans('front.messages.newsletter_subscription_success'), 200); } catch (ApiErrorException $e) { // Il y a deja un customerInfo avec optin a true pour ce customer. if ($e->getApiError()->equals(ApiError::singleOptinCustomerExists)) { return trans('front.messages.newsletter_email_already_subscribed'); } if (app()->bound('sentry')) { - app('sentry')->captureException($e); + resolve('sentry')->captureException($e); } + return \response(trans('front.messages.unexpected_error_try_later'), 404); } catch (CrmException $e) { if (app()->bound('sentry')) { - app('sentry')->captureException($e); + resolve('sentry')->captureException($e); } + return \response(trans('front.messages.unexpected_error_try_later'), 404); } } diff --git a/app/Http/Controllers/Fo/DiscountController.php b/app/Http/Controllers/Fo/DiscountController.php index b5630ec..34982bb 100644 --- a/app/Http/Controllers/Fo/DiscountController.php +++ b/app/Http/Controllers/Fo/DiscountController.php @@ -1,34 +1,37 @@ user(); $pdf = $this->fetchBrPdfFromMesBr($customer); if ($pdf === null) { \back()->withErrors([ - 'coupon' => trans('front.messages.pdf_download_error') + 'coupon' => trans('front.messages.pdf_download_error'), ])->throwResponse(); } return redirect()->to( sprintf( - "%s/basket/%s/print", + '%s/basket/%s/print', config('mesbr.endpoint'), $pdf ) @@ -38,53 +41,54 @@ class DiscountController extends Controller /** * Fetch coupons PDF. * - * @param \App\Models\Customer $customer - * @return string|null * @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh */ private function fetchBrPdfFromMesBr(Customer $customer): ?string { // phpcs:enable // * Phase - 1 Recupération des informations CRM - /** @var \App\Models\Customer $customer */ + /** @var Customer $customer */ $customer = auth('frontend')->user(); /** @var \LDC\LDCCRM\Models\Customer $crmCustomer */ $crmCustomer = $customer->api_data; try { - /** @var \LDC\MESBR\MesBr */ - $mesBr = app('mesBrAPI'); + /** @var MesBr */ + $mesBr = resolve('mesBrAPI'); $result = $mesBr->getBasket($crmCustomer); $result = \is_object($result) ? (array) $result : $result; - if (Arr::get($result, 'status') !== "OK") { - report(new \RuntimeException( + if (Arr::get($result, 'status') !== 'OK') { + report(new RuntimeException( \sprintf( 'MESBR : Une erreur est survenue. Code : %s Message : %s', - Arr::get($result, 'code') ?? 'Undefined', + Arr::get($result, 'code') ?? 'Undefined', Arr::get($result, 'message') ?? 'Undefined', ) )); + return null; } // * La réponse est conforme ? $needed_fields = ['uuid']; - if (!Arr::has($result, $needed_fields)) { - report(new \RuntimeException(sprintf( + if (! Arr::has($result, $needed_fields)) { + report(new RuntimeException(sprintf( 'MESBR : Il manques des champs dans la réponse, attendu => %s, donné => %s', json_encode($needed_fields), json_encode($result), ))); + return null; } // * Tout est OK return Arr::get($result, 'uuid') ?: null; - } catch (\RuntimeException $e) { + } catch (RuntimeException $e) { report($e); + // * Retenter ? return null; - } //end try + } // end try } } diff --git a/app/Http/Controllers/Fo/HomeController.php b/app/Http/Controllers/Fo/HomeController.php index 748e16f..f77d5a9 100644 --- a/app/Http/Controllers/Fo/HomeController.php +++ b/app/Http/Controllers/Fo/HomeController.php @@ -1,5 +1,7 @@ flash('warning', trans('front.messages.game_missing_required_elements')); } - return view('theme::pages.home'); + + /** @var view-string $view */ + $view = 'theme::pages.home'; + + return view($view); } /** * Display products with game stickers * - * @return \Illuminate\Contracts\View\View * @phpcs:ignore Squiz.Commenting.FunctionComment.EmptyThrows - * @throws \Illuminate\Http\Exceptions\HttpResponseException + * + * @throws HttpResponseException */ - public function showProducts(): \Illuminate\Contracts\View\View + public function showProducts(): View { // ? Show product list authorized ? - if (!Gate::allows('fo.showProducts')) { + if (! Gate::allows('fo.showProducts')) { \response()->redirectToRoute('fo.homepage')->throwResponse(); } $rangeModelList = Range::query()->with('products')->orderBy('id')->get(); - return view('theme::pages.products', compact('rangeModelList')); + + /** @var view-string $view */ + $view = 'theme::pages.products'; + + return view($view, ['rangeModelList' => $rangeModelList]); } /** * Display Faq page - * - * @return \Illuminate\Contracts\View\View */ - public function showFaq(): \Illuminate\Contracts\View\View + public function showFaq(): View { // ? Show QA authorized ? - if (!Gate::allows('fo.showFaq')) { + if (! Gate::allows('fo.showFaq')) { \response()->redirectToRoute('fo.homepage')->throwResponse(); } $questionModelList = FaqQuestion::getCached(); $themeModelList = FaqTheme::getCached(); - return view('theme::pages.faq', compact( - 'questionModelList', - 'themeModelList' - )); + /** @var view-string $view */ + $view = 'theme::pages.faq'; + + return view($view, ['questionModelList' => $questionModelList, 'themeModelList' => $themeModelList]); } /** * Show the teaser page if it is activated - * - * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse */ - public function teaser(): \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse + public function teaser(): View | RedirectResponse { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - if (!$settings->should_display_teaser_page) { - return redirect()->route('fo.homepage'); + /** @var Settings */ + $settings = resolve(Settings::class); + if (! $settings->should_display_teaser_page) { + return to_route('fo.homepage'); } - return view('theme::pages.teaser'); + + /** @var view-string $view */ + $view = 'theme::pages.teaser'; + + return view($view); } /** * Show the end game page if it is activated - * - * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse */ - public function endGame(): \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse + public function endGame(): View | RedirectResponse { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - if (!$settings->should_display_end_page) { - return redirect()->route('fo.homepage'); + /** @var Settings */ + $settings = resolve(Settings::class); + if (! $settings->should_display_end_page) { + return to_route('fo.homepage'); } - return view('theme::pages.end-game'); + + /** @var view-string $view */ + $view = 'theme::pages.end-game'; + + return view($view); } } diff --git a/app/Http/Controllers/Fo/ParticipateController.php b/app/Http/Controllers/Fo/ParticipateController.php index 6efe34e..807f560 100644 --- a/app/Http/Controllers/Fo/ParticipateController.php +++ b/app/Http/Controllers/Fo/ParticipateController.php @@ -1,5 +1,7 @@ middleware(function (Request $request, callable $next) { $this->authorize('fo.gameEnabled'); $this->assertUserHasEnoughInfoToUseMesBr(); + return $next($request); }); } /** * Display participation form - * - * @return \Illuminate\Contracts\View\View */ - public function participate(): \Illuminate\Contracts\View\View + public function participate(): View { - if (!Gate::check('participate', Participation::class)) { - return view('theme::pages.participation.participation-exhausted'); + if (! Gate::check('participate', Participation::class)) { + /** @var view-string $view */ + $view = 'theme::pages.participation.participation-exhausted'; + return view($view); } - return view('theme::pages.participation.participate'); + + /** @var view-string $view */ + $view = 'theme::pages.participation.participate'; + + return view($view); } /** * Participate Method - * - * @param \App\Http\Requests\Fo\ParticipateRequest $request - * @return \Illuminate\Contracts\View\View */ - public function participateSubmit(ParticipateRequest $request): \Illuminate\Contracts\View\View + public function participateSubmit(ParticipateRequest $request): View { return DB::transaction(function () use ($request) { // ! On verrouille le ou les instants gagnant - /** @var \App\Models\InstantWin|null */ + /** @var InstantWin|null */ $instantWin = InstantWin::query()->lockForUpdate() ->where('available_at', '<', now()) ->whereDoesntHave('participation') ->get()->sortBy('available_at')->first(); - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); - /** @var \App\Models\Customer */ + /** @var Customer */ $customer = auth('frontend')->user(); - /** @var \App\Models\Code|null */ + /** @var Code|null */ $code = $request->post('unique_code'); - /** @var \App\Models\Product|null */ + /** @var Product|null */ $product = $request->post('product'); // * Make new participation $participation = Participation::makeNew( - app('clientIp'), + resolve('clientIp'), $customer, $code, $product @@ -92,19 +101,21 @@ class ParticipateController extends Controller // * Si l'utilisateur actuel à déjà gagné un gros lot, pas d'instant gagnant. // ? As-t-on un instant gagnant ? - if (Participation::customerAlreadyHasAnInstantWin($customer) or !$instantWin) { + if (Participation::customerAlreadyHasAnInstantWin($customer) || ! $instantWin) { // * --- DISCOUNT WIN --- // ? Les BR sont activés ? - if (!$settings->discounts_activated) { + if (! $settings->discounts_activated) { // * On enregistre la participation du joueur. $participation->save(); - // * Pas de coupons disponibles, le joueur à perdu - return view('theme::pages.participation.loose'); + /** @var view-string $view Pas de coupons disponibles, le joueur à perdu. */ + $view = 'theme::pages.participation.loose'; + + return view($view); } // * Le joueur à gagné un coupon. - /** @var \App\Lib\Discount Coupon aléatoire en fonction du ratio de chaque coupon */ + /** @var \App\Lib\Discount Coupon aléatoire en fonction du ratio de chaque coupon */ $discount = Arr::get( $settings->web_coupons, $this->getRandomWeightedElementIndex($settings->web_coupons) @@ -124,8 +135,11 @@ class ParticipateController extends Controller $crmCustomer->firstname )); - return view('theme::pages.participation.won', compact('discount')); - } //end if + /** @var view-string $view */ + $view = 'theme::pages.participation.won'; + + return view($view, ['discount' => $discount]); + } // end if // * --- INSTANT WIN --- // * On enregistre la participation du joueur. @@ -148,43 +162,42 @@ class ParticipateController extends Controller $participation->created_at, $instantWin->prize->label, $crmCustomer, - optional($code)->code_unique, - optional($product)->ean_code + $code?->code_unique, + $product?->ean_code )); - return view('theme::pages.participation.won', [ - 'prizeModel' => $instantWin->prize, + /** @var view-string $view */ + $view = 'theme::pages.participation.won'; + return view($view, [ + 'prizeModel' => $instantWin->prize, 'participationModel' => $participation, - 'crmCustomer' => $crmCustomer + 'crmCustomer' => $crmCustomer, ]); }); } // * --- PRIVATE METHODS --- - /** * Try Call CRM + MesBr to setup discount * - * @param \App\Models\Customer $customer - * @param LibDiscount $discount - * @return void - * @throws \Illuminate\Http\Exceptions\HttpResponseException If Any error occurs. - * @phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber + * @throws HttpResponseException If Any error occurs. + * + * @phpcs:disable Generic.Metrics.CyclomaticComplexity */ private function setDiscountAsWon(Customer $customer, LibDiscount $discount): void { // phpcs:enable // * Phase - 1 Recupération des informations CRM - /** @var \LDC\LDCCRM\Models\Customer*/ + /** @var \LDC\LDCCRM\Models\Customer */ $crmUser = $this->crmRepository->fetchCrmCustomer($customer); // * Phase - 2 Mise à jour du coupon dans MesBr try { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); - /** @var \LDC\MESBR\MesBr */ - $mesBr = app('mesBrAPI'); + /** @var MesBr */ + $mesBr = resolve('mesBrAPI'); // * MaJ Customer /** @var string */ @@ -195,23 +208,24 @@ class ParticipateController extends Controller * * Id est necessaire pour update panier.. */ + /** @var object|null $result */ $result = $mesBr->updateCustomer($crmUser->hashcode, $crmUser->email, $crmUser->country->label()); - if (optional($result)->status !== "OK") { - throw new \RuntimeException( + if ($result?->status !== 'OK') { + throw new RuntimeException( \sprintf( 'MESBR : Une erreur est survenue. Code : %s Message : %s', - $result->code ?? 'Undefined', + $result->code ?? 'Undefined', $result->message ?? 'Undefined' ) ); } - /** @var object|null */ - $crm_customer = optional($result)->customer; - if (empty(optional($crm_customer)->hashcode)) { - throw new \RuntimeException( - 'MESBR : Une erreur est survenue. Update Customer n\'as pas retourné le customer hashcode' - ); - } + /** @var object|null $crm_customer */ + $crm_customer = $result->customer ?? null; + throw_if( + empty($crm_customer->hashcode), + RuntimeException::class, + 'MESBR : Une erreur est survenue. Update Customer n\'as pas retourné le customer hashcode', + ); return $crm_customer->hashcode; }, 100); @@ -222,11 +236,11 @@ class ParticipateController extends Controller strval($discount->web_coupon_identifiant) ); - if (Arr::get($result, 'status') === "OK") { + if (Arr::get($result, 'status') === 'OK') { // * La réponse est conforme ? $needed_fields = ['ref']; - if (!Arr::has($result, $needed_fields)) { - throw new \RuntimeException(sprintf( + if (! Arr::has($result, $needed_fields)) { + throw new RuntimeException(sprintf( 'MESBR : Il manques des champs dans la réponse, attendu => %s, donné => %s', json_encode($needed_fields), json_encode($result), @@ -237,20 +251,18 @@ class ParticipateController extends Controller return; } - throw new \RuntimeException( + throw new RuntimeException( \sprintf( 'MESBR : Une erreur est survenue. Code : %s Message : %s', - $result["code"] ?? 'Undefined', - $result["message"] ?? 'Undefined' + $result['code'] ?? 'Undefined', + $result['message'] ?? 'Undefined' ) ); - } catch (\RuntimeException $e) { + } catch (RuntimeException $e) { report($e); // * Retenter ? back()->with('error', trans('front.messages.unexpected_error_try_later'))->throwResponse(); - } //end try - - throw new \Error('Should not reach this point'); + } // end try } /** @@ -258,35 +270,34 @@ class ParticipateController extends Controller * Or redirect him to the fill form * ! Also validates its birth date (because beeing an adult is required to participate) * - * @return void - * @throws \Illuminate\Http\Exceptions\HttpResponseException If customer data doest not validate - * or and error occurs. + * @throws HttpResponseException If customer data doest not validate + * or and error occurs. */ private function assertUserHasEnoughInfoToUseMesBr(): void { // * Valider que le client dispose des donnés requises pour MesBr try { - /** @var \App\Models\Customer */ + /** @var Customer */ $authUser = auth('frontend')->user(); $crmCustomer = $this->crmRepository->fetchCrmCustomer($authUser); // * On valide les données selon les critères du site - $rules = collect((new CreateAccountRequest())->rules()); + $rules = collect(new CreateAccountRequest()->rules()); Validator::make( [ - 'birth_date' => $crmCustomer->birth_date, - 'address' => $crmCustomer->address, + 'birth_date' => $crmCustomer->birth_date, + 'address' => $crmCustomer->address, 'postal_code' => $crmCustomer->postcode, - 'country' => $crmCustomer->country->value, - 'city' => $crmCustomer->city + 'country' => $crmCustomer->country->value, + 'city' => $crmCustomer->city, ], [ - 'birth_date' => $rules->get('birth_date'), - 'address' => $rules->get('address'), + 'birth_date' => $rules->get('birth_date'), + 'address' => $rules->get('address'), 'postal_code' => $rules->get('postal_code'), - 'country' => $rules->get('country'), - 'city' => $rules->get('city') + 'country' => $rules->get('country'), + 'city' => $rules->get('city'), ] )->validate(); Session::remove('needCrmInfoUpdate'); @@ -295,13 +306,13 @@ class ParticipateController extends Controller ->with('warning', trans( 'front.messages.profile_incomplete_cannot_play' ))->throwResponse(); - } catch (\Exception $e) { + } catch (Exception $e) { report($e); // * Retenter ? response()->redirectToRoute('fo.homepage') ->with('error', trans('front.messages.unexpected_error_try_later')) ->throwResponse(); - } //end try + } // end try } // * --- END PRIVATE METHODS --- diff --git a/app/Http/Controllers/Fo/StaticPageController.php b/app/Http/Controllers/Fo/StaticPageController.php index 3933012..118487c 100644 --- a/app/Http/Controllers/Fo/StaticPageController.php +++ b/app/Http/Controllers/Fo/StaticPageController.php @@ -1,5 +1,7 @@ where('type', StaticPageType::rules)->firstOrFail(); + return $this->viewStaticPage($staticPageModel); } /** * Show the privacy view - * - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory */ - public function charte() + public function charte(): View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::confidentiality)->firstOrFail(); + return $this->viewStaticPage($staticPageModel); } /** * Show the legals view - * - * @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory */ - public function legals() + public function legals(): View { $staticPageModel = StaticPage::query()->where('type', StaticPageType::legals)->firstOrFail(); + return $this->viewStaticPage($staticPageModel); } /** * Display a static page - * - * @param \App\Models\StaticPage $staticPageModel - * @return \Illuminate\Contracts\View\View */ private function viewStaticPage(StaticPage $staticPageModel): View { - return view('theme::pages.static_page', [ - 'staticPageModel' => $staticPageModel + /** @var view-string $view */ + $view = 'theme::pages.static_page'; + + return view($view, [ + 'staticPageModel' => $staticPageModel, ]); } } diff --git a/app/Http/Controllers/Fo/WinningProofController.php b/app/Http/Controllers/Fo/WinningProofController.php index a299b8e..476dcf0 100644 --- a/app/Http/Controllers/Fo/WinningProofController.php +++ b/app/Http/Controllers/Fo/WinningProofController.php @@ -1,10 +1,13 @@ middleware(function (Request $request, callable $next) { $this->authorize('fo.gameEnabled'); $this->authorize('submitProof', $request->route('participation')); + return $next($request); }); } /** * Display winning proof form - * - * @param \App\Models\Participation $participation - * @return \Illuminate\Contracts\View\View */ public function displayForm(Participation $participation): View { $participation->load('instantWin.prize'); - /** @var \App\Models\Customer */ + /** @var Customer */ $customer = auth('frontend')->user(); $crmCustomer = $customer->api_data; - return view('theme::pages.participation.won-form-only', [ + /** @var view-string $view */ + $view = 'theme::pages.participation.won-form-only'; + + return view($view, [ 'participationModel' => $participation, - 'prizeModel' => $participation->instantWin->prize, - 'crmCustomer' => $crmCustomer + 'prizeModel' => $participation->instantWin->prize, + 'crmCustomer' => $crmCustomer, ]); } @@ -64,10 +67,8 @@ class WinningProofController extends Controller * - 2 Save les pictures de preuve de gains * - 3 Envoi un mail au abonnés (settings notification_emails) avec les infos client * - * @param \App\Http\Requests\Fo\SubmitWinningProofRequest $request - * @param \App\Models\Participation $participation - * @return \Illuminate\Http\RedirectResponse * @throws IlluminateValidationException In case of failure. + * * @phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber */ public function displayFormSubmit( @@ -80,14 +81,14 @@ class WinningProofController extends Controller $participation->load([ 'instantWin.prize', 'code', - 'product' + 'product', ]); - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); // * --- PHASE 1 Update Crm Customer --- - /** @var \App\Models\Customer */ + /** @var Customer */ $customer = auth('frontend')->user(); $crmCustomer = $customer->api_data; @@ -118,7 +119,7 @@ class WinningProofController extends Controller $participation->fill(Arr::only($request->validated(), [ 'barcode', 'ticket', - 'sticker' + 'sticker', ])); $participation->save(); @@ -130,8 +131,8 @@ class WinningProofController extends Controller $participation->created_at, $participation->instantWin->prize->label, $crmCustomer, - optional($participation->code)->code_unique, - optional($participation->product)->ean_code, + $participation->code?->code_unique, + $participation->product?->ean_code, $participation->sticker, $participation->ticket, $participation->barcode, @@ -145,16 +146,16 @@ class WinningProofController extends Controller } catch (ApiErrorException $e) { if ($e->getApiError()->equals(ApiError::validationFailed)) { throw IlluminateValidationException::withMessages([ - 'error' => $e->getMessage() + 'error' => $e->getMessage(), ]); } report($e); - Log::error(__CLASS__ . '::create reached end of possibilities.'); - throw new \RuntimeException(__CLASS__ . '::create reached end of possibilities.'); + Log::error(self::class . '::create reached end of possibilities.'); + throw new RuntimeException(self::class . '::create reached end of possibilities.', $e->getCode(), $e); } catch (CrmValidationException $e) { throw IlluminateValidationException::withMessages([ - 'error' => $e->getMessage() + 'error' => $e->getMessage(), ]); - } //end try + } // end try } } diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 245b5c6..fcda28c 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -1,8 +1,37 @@ */ + #[\Override] protected $middleware = [ - \App\Http\Middleware\TrustHosts::class, - \App\Http\Middleware\TrustProxies::class, - \Illuminate\Http\Middleware\HandleCors::class, - \App\Http\Middleware\PreventRequestsDuringMaintenance::class, - \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, - \App\Http\Middleware\TrimStrings::class, - \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, + TrustHosts::class, + TrustProxies::class, + HandleCors::class, + PreventRequestsDuringMaintenance::class, + ValidatePostSize::class, + TrimStrings::class, + ConvertEmptyStringsToNull::class, ]; /** @@ -28,22 +58,23 @@ class Kernel extends HttpKernel * * @var array> */ + #[\Override] protected $middlewareGroups = [ 'web' => [ 'htmlsanitize', - \App\Http\Middleware\EncryptCookies::class, - \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, - \Illuminate\Session\Middleware\StartSession::class, - \Illuminate\View\Middleware\ShareErrorsFromSession::class, - \App\Http\Middleware\VerifyCsrfToken::class, - \Illuminate\Routing\Middleware\SubstituteBindings::class, - \App\Http\Middleware\SecureHeaders::class, - \App\Http\Middleware\CheckThemeVersion::class + EncryptCookies::class, + AddQueuedCookiesToResponse::class, + StartSession::class, + ShareErrorsFromSession::class, + VerifyCsrfToken::class, + SubstituteBindings::class, + SecureHeaders::class, + CheckThemeVersion::class, ], 'api' => [ - \Illuminate\Routing\Middleware\ThrottleRequests::class . ':api', - \Illuminate\Routing\Middleware\SubstituteBindings::class, + ThrottleRequests::class . ':api', + SubstituteBindings::class, ], ]; @@ -54,18 +85,19 @@ class Kernel extends HttpKernel * * @var array */ - protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, - 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, - 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, - 'check-game-status' => \App\Http\Middleware\CheckGameStatus::class, - 'signed' => \App\Http\Middleware\ValidateSignature::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, - 'htmlsanitize' => \App\Http\Middleware\HtmlSanitizer::class, + #[\Override] + protected $middlewareAliases = [ + 'auth' => Authenticate::class, + 'auth.basic' => AuthenticateWithBasicAuth::class, + 'auth.session' => AuthenticateSession::class, + 'cache.headers' => SetCacheHeaders::class, + 'can' => Authorize::class, + 'guest' => RedirectIfAuthenticated::class, + 'password.confirm' => RequirePassword::class, + 'check-game-status' => CheckGameStatus::class, + 'signed' => ValidateSignature::class, + 'throttle' => ThrottleRequests::class, + 'verified' => EnsureEmailIsVerified::class, + 'htmlsanitize' => HtmlSanitizer::class, ]; } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index a332aa5..0495faf 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -1,5 +1,7 @@ route('bo.login') + 'backend' => route('bo.login'), ]; - if (!$request->expectsJson()) { + if (! $request->expectsJson()) { // * Notify must login Session::flash('warning', trans('Veuillez vous connecter pour continuer')); foreach ($request->route()->gatherMiddleware() as $middleware) { - if (\is_string($middleware) and strpos($middleware, 'auth:') !== false) { + if (\is_string($middleware) && str_contains($middleware, 'auth:')) { $route = $logins[str_replace('auth:', '', $middleware)] ?? null; if ($route) { return $route; } } } + return route('fo.login'); } diff --git a/app/Http/Middleware/CheckGameStatus.php b/app/Http/Middleware/CheckGameStatus.php index 5265286..187c1e1 100644 --- a/app/Http/Middleware/CheckGameStatus.php +++ b/app/Http/Middleware/CheckGameStatus.php @@ -1,9 +1,13 @@ should_display_end_page => redirect()->route('fo.end'), + $settings->should_display_end_page => to_route('fo.end'), // * Teaser - $settings->should_display_teaser_page => redirect()->route('fo.teaser'), + $settings->should_display_teaser_page => to_route('fo.teaser'), // * Game is ended $settings->game_has_ended => redirect($settings->redirect_close), // * Game has started diff --git a/app/Http/Middleware/CheckThemeVersion.php b/app/Http/Middleware/CheckThemeVersion.php index 341cef4..1099e3e 100644 --- a/app/Http/Middleware/CheckThemeVersion.php +++ b/app/Http/Middleware/CheckThemeVersion.php @@ -1,12 +1,15 @@ runningInConsole()) { - $appInfos = Cache::remember('composer', 84600, function () { - return json_decode(File::get(\app_path('../composer.json'))); - }); + if (! app()->runningInConsole()) { + $appInfos = Cache::remember('composer', 84600, fn (): mixed => json_decode(File::get(\app_path('../composer.json')))); // * Assert theme version does not diverge more than minor $appVer = Str::of($appInfos->version)->explode('.'); $themeVer = Str::of(config('theme.version'))->explode('.'); if ( // * Major check - Arr::get($appVer, 0) !== Arr::get($themeVer, 0) or - // * Patch check - Arr::get($appVer, 1) !== Arr::get($themeVer, 1) + Arr::get($appVer, 0) !== Arr::get($themeVer, 0) || Arr::get($appVer, 1) !== Arr::get($themeVer, 1) ) { Session::flash('warning', trans( 'Ce thème n\'a semble t-il pas été vérifié pour cette version du moteur' diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index b6e9bbc..7d8b0f8 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -1,5 +1,7 @@ */ + #[\Override] protected $except = []; } diff --git a/app/Http/Middleware/HtmlSanitizer.php b/app/Http/Middleware/HtmlSanitizer.php index 857ca84..6715802 100644 --- a/app/Http/Middleware/HtmlSanitizer.php +++ b/app/Http/Middleware/HtmlSanitizer.php @@ -1,8 +1,11 @@ all(); /** @var callable|null */ $cleanInput = null; $cleanInput = function ( - null|string|array &$input, + null | string | array &$input, string $name, ?string $rootName = null ) use ( @@ -33,14 +31,14 @@ class HtmlSanitizer if (is_array($input)) { array_walk_recursive($input, $cleanInput, $name); } - if (!is_string($input)) { + if (! is_string($input)) { return; } - if (in_array($name, $params) or in_array($rootName ?? $name, $params)) { + if (in_array($name, $params) || in_array($rootName ?? $name, $params)) { // ? Is a json input ? if ($isJson = \json_decode($input, true) and is_array($isJson)) { // ! Decode each json field recursive. - \array_walk_recursive($isJson, function (string|array &$item) { + \array_walk_recursive($isJson, function (string | array &$item): void { if (\is_string($item)) { $item = clean($item); $item = ToolboxHelper::stripCkEditorSchemesOnMediaInputs($item); @@ -56,6 +54,7 @@ class HtmlSanitizer }; \array_walk($inputs, $cleanInput); $request->merge($inputs); + return $next($request); } } diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php index 842e4b9..54bc19d 100644 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -1,5 +1,7 @@ */ + #[\Override] protected $except = []; } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 5d4933f..bf6b025 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -1,8 +1,12 @@ check()) { switch ($guard) { case 'frontend': - return \redirect()->route('fo.homepage'); + return to_route('fo.homepage'); case 'backend': - if (!$request->routeIs('bo.*')) { + if (! $request->routeIs('bo.*')) { continue 2; } - return \redirect()->route('bo.dashboard'); + + return to_route('bo.dashboard'); default: - throw new \RuntimeException("Unhandled guard `{$guard}` ."); + throw new RuntimeException("Unhandled guard `{$guard}` ."); } } } diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.php index ba31e64..bce2b17 100644 --- a/app/Http/Middleware/SecureHeaders.php +++ b/app/Http/Middleware/SecureHeaders.php @@ -1,5 +1,7 @@ headers->set( diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php index 88cadca..4821bdf 100644 --- a/app/Http/Middleware/TrimStrings.php +++ b/app/Http/Middleware/TrimStrings.php @@ -1,5 +1,7 @@ */ + #[\Override] protected $except = [ 'current_password', 'password', diff --git a/app/Http/Middleware/TrustHosts.php b/app/Http/Middleware/TrustHosts.php index 7186414..d99ee5e 100644 --- a/app/Http/Middleware/TrustHosts.php +++ b/app/Http/Middleware/TrustHosts.php @@ -1,5 +1,7 @@ |string|null */ + #[\Override] protected $proxies = '*'; /** * The headers that should be used to detect proxies. * - * @var integer + * @var int */ + #[\Override] protected $headers = - Request::HEADER_X_FORWARDED_FOR | + Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | diff --git a/app/Http/Middleware/ValidateSignature.php b/app/Http/Middleware/ValidateSignature.php index 83aa732..39421f8 100644 --- a/app/Http/Middleware/ValidateSignature.php +++ b/app/Http/Middleware/ValidateSignature.php @@ -1,5 +1,7 @@ */ + #[\Override] protected $except = [ - '/csp-report' + '/csp-report', ]; } diff --git a/app/Http/Requests/Bo/BannedIps/StoreBannedIpRequest.php b/app/Http/Requests/Bo/BannedIps/StoreBannedIpRequest.php index 43029bb..8056fa2 100644 --- a/app/Http/Requests/Bo/BannedIps/StoreBannedIpRequest.php +++ b/app/Http/Requests/Bo/BannedIps/StoreBannedIpRequest.php @@ -1,5 +1,7 @@ 'required|ip|unique:banned_ips,ip', @@ -32,8 +32,6 @@ class StoreBannedIpRequest extends FormRequest /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Bo/BannedIps/UpdateBannedIpRequest.php b/app/Http/Requests/Bo/BannedIps/UpdateBannedIpRequest.php index fe67771..6bb6d4a 100644 --- a/app/Http/Requests/Bo/BannedIps/UpdateBannedIpRequest.php +++ b/app/Http/Requests/Bo/BannedIps/UpdateBannedIpRequest.php @@ -1,7 +1,10 @@ route('banned_ip'); + return [ 'ip' => [ 'required', 'ip', Rule::unique('banned_ips', 'ip') - ->ignore($ipToBanModel->ip, 'ip') + ->ignore($ipToBanModel->ip, 'ip'), ], ]; } diff --git a/app/Http/Requests/Bo/Codes/CodeSearchRequest.php b/app/Http/Requests/Bo/Codes/CodeSearchRequest.php index 4554d27..f9f01fe 100644 --- a/app/Http/Requests/Bo/Codes/CodeSearchRequest.php +++ b/app/Http/Requests/Bo/Codes/CodeSearchRequest.php @@ -1,5 +1,7 @@ 'required|string|min:1|max:25' + 'code' => 'required|string|min:1|max:25', ]; } @@ -38,7 +40,7 @@ class CodeSearchRequest extends FormRequest public function attributes(): array { return [ - 'code' => trans('code') + 'code' => trans('code'), ]; } } diff --git a/app/Http/Requests/Bo/Codes/ExportCodesRequest.php b/app/Http/Requests/Bo/Codes/ExportCodesRequest.php index 56eb246..45af062 100644 --- a/app/Http/Requests/Bo/Codes/ExportCodesRequest.php +++ b/app/Http/Requests/Bo/Codes/ExportCodesRequest.php @@ -1,5 +1,7 @@ json(); + return Gate::check('export', Code::class) && $this->json(); } /** * Prepare the data for validation. - * - * @return void */ protected function prepareForValidation(): void { $codesAvailableToExport = Code::query()->where('code_exported', false); - /** @var integer|null */ - $lastExportedId = optional(Code::query()->where('code_exported', true) - ->orderBy('id', 'desc')->first())->id ?? null; + + /** @var int|null $lastExportedId */ + $lastExportedId = Code::query()->where('code_exported', true)->max('id'); + if ($lastExportedId) { - $codesAvailableToExport = $codesAvailableToExport - ->where('id', '>', $lastExportedId); + $codesAvailableToExport->where('id', '>', $lastExportedId); } + $this->merge([ - 'available_export' => $codesAvailableToExport->count() + 'available_export' => $codesAvailableToExport->count(), ]); } @@ -46,10 +45,10 @@ class ExportCodesRequest extends FormRequest public function rules(): array { return [ - 'nb_code_tot' => 'required|integer|min:1|lte:available_export', - 'nb_code_fic' => 'required|integer|min:1', - 'nb_code_ligne' => 'required|integer|min:1', - 'available_export' => 'required|integer' + 'nb_code_tot' => 'required|integer|min:1|lte:available_export', + 'nb_code_fic' => 'required|integer|min:1', + 'nb_code_ligne' => 'required|integer|min:1', + 'available_export' => 'required|integer', ]; } @@ -61,10 +60,10 @@ class ExportCodesRequest extends FormRequest public function attributes(): array { return [ - 'nb_code_fic' => trans('nombre total de codes à exporter'), - 'nb_code_tot' => trans('nombre de codes par fichier'), - 'nb_code_ligne' => trans('nombre de codes par ligne'), - 'available_export' => trans('nombre de codes restant à exporté(s)') + 'nb_code_fic' => trans('nombre total de codes à exporter'), + 'nb_code_tot' => trans('nombre de codes par fichier'), + 'nb_code_ligne' => trans('nombre de codes par ligne'), + 'available_export' => trans('nombre de codes restant à exporté(s)'), ]; } } diff --git a/app/Http/Requests/Bo/Codes/GenerateCodesRequest.php b/app/Http/Requests/Bo/Codes/GenerateCodesRequest.php index 25d76a4..4e75d96 100644 --- a/app/Http/Requests/Bo/Codes/GenerateCodesRequest.php +++ b/app/Http/Requests/Bo/Codes/GenerateCodesRequest.php @@ -1,5 +1,7 @@ json(); + return Gate::check('generate', Code::class) && $this->json(); } /** @@ -26,7 +26,7 @@ class GenerateCodesRequest extends FormRequest public function rules(): array { return [ - 'quantity' => 'required|integer|min:1' + 'quantity' => 'required|integer|min:1', ]; } @@ -38,7 +38,7 @@ class GenerateCodesRequest extends FormRequest public function attributes(): array { return [ - 'quantity' => trans('validation.custom.quantity') + 'quantity' => trans('validation.custom.quantity'), ]; } } diff --git a/app/Http/Requests/Bo/FaqQuestions/StoreFaqQuestionRequest.php b/app/Http/Requests/Bo/FaqQuestions/StoreFaqQuestionRequest.php index 49180bc..d5869a5 100644 --- a/app/Http/Requests/Bo/FaqQuestions/StoreFaqQuestionRequest.php +++ b/app/Http/Requests/Bo/FaqQuestions/StoreFaqQuestionRequest.php @@ -1,5 +1,7 @@ 'required|string|min:3|max:255', - 'answer' => 'required|string|min:3', + 'answer' => 'required|string|min:3', 'theme_id' => 'required|exists:faq_themes,id', ]; } /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { return [ 'question' => trans('validation.custom.question'), - 'answer' => trans('validation.custom.answer'), + 'answer' => trans('validation.custom.answer'), 'theme_id' => trans_choice('models.classes.faq-themes', 1), ]; } diff --git a/app/Http/Requests/Bo/FaqQuestions/UpdateFaqQuestionRequest.php b/app/Http/Requests/Bo/FaqQuestions/UpdateFaqQuestionRequest.php index f75511c..c12b9d9 100644 --- a/app/Http/Requests/Bo/FaqQuestions/UpdateFaqQuestionRequest.php +++ b/app/Http/Requests/Bo/FaqQuestions/UpdateFaqQuestionRequest.php @@ -1,5 +1,7 @@ 'required|string|min:3|max:255' + 'name' => 'required|string|min:3|max:255', ]; } /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Bo/FaqThemes/UpdateFaqThemeRequest.php b/app/Http/Requests/Bo/FaqThemes/UpdateFaqThemeRequest.php index e17e44f..9de3e27 100644 --- a/app/Http/Requests/Bo/FaqThemes/UpdateFaqThemeRequest.php +++ b/app/Http/Requests/Bo/FaqThemes/UpdateFaqThemeRequest.php @@ -1,5 +1,7 @@ merge([ - 'pdf_winning_proof' => $this->input('pdf_winning_proof') + 'pdf_winning_proof' => $this->input('pdf_winning_proof'), ]); } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { $rules = [ - 'label' => 'required|string|min:3|max:255', - 'picture_alt' => 'required|string|between:3,255', - 'picture_title' => 'required|string|between:3,255', - 'arg_title' => 'required|string|min:3|max:255', - 'arg_subtitle' => 'nullable|string|min:3|max:255', - 'arg_content' => 'required|string|min:15', - 'quantity' => 'required|numeric|min:1', + 'label' => 'required|string|min:3|max:255', + 'picture_alt' => 'required|string|between:3,255', + 'picture_title' => 'required|string|between:3,255', + 'arg_title' => 'required|string|min:3|max:255', + 'arg_subtitle' => 'nullable|string|min:3|max:255', + 'arg_content' => 'required|string|min:15', + 'quantity' => 'required|numeric|min:1', 'pdf_winning_proof' => 'nullable|file|mimes:pdf', ]; $min_width = config('theme.models.prizes.picture_min_width'); $min_height = config('theme.models.prizes.picture_min_height'); $max_width = config('theme.models.prizes.picture_max_width'); $max_height = config('theme.models.prizes.picture_max_height'); + return \array_merge( $rules, $this->pictureRules('picture', $min_width, $min_height, $max_width, $max_height), @@ -62,20 +61,18 @@ class StorePrizeRequest extends FormRequest /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { return [ - 'label' => trans('validation.custom.label'), - 'picture' => trans('validation.custom.picture'), - 'picture_alt' => trans('validation.custom.picture_alt'), - 'picture_title' => trans('validation.custom.picture_title'), - 'arg_title' => trans('validation.attributes.title'), - 'arg_subtitle' => trans('validation.custom.subtitle'), - 'arg_content' => trans('validation.attributes.content'), - 'quantity' => trans('validation.custom.quantity'), + 'label' => trans('validation.custom.label'), + 'picture' => trans('validation.custom.picture'), + 'picture_alt' => trans('validation.custom.picture_alt'), + 'picture_title' => trans('validation.custom.picture_title'), + 'arg_title' => trans('validation.attributes.title'), + 'arg_subtitle' => trans('validation.custom.subtitle'), + 'arg_content' => trans('validation.attributes.content'), + 'quantity' => trans('validation.custom.quantity'), 'pdf_winning_proof' => trans('validation.custom.pdf_winning_proof'), ]; } diff --git a/app/Http/Requests/Bo/Prizes/UpdatePrizeRequest.php b/app/Http/Requests/Bo/Prizes/UpdatePrizeRequest.php index 689819b..0a98658 100644 --- a/app/Http/Requests/Bo/Prizes/UpdatePrizeRequest.php +++ b/app/Http/Requests/Bo/Prizes/UpdatePrizeRequest.php @@ -1,5 +1,7 @@ 'required|string|min:3|max:255', + 'name' => 'required|string|min:3|max:255', 'ean_code' => [ 'required', 'unique:products,ean_code', @@ -48,10 +48,11 @@ class StoreProductRequest extends FormRequest ], 'picture_alt' => 'nullable|required_with:picture|string|between:3,255', 'picture_title' => 'nullable|required_with:picture|string|between:3,255', - 'range_id' => 'exists:ranges,id' + 'range_id' => 'exists:ranges,id', ]; $width = config('theme.models.products.picture_max_width'); $height = config('theme.models.products.picture_max_height'); + return \array_merge( $rules, $this->pictureRules('picture', $width, $height, $width, $height, true), @@ -60,28 +61,26 @@ class StoreProductRequest extends FormRequest /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { return [ - 'name' => trans('validation.attributes.name'), + 'name' => trans('validation.attributes.name'), 'picture_title' => trans(':field1 :inter1:field2 :inter2:model', [ 'field1' => Str::ucfirst(trans('validation.custom.attribute_title')), 'inter1' => trans('validation.custom.of_the.vowel'), 'field2' => trans('validation.attributes.image'), 'inter2' => trans('validation.custom.of_the.male'), - 'model' => trans('models.classes.product'), + 'model' => trans('models.classes.product'), ]), 'picture_alt' => trans(':field1 :inter1:field2 :inter2:model', [ 'field1' => Str::ucfirst(trans('validation.custom.attribute_alt')), 'inter1' => trans('validation.custom.of_the.vowel'), 'field2' => trans('validation.attributes.image'), 'inter2' => trans('validation.custom.of_the.male'), - 'model' => trans('models.classes.product'), + 'model' => trans('models.classes.product'), ]), - 'picture' => trans('validation.attributes.image'), + 'picture' => trans('validation.attributes.image'), 'ean_code' => trans('validation.custom.ean_code'), 'range_id' => trans('models.classes.range'), ]; diff --git a/app/Http/Requests/Bo/Products/UpdateProductRequest.php b/app/Http/Requests/Bo/Products/UpdateProductRequest.php index 83c3662..9677ba4 100644 --- a/app/Http/Requests/Bo/Products/UpdateProductRequest.php +++ b/app/Http/Requests/Bo/Products/UpdateProductRequest.php @@ -1,7 +1,10 @@ route('product'); + return array_merge(parent::rules(), [ 'ean_code' => [ 'required', diff --git a/app/Http/Requests/Bo/Ranges/StoreRangeRequest.php b/app/Http/Requests/Bo/Ranges/StoreRangeRequest.php index 8814f2e..1f6040b 100644 --- a/app/Http/Requests/Bo/Ranges/StoreRangeRequest.php +++ b/app/Http/Requests/Bo/Ranges/StoreRangeRequest.php @@ -1,5 +1,7 @@ 'required|string|min:2|max:255', @@ -45,6 +45,7 @@ class StoreRangeRequest extends FormRequest ]; $width = config('theme.models.ranges.picture_max_width'); $height = config('theme.models.ranges.picture_max_height'); + return \array_merge( $rules, $this->pictureRules('picture', $width, $height, $width, $height, false), diff --git a/app/Http/Requests/Bo/Ranges/UpdateRangeRequest.php b/app/Http/Requests/Bo/Ranges/UpdateRangeRequest.php index 8ac56ed..cd70cb5 100644 --- a/app/Http/Requests/Bo/Ranges/UpdateRangeRequest.php +++ b/app/Http/Requests/Bo/Ranges/UpdateRangeRequest.php @@ -1,5 +1,7 @@ 'required|string|min:3|max:255', - 'company' => 'required|string|min:3|max:255', - 'start_date' => 'required|date', - 'end_date' => 'required|date', - 'nb_participation_player' => 'required|numeric|min:0', - 'nb_participation_ip' => 'required|numeric|min:0', - 'nb_unique_code_use' => 'required|numeric|min:0', - 'code_type' => ['required', new Enum(CodeType::class)], - 'activated_teaser' => 'required|boolean', - 'activated_close_page' => 'required|boolean', - 'close_page_active_date' => [ + 'name' => 'required|string|min:3|max:255', + 'company' => 'required|string|min:3|max:255', + 'start_date' => 'required|date', + 'end_date' => 'required|date', + 'nb_participation_player' => 'required|numeric|min:0', + 'nb_participation_ip' => 'required|numeric|min:0', + 'nb_unique_code_use' => 'required|numeric|min:0', + 'code_type' => ['required', new Enum(CodeType::class)], + 'activated_teaser' => 'required|boolean', + 'activated_close_page' => 'required|boolean', + 'close_page_active_date' => [ 'nullable', 'required_if:activated_close_page,true,1', 'date', - 'after_or_equal:end_date' + 'after_or_equal:end_date', ], - 'redirect_close' => 'required|url:http,https', - 'notify_prize_sent' => 'required|boolean', - 'discounts_activated' => 'required|boolean', - 'discounts_site' => 'nullable|required_if:discounts_activated,true,1|string|min:3|max:255', - 'discounts_campaign' => 'nullable|required_if:discounts_activated,true,1|string|min:3|max:255', + 'redirect_close' => 'required|url:http,https', + 'notify_prize_sent' => 'required|boolean', + 'discounts_activated' => 'required|boolean', + 'discounts_site' => 'nullable|required_if:discounts_activated,true,1|string|min:3|max:255', + 'discounts_campaign' => 'nullable|required_if:discounts_activated,true,1|string|min:3|max:255', 'web_coupons' => [ - 'present', 'array', function ($attribute, $value, $fail) { - if ($this->post('discounts_activated') and !collect($value)->filter()->count()) { + 'present', 'array', function ($attribute, $value, $fail): void { + if ($this->post('discounts_activated') && ! collect($value)->filter()->count()) { $fail(trans('validation.min.array', [ 'attribute' => Arr::get($this->attributes(), $attribute), - 'min' => 1 + 'min' => 1, ])); } if (collect($value)->sum('percentage') > 100) { $fail(trans('validation.max.numeric', [ 'attribute' => Arr::get($this->attributes(), $attribute), - 'max' => 100 + 'max' => 100, ])); } - } + }, ], 'web_coupons.*' => 'array', 'web_coupons.*.web_coupon_identifiant' => 'required|digits:13', @@ -103,7 +99,7 @@ class UpdateSettingsRequest extends FormRequest 'web_coupons.*.face_value' => 'required|numeric|min:10|max:300', 'web_coupons.*.valid_on' => 'required|string|min:3|max:255', 'web_coupons.*.picture' => [ - 'required', function (string $attribute, $value, callable $fail) { + 'required', function (string $attribute, ?string $value, callable $fail): void { ToolboxHelper::validatePicture( $attribute, $value, @@ -112,17 +108,17 @@ class UpdateSettingsRequest extends FormRequest 'maxHeight' => 409, 'maxWith' => 920, 'minHeight' => 409, - 'minWith' => 920 + 'minWith' => 920, ] ); - } + }, ], 'notification_emails' => 'required|array|min:1', 'notification_emails.*' => 'email:rfc,spoof,dns', 'authorized_countries' => 'sometimes|array|max:' . count(Country::getValidCountries()), 'authorized_countries.*' => [ 'sometimes', - Rule::in(Country::getValidCountries()) + Rule::in(Country::getValidCountries()), ], 'winning_proof' => 'required|boolean', @@ -131,8 +127,6 @@ class UpdateSettingsRequest extends FormRequest /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Bo/StaticPages/UpdateStaticPageRequest.php b/app/Http/Requests/Bo/StaticPages/UpdateStaticPageRequest.php index b4624d7..744f6e2 100644 --- a/app/Http/Requests/Bo/StaticPages/UpdateStaticPageRequest.php +++ b/app/Http/Requests/Bo/StaticPages/UpdateStaticPageRequest.php @@ -1,7 +1,10 @@ merge([ - 'content' => (string) Str::of($this->input('content')) + 'content' => (string) Str::of($this->input('content')), ]); } /** * Get the validation rules that apply to the request. * - * @return array|string> + * @return array|string> */ public function rules(): array { @@ -47,8 +48,6 @@ class UpdateStaticPageRequest extends FormRequest /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Bo/UpdateChangeOrderRequest.php b/app/Http/Requests/Bo/UpdateChangeOrderRequest.php index d6be727..3963bd1 100644 --- a/app/Http/Requests/Bo/UpdateChangeOrderRequest.php +++ b/app/Http/Requests/Bo/UpdateChangeOrderRequest.php @@ -1,5 +1,7 @@ merge([ - 'direction' => $this->route('direction') === 'up' ? true : false + 'direction' => $this->route('direction') === 'up', ]); } /** * Get the validation rules that apply to the request. - * - * @return array */ public function rules(): array { diff --git a/app/Http/Requests/Bo/Users/StoreUserRequest.php b/app/Http/Requests/Bo/Users/StoreUserRequest.php index bf9ed2e..1f71c40 100644 --- a/app/Http/Requests/Bo/Users/StoreUserRequest.php +++ b/app/Http/Requests/Bo/Users/StoreUserRequest.php @@ -1,5 +1,7 @@ merge([ - 'published' => $this->boolean('published') + 'published' => $this->boolean('published'), ]); } /** * Get the validation rules that apply to the request. - * - * @return array */ public function rules(): array { return [ 'first_name' => 'required|string|min:3|max:255', - 'last_name' => 'required|string|min:3|max:255', - 'email' => 'required|email:rfc,strict,dns,spoof,filter|unique:users,email', - 'password' => [ + 'last_name' => 'required|string|min:3|max:255', + 'email' => 'required|email:rfc,strict,dns,spoof,filter|unique:users,email', + 'password' => [ 'required', 'required_with:password_confirmation', 'confirmed', 'max:255', Password::min(8) ->letters() ->mixedCase() ->numbers() ->symbols() - ->uncompromised() + ->uncompromised(), ], - 'role' => ['required', new Enum(RoleEnum::class)], + 'role' => ['required', new Enum(RoleEnum::class)], 'published' => 'required|boolean', ]; } /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { return [ 'first_name' => trans('validation.attributes.first_name'), - 'last_name' => trans('validation.attributes.last_name'), - 'email' => trans('validation.attributes.email'), - 'password' => trans('validation.attributes.password'), - 'role' => trans('validation.attributes.role'), - 'published' => trans('validation.custom.publication') + 'last_name' => trans('validation.attributes.last_name'), + 'email' => trans('validation.attributes.email'), + 'password' => trans('validation.attributes.password'), + 'role' => trans('validation.attributes.role'), + 'published' => trans('validation.custom.publication'), ]; } } diff --git a/app/Http/Requests/Bo/Users/UpdateUserRequest.php b/app/Http/Requests/Bo/Users/UpdateUserRequest.php index f2468d8..17810ce 100644 --- a/app/Http/Requests/Bo/Users/UpdateUserRequest.php +++ b/app/Http/Requests/Bo/Users/UpdateUserRequest.php @@ -1,7 +1,10 @@ route('user'); $this->merge([ 'published' => $this->boolean('published'), - 'password' => $this->input( + 'password' => $this->input( 'password', ) ?? $userModel->password, 'password_confirmation' => $this->input( 'password_confirmation' - ) ?? $userModel->password + ) ?? $userModel->password, ]); } /** * Get the validation rules that apply to the request. - * - * @return array */ public function rules(): array { - /** @var \App\Models\User */ + /** @var User */ $userModel = $this->route('user'); + return array_merge(parent::rules(), [ 'email' => [ 'required', 'email:rfc,strict,dns,spoof,filter', - Rule::unique('users', 'email')->ignore($userModel->getRouteKey()) + Rule::unique('users', 'email')->ignore($userModel->getRouteKey()), ], 'password' => [ 'required', 'required_with:password_confirmation', 'confirmed', 'max:255', Password::min(8) @@ -59,7 +61,7 @@ class UpdateUserRequest extends StoreUserRequest ->mixedCase() ->numbers() ->symbols() - ->uncompromised() + ->uncompromised(), ], ]); } diff --git a/app/Http/Requests/Fo/Customers/CreateAccountRequest.php b/app/Http/Requests/Fo/Customers/CreateAccountRequest.php index ef80de9..a91575a 100644 --- a/app/Http/Requests/Fo/Customers/CreateAccountRequest.php +++ b/app/Http/Requests/Fo/Customers/CreateAccountRequest.php @@ -1,10 +1,14 @@ merge([ 'phone' => $this->input('phone'), 'opt_in' => $this->boolean('opt_in'), - 'ok_cgv' => $this->boolean('ok_cgv') + 'ok_cgv' => $this->boolean('ok_cgv'), ]); } /** * Get the validation rules that apply to the request. - * - * @return array */ public function rules(): array { - /** @var \App\Models\Settings $settings */ - $settings = app(Settings::class); + /** @var Settings $settings */ + $settings = resolve(Settings::class); /** @var \App\Models\Customer|null */ $authUser = auth('frontend')->user(); - $countryCode = null; $countryCode = $this->integer('country') != 0 ? $this->integer('country') : ($authUser ? - (new CrmRepository())->fetchCrmCustomer($authUser)->country->value : 0); + new CrmRepository()->fetchCrmCustomer($authUser)->country->value : 0); $countryRules = match ($countryCode) { Country::belgium->value => [ 'phone' => 'phone:BE', @@ -105,13 +102,13 @@ class CreateAccountRequest extends FormRequest 'max:255', // * Does email already exists in CRM ? // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed - function (string $attribute, $value, \Closure $fail) { - if (CrmCustomer::findWithEmail(\strval($value))) { + function (string $attribute, $value, Closure $fail): void { + if (CrmCustomer::findWithEmail(\strval($value)) instanceof CrmCustomer) { $fail('Un compte existe déjà avec cette adresse.'); } else { // ! Si le compte n'existe pas en CRM mais existe en local. // ! On le soft-delete pour permettre l'inscription et la restauration propre. - $localCustomer = \App\Models\Customer::where('email', \strval($value))->first(); + $localCustomer = Customer::where('email', \strval($value))->first(); if ($localCustomer) { $localCustomer->delete(); } @@ -123,7 +120,7 @@ class CreateAccountRequest extends FormRequest 'required', 'confirmed', Password::min(8)->mixedCase() - ->numbers()->symbols()->uncompromised() + ->numbers()->symbols()->uncompromised(), ], 'ok_cgv' => 'accepted', 'opt_in' => 'required|boolean', @@ -132,8 +129,6 @@ class CreateAccountRequest extends FormRequest /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { @@ -157,30 +152,28 @@ class CreateAccountRequest extends FormRequest /** * Get custom messages for validator errors. - * - * @return array */ public function messages(): array { $messages = [ 'postal_code' => trans('validation.postal_code', [ 'countries' => \implode(', ', Country::getValidCountriesLabel()), - 'examples' => 72000 + 'examples' => 72000, ]), 'phone.phone' => trans('validation.phone', [ - 'countries' => \implode(', ', Country::getValidCountriesLabel()) + 'countries' => \implode(', ', Country::getValidCountriesLabel()), ]), 'email.unique' => trans('Un compte existe déjà avec cette adresse.'), - 'ok_cgv.accepted' => trans('Vous devez accepter les conditions d\'utilisation du site pour continuer.') - ]; + 'ok_cgv.accepted' => trans('Vous devez accepter les conditions d\'utilisation du site pour continuer.'), + ]; // end match - $messages = match ($this->integer('country')) { + return match ($this->integer('country')) { Country::belgium->value => array_merge( $messages, [ 'postal_code' => trans('validation.postal_code', [ 'countries' => Country::belgium->label(), - 'examples' => 1000 + 'examples' => 1000, ]), ] ), @@ -189,7 +182,7 @@ class CreateAccountRequest extends FormRequest [ 'postal_code' => trans('validation.postal_code', [ 'countries' => Country::luxembourg->label(), - 'examples' => 1111 + 'examples' => 1111, ]), ] ), @@ -198,7 +191,7 @@ class CreateAccountRequest extends FormRequest [ 'postal_code' => trans('validation.postal_code', [ 'countries' => Country::germany->label(), - 'examples' => 10115 + 'examples' => 10115, ]), ] ), @@ -214,12 +207,10 @@ class CreateAccountRequest extends FormRequest array_search(Country::germany->label(), Country::getValidCountriesLabel()), ] )), - 'examples' => 72000 + 'examples' => 72000, ]), ] ), - }; //end match - - return $messages; + }; } } diff --git a/app/Http/Requests/Fo/Customers/SingleOptinRequest.php b/app/Http/Requests/Fo/Customers/SingleOptinRequest.php index 321d90a..1960941 100644 --- a/app/Http/Requests/Fo/Customers/SingleOptinRequest.php +++ b/app/Http/Requests/Fo/Customers/SingleOptinRequest.php @@ -1,5 +1,7 @@ 'required|email:rfc,dns,spoof', diff --git a/app/Http/Requests/Fo/Customers/VerifyInformationsRequest.php b/app/Http/Requests/Fo/Customers/VerifyInformationsRequest.php index 73680f5..bd2291c 100644 --- a/app/Http/Requests/Fo/Customers/VerifyInformationsRequest.php +++ b/app/Http/Requests/Fo/Customers/VerifyInformationsRequest.php @@ -1,15 +1,16 @@ |string> + * @return array|string> */ public function rules(): array { diff --git a/app/Http/Requests/Fo/ParticipateRequest.php b/app/Http/Requests/Fo/ParticipateRequest.php index fdd3ec9..aea7775 100644 --- a/app/Http/Requests/Fo/ParticipateRequest.php +++ b/app/Http/Requests/Fo/ParticipateRequest.php @@ -1,9 +1,12 @@ user(); // * Use rate limiter to prevent brute force sticker code if (RateLimiter::tooManyAttempts("participate:{$customer->id}", $perMinute = 5)) { return false; } RateLimiter::hit("participate:{$customer->id}"); + return Gate::check('participate', Participation::class); } /** * Prepare the data for validation. - * - * @return void */ protected function prepareForValidation(): void { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); if ($settings->code_type->equals(CodeType::unique) || $settings->code_type->equals(CodeType::both)) { try { $this->merge([ @@ -83,18 +83,16 @@ class ParticipateRequest extends FormRequest ->first(), 'game_rules' => $this->boolean('game_rules'), ]); - } //end if + } // end if } /** * Get the validation rules that apply to the request. - * - * @return array */ public function rules(): array { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); $rules = [ 'game_rules' => 'required|boolean|accepted', @@ -105,17 +103,18 @@ class ParticipateRequest extends FormRequest $rules = \array_merge($rules, ['unique_code' => [ 'required', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed - function (string $attribute, $value, callable $fail) { + function (string $attribute, $value, callable $fail): void { // ? Le Code unique est resolved ? - if ($value === false or !\is_object($value) or \get_class($value) !== Code::class) { + if ($value === false || ! \is_object($value) || $value::class !== Code::class) { $fail(trans('front.messages.unique_code_invalid')); + return; } - /** @var \App\Models\Customer */ + /** @var Customer */ $customer = auth('frontend')->user(); - /** @var \App\Models\Code $value */ + /** @var Code $value */ // * Check si l'utilisateur n'a pas déjà utilisé ce code. $query = Participation::query() ->whereHas('code', fn (Builder $q) => $q->where('id', $value->id)) @@ -123,6 +122,7 @@ class ParticipateRequest extends FormRequest // ! Une seule participation avec un code donné par joueur if ($query->exists()) { $fail(trans('front.messages.unique_code_already_used')); + return; } @@ -131,37 +131,36 @@ class ParticipateRequest extends FormRequest if ($value->has_been_used_too_many_times) { // * Ne pas laisser d'indices, message générique $fail(trans('front.messages.unique_code_invalid')); + return; } - } + }, ]]); - } //end if + } // end if // ? Does the game use EAN Codes ? if ($settings->code_type->equals(CodeType::ean) || $settings->code_type->equals(CodeType::both)) { - $rules = \array_merge($rules, ['ean_code' => [ + return \array_merge($rules, ['ean_code' => [ 'required', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed - function ($attribute, $value, $fail) { + function ($attribute, $value, $fail): void { // phpcs:enable /** @var \App\Models\Produt|mixed */ $product = $this->input('product'); if ( - empty($product) or !is_object($product) or - !($product instanceof Model) or !$product->exists + empty($product) || ! is_object($product) || ! ($product instanceof Model) || ! $product->exists ) { $fail(trans('front.messages.barcode_invalid')); } - } + }, ]]); } + return $rules; } /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { diff --git a/app/Http/Requests/Fo/SubmitWinningProofRequest.php b/app/Http/Requests/Fo/SubmitWinningProofRequest.php index adf7d7a..96c6760 100644 --- a/app/Http/Requests/Fo/SubmitWinningProofRequest.php +++ b/app/Http/Requests/Fo/SubmitWinningProofRequest.php @@ -1,9 +1,12 @@ check() && - Gate::check('submitProof', $this->route('participation')); + return auth('frontend')->check() && Gate::check('submitProof', $this->route('participation')); } /** * Get the validation rules that apply to the request. * - * @return array|string> + * @return array|string> */ public function rules(): array { - $authUser = auth('frontend')->user(); + $authUser = auth('frontend')->user(); $countryCode = $this->integer('country') != 0 ? $this->integer('country') : ($authUser ? - (new CrmRepository())->fetchCrmCustomer($authUser)->country->value : 0); + new CrmRepository()->fetchCrmCustomer($authUser)->country->value : 0); $countryRules = match ($countryCode) { Country::belgium->value => ['phone' => 'phone:BE'], Country::luxembourg->value => ['phone' => 'phone:LU'], @@ -75,14 +75,12 @@ class SubmitWinningProofRequest extends CreateAccountRequest return collect(['sticker', 'ticket', 'barcode']) ->filter(fn (string $proof) => config("proofs.$proof")) - ->mapWithKeys(fn (string $proof) => [$proof => $fileRules]) + ->mapWithKeys(fn (string $proof): array => [$proof => $fileRules]) ->all(); } /** * Get custom attributes for validator errors. - * - * @return array */ public function attributes(): array { @@ -90,7 +88,7 @@ class SubmitWinningProofRequest extends CreateAccountRequest parent::attributes(), [ 'sticker' => trans('validation.custom.sticker'), - 'ticket' => trans('validation.custom.ticket'), + 'ticket' => trans('validation.custom.ticket'), 'barcode' => trans('validation.custom.barcode'), ] ); diff --git a/app/Jobs/DeleteOlds/DeleteOldCustomers.php b/app/Jobs/DeleteOlds/DeleteOldCustomers.php index 8be5666..22e4c10 100644 --- a/app/Jobs/DeleteOlds/DeleteOldCustomers.php +++ b/app/Jobs/DeleteOlds/DeleteOldCustomers.php @@ -1,5 +1,7 @@ withTrashed()->where('last_connection', '<=', now()->subMonths(36))->forceDelete(); } } diff --git a/app/Jobs/ProcessExportCodesUniques.php b/app/Jobs/ProcessExportCodesUniques.php index 2d55af2..c2add2b 100644 --- a/app/Jobs/ProcessExportCodesUniques.php +++ b/app/Jobs/ProcessExportCodesUniques.php @@ -1,33 +1,32 @@ exportFileName = sprintf( 'CodesUniques_%s', date('dmY_His') @@ -76,8 +72,8 @@ class ProcessExportCodesUniques implements ShouldQueue, ShouldBeUnique $filesPath = $this->generateCsvFiles($lastExportedCodeId); // * Compression des fichiers. - $zip = new \ZipArchive(); - if ($zip->open($exportFilePath, \ZipArchive::CREATE) === true) { + $zip = new ZipArchive(); + if ($zip->open($exportFilePath, ZipArchive::CREATE) === true) { foreach ($filesPath as $filePath) { if (File::exists($filePath)) { $zip->addFile($filePath, \pathinfo($filePath, \PATHINFO_BASENAME)); @@ -100,21 +96,22 @@ class ProcessExportCodesUniques implements ShouldQueue, ShouldBeUnique $this->nbCodeLigne, $exportFilePath )); - } catch (\Exception $e) { + } catch (Exception $e) { // * Clear exported file in case of Failure. if (File::exists($exportFilePath)) { File::delete($exportFilePath); } throw $e; - } //end try + } // end try }); } /** * Generate CSV File using the job parameters * - * @param integer|null $lastExportedCodeId + * @param int|null $lastExportedCodeId * @return array Array of temp files + * * @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh */ private function generateCsvFiles($lastExportedCodeId = null): array @@ -152,7 +149,7 @@ class ProcessExportCodesUniques implements ShouldQueue, ShouldBeUnique } else { File::append($tempFilePath, Code::intToSerial($code) . ';'); $currentLineCodes++; - } //end if + } // end if $totalExportedCodes++; $currentExportedCodes++; @@ -175,29 +172,26 @@ class ProcessExportCodesUniques implements ShouldQueue, ShouldBeUnique Code::query()->whereIn('id', $exportedCodesId)->update(['code_exported' => true]); $exportedCodesId = []; } - } //end if - } //end foreach + } // end if + } // end foreach // ? Are there exported codes to save ? if (count($exportedCodesId)) { Code::query()->whereIn('id', $exportedCodesId)->update(['code_exported' => true]); } + return $outPaths; } - /** * In case of job failure - * - * @param \Throwable $exception - * @return void */ - public function failed(\Throwable $exception) + public function failed(Throwable $exception): void { Mail::to(config('mail.admin'))->send( - new JobFailed(__CLASS__, [ + new JobFailed(self::class, [ 'message' => $exception->getMessage(), - 'trace' => $exception->getTraceAsString() + 'trace' => $exception->getTraceAsString(), ]) ); } diff --git a/app/Jobs/ProcessUniqueCode.php b/app/Jobs/ProcessUniqueCode.php index 3997776..6d81ad6 100644 --- a/app/Jobs/ProcessUniqueCode.php +++ b/app/Jobs/ProcessUniqueCode.php @@ -1,43 +1,39 @@ max('id') ?? 0) + 1; - /** @var \App\Models\Settings $settings */ - $settings = app(Settings::class); + /** @var Settings $settings */ + $settings = resolve(Settings::class); $maxSQLPlaceholders = 65535; $insertColumns = collect(DB::getSchemaBuilder() - ->getColumnListing((new Code())->getTable())) - ->filter(function ($name) { - // * Ignorer les colonnes avec valeurs par défaut sur la table. - return !in_array($name, ['id', 'code_exported']); - })->count() + 1; + ->getColumnListing(new Code()->getTable())) + ->reject(fn ($name): bool => in_array($name, ['id', 'code_exported']))->count() + 1; /** * Nombre d'insertions max sur un seule requète - * - * @var integer $perPage */ $perPage = \floor($maxSQLPlaceholders / $insertColumns); /** * Nombre de page totale à insérer. - * - * @var integer $totalPages */ $totalPages = \ceil($this->amount / $perPage); @@ -87,7 +74,7 @@ class ProcessUniqueCode implements ShouldQueue, ShouldBeUnique $insertToGenerate = min($perPage, $this->amount - $totalGeneratedInserts); do { $inserts[] = [ - 'id' => $last_id++, + 'id' => $last_id++, 'date_creation' => now()->format('Y-m-d'), ]; } while (($totalGeneratedInserts < $this->amount) && --$insertToGenerate); @@ -108,16 +95,13 @@ class ProcessUniqueCode implements ShouldQueue, ShouldBeUnique /** * In case of job failure - * - * @param \Throwable $exception - * @return void */ - public function failed(\Throwable $exception) + public function failed(Throwable $exception): void { Mail::to(config('mail.admin'))->send( - new JobFailed(__CLASS__, [ + new JobFailed(self::class, [ 'message' => $exception->getMessage(), - 'trace' => $exception->getTraceAsString() + 'trace' => $exception->getTraceAsString(), ]) ); } @@ -130,8 +114,8 @@ class ProcessUniqueCode implements ShouldQueue, ShouldBeUnique public function middleware(): array { return [ - (new WithoutOverlapping('code_generation')) - ->releaseAfter(60) + new WithoutOverlapping('code_generation') + ->releaseAfter(60), ]; } } diff --git a/app/Lib/Discount.php b/app/Lib/Discount.php index 45e0fc9..d7df422 100644 --- a/app/Lib/Discount.php +++ b/app/Lib/Discount.php @@ -1,24 +1,30 @@ {$name}; } - throw new \TypeError("undefined property {$name}"); + throw new TypeError("undefined property {$name}"); } /** * Make and instance * - * @param string $picture Image locale du Coupon. - * @param string $valid_on Text valable sur.. (duplicat de ce qui est inscrit dans MesBr) - * Pour affichage sur la page de gain est dans le mail. - * @param integer $face_value Valeur faciale en centimes. - * @param integer $percentage Pourcentage de chance de gagner le lot nombre de 1 à 100. - * @param integer $web_coupon_identifiant EAN 13 format (Mais ne représente pas un EAN 13), - * format utilisé dans MesBr. + * @param string $picture Image locale du Coupon. + * @param string $valid_on Text valable sur.. (duplicat de ce qui est inscrit dans MesBr) + * Pour affichage sur la page de gain est dans le mail. + * @param int $face_value Valeur faciale en centimes. + * @param int $percentage Pourcentage de chance de gagner le lot nombre de 1 à 100. + * @param int $web_coupon_identifiant EAN 13 format (Mais ne représente pas un EAN 13), + * format utilisé dans MesBr. * - * @return \App\Lib\Discount - * @throws \RuntimeException If $type or $data is wrong. + * @throws RuntimeException If $type or $data is wrong. */ public static function make( string $picture, @@ -78,54 +82,42 @@ class Discount extends \stdClass implements Jsonable, Arrayable, \JsonSerializab $ipTypeData->valid_on = $valid_on; $ipTypeData->picture = $picture; self::assertIsInputTypeData($ipTypeData); + return $ipTypeData; } /** * Confirm $data is of type InputTypeData * - * @param \App\Lib\Discount $data - * @return void - * @throws \RuntimeException If $data is wrong. + * + * @throws RuntimeException If $data is wrong. */ - public static function assertIsInputTypeData(Discount $data) + public static function assertIsInputTypeData(Discount $data): void { - if (!\is_int($data->web_coupon_identifiant)) { - throw new \RuntimeException("InputTypeData 'web_coupon_identifiant' should be an integer"); - } - if (!\is_int($data->percentage)) { - throw new \RuntimeException("InputTypeData 'percentage' should be an integer"); - } - if (!\is_int($data->face_value)) { - throw new \RuntimeException("InputTypeData 'face_value' should be an integer"); - } - if (!\is_string($data->valid_on)) { - throw new \RuntimeException("InputTypeData 'valid_on' should be a string"); - } - if (!\is_string($data->picture)) { - throw new \RuntimeException("InputTypeData 'picture' should be a string"); - } + throw_unless(\is_int($data->web_coupon_identifiant), RuntimeException::class, "InputTypeData 'web_coupon_identifiant' should be an integer"); + throw_unless(\is_int($data->percentage), RuntimeException::class, "InputTypeData 'percentage' should be an integer"); + throw_unless(\is_int($data->face_value), RuntimeException::class, "InputTypeData 'face_value' should be an integer"); + throw_unless(\is_string($data->valid_on), RuntimeException::class, "InputTypeData 'valid_on' should be a string"); + throw_unless(\is_string($data->picture), RuntimeException::class, "InputTypeData 'picture' should be a string"); } // * TRANSFORMERS /** * Get the instance as an array. - * - * @return array */ public function toArray(): array { - return collect(Arr::mapWithKeys(self::$propertiesList, fn (string $property) => [ - $property => $this->{$property} + return collect(Arr::mapWithKeys(self::$propertiesList, fn (string $property): array => [ + $property => $this->{$property}, ]))->filter()->all(); } /** * Convert the object to its JSON representation. * - * @param integer $options - * @return string + * @param int $options + * * @phpcs:disable Squiz.Commenting.FunctionComment.ScalarTypeHintMissing */ public function toJson($options = 0): string @@ -139,7 +131,7 @@ class Discount extends \stdClass implements Jsonable, Arrayable, \JsonSerializab * * @return array */ - #[\ReturnTypeWillChange] + #[ReturnTypeWillChange] public function jsonSerialize() { return $this->toArray(); diff --git a/app/Lib/Helpers/CollectionHelper.php b/app/Lib/Helpers/CollectionHelper.php index b9e9ecd..3776d20 100644 --- a/app/Lib/Helpers/CollectionHelper.php +++ b/app/Lib/Helpers/CollectionHelper.php @@ -1,5 +1,7 @@ count(); return self::paginator($results->forPage($page, $pageSize), $total, $pageSize, $page, [ - 'path' => Paginator::resolveCurrentPath(), + 'path' => Paginator::resolveCurrentPath(), 'pageName' => 'page', ]); } @@ -44,21 +37,16 @@ class CollectionHelper /** * Create a new length-aware paginator instance. * - * @param \Illuminate\Support\Collection $items - * @param integer $total - * @param integer $perPage - * @param integer $currentPage - * @param array $options - * @return \Illuminate\Pagination\LengthAwarePaginator + * @return LengthAwarePaginator */ protected static function paginator(Collection $items, int $total, int $perPage, int $currentPage, array $options) { return Container::getInstance()->makeWith(LengthAwarePaginator::class, [ - 'items' => $items, - 'total' => $total, - 'perPage' => $perPage, + 'items' => $items, + 'total' => $total, + 'perPage' => $perPage, 'currentPage' => $currentPage, - 'options' => $options + 'options' => $options, ]); } } diff --git a/app/Lib/Helpers/ExceptionsHelper.php b/app/Lib/Helpers/ExceptionsHelper.php index 30deb54..0b8ea1f 100644 --- a/app/Lib/Helpers/ExceptionsHelper.php +++ b/app/Lib/Helpers/ExceptionsHelper.php @@ -1,55 +1,56 @@ setModules([]); $event->setOsContext(null); - /** @var \Sentry\ExceptionDataBag[] */ + /** @var ExceptionDataBag[] */ $exceptionBag = []; foreach ($event->getExceptions() as $exceptionDataBag) { $exceptionBag[] = self::getAnonymizedSentryException($exceptionDataBag); } $event->setExceptions($exceptionBag); + return $event; } /** * Anonimize Sentry Exception bag - * - * @param \Sentry\ExceptionDataBag $exceptionDataBag - * @return \Sentry\ExceptionDataBag */ private static function getAnonymizedSentryException( - \Sentry\ExceptionDataBag $exceptionDataBag - ): \Sentry\ExceptionDataBag { + ExceptionDataBag $exceptionDataBag + ): ExceptionDataBag { $exceptionDataBag->setValue(self::getAnonymizedMessage($exceptionDataBag->getValue())); - if ($stackTrace = $exceptionDataBag->getStacktrace()) { + if (($stackTrace = $exceptionDataBag->getStacktrace()) instanceof Stacktrace) { $exceptionDataBag->setStacktrace(self::getAnonymizedSentryStackTrace($stackTrace)); } + return $exceptionDataBag; } /** * Anonymise sentry stacktrace - * - * @param \Sentry\Stacktrace $stackTrace - * @return \Sentry\Stacktrace */ - private static function getAnonymizedSentryStackTrace(\Sentry\Stacktrace $stackTrace): \Sentry\Stacktrace + private static function getAnonymizedSentryStackTrace(Stacktrace $stackTrace): Stacktrace { - /** @var \Sentry\Frame[] */ + /** @var Frame[] */ $frames = \array_reverse($stackTrace->getFrames(), true); $i = \count($frames) - 1; // * Remove all but keep first (index.php). @@ -66,13 +67,14 @@ class ExceptionsHelper $stackTrace->removeFrame(count($stackTrace->getFrames()) - 1); } } + return $stackTrace; } /** * Get anonymized sentry params * - * @param mixed[] $params + * @param mixed[] $params * @return string[] */ private static function getAnonymizedSentryParams(array $params): array @@ -86,46 +88,44 @@ class ExceptionsHelper case $type === 'lambda': case $type === 'object': continue 2; - case $type === 'array' and \is_array($param): + case $type === 'array' && \is_array($param): $param = sprintf('Array(%d)', \count($param)); + continue 2; default: if (\is_numeric($param)) { $param = \ucfirst($type); + continue 2; } if (\is_string($param)) { $param = sprintf('String(%d)', \strlen($param)); + continue 2; } - } //end switch - } //end foreach + } // end switch + } // end foreach + return $params; } - /** * Anonymize at least Sql queries - * - * @param string $message - * @return string */ public static function getAnonymizedMessage(string $message): string { $message = \preg_replace('/^(.*)( \(SQL:.*\))$/', '$1', $message) ?? $message; if ($sqlPos = \strpos($message, 'to use near')) { - $message = \mb_strcut($message, 0, $sqlPos); + return \mb_strcut($message, 0, $sqlPos); } + return $message; } /** * Anonymize stack trace - * - * @param \Throwable $e - * @return string */ - public static function getAnonymizedStackTrace(\Throwable $e): string + public static function getAnonymizedStackTrace(Throwable $e): string { $projectPath = \realpath(\sprintf('%s/../', \app_path())); $traceStack = $e->getTrace(); @@ -152,17 +152,15 @@ class ExceptionsHelper } $traceStr .= ")\n"; } - } //end foreach + } // end foreach $maxStackStage++; $traceStr .= "#$maxStackStage {main}"; + return $traceStr; } /** * Handle Args - * - * @param array $stack - * @return string */ public static function handleArgs(array $stack): string { @@ -170,21 +168,15 @@ 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; } } diff --git a/app/Lib/Helpers/FileStorageHelper.php b/app/Lib/Helpers/FileStorageHelper.php index 47bd49c..7aa60f7 100644 --- a/app/Lib/Helpers/FileStorageHelper.php +++ b/app/Lib/Helpers/FileStorageHelper.php @@ -1,11 +1,17 @@ path($path); } /** * Destroy the file associate with the attribute. - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string $attribute - * @return void */ public static function removeFile(Model $model, string $attribute): void { $path = \ltrim(\urldecode($model->{$attribute}), '/'); - if (\strpos($path, 'storage') !== 0) { + if (! str_starts_with($path, 'storage')) { return; } $path = ToolboxHelper::mbReplace('storage/', '', $path); @@ -65,20 +68,15 @@ class FileStorageHelper /** * Destroy the file associate with the attribute old value (before updated to DB). - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string $attribute - * @param boolean $onlyIfUpdated - * @return void */ public static function removeOldFile(Model $model, string $attribute, bool $onlyIfUpdated = true): void { // * Ignore If removal has to be done only if the field has changed and it actually hasnt. - if ($onlyIfUpdated and $model->{$attribute} === ToolboxHelper::getOriginal($model, $attribute)) { + if ($onlyIfUpdated && $model->{$attribute} === ToolboxHelper::getOriginal($model, $attribute)) { return; } $originalPath = \ltrim(\urldecode(ToolboxHelper::getOriginal($model, $attribute)), '/'); - if (\strpos($originalPath, 'storage') !== 0) { + if (! str_starts_with($originalPath, 'storage')) { return; } $originalPath = ToolboxHelper::mbReplace('storage/', '', $originalPath); @@ -92,37 +90,39 @@ class FileStorageHelper * * You can use filename param to overload file name. * - * @param \Illuminate\Database\Eloquent\Model $model The model that will hold the picture. - * @param \Illuminate\Http\UploadedFile|\SplFileInfo|string $file The file, will just return itself is string. - * @param boolean $slugify Force filename slugification. - * @param string|null $filename This string may be used to store the file. - * @param boolean $private To store the file in a private space. - * @return string - * @throws \RuntimeException If file copy fails. + * @param Model $model The model that will hold the picture. + * @param UploadedFile|SplFileInfo|string $file The file, will just return itself is string. + * @param bool $slugify Force filename slugification. + * @param string|null $filename This string may be used to store the file. + * @param bool $private To store the file in a private space. + * + * @throws RuntimeException If file copy fails. + * * @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh */ public static function storeFile( Model $model, $file, bool $slugify = false, - string $filename = null, + ?string $filename = null, bool $private = false ): string { // phpcs:enable $tableName = $model->getTable(); - if (\is_object($file) and $file instanceof \Illuminate\Http\UploadedFile) { - /** @var \Illuminate\Http\UploadedFile $file */ + if ($file instanceof UploadedFile) { + /** @var UploadedFile $file */ $filename = $filename ?: $file->getClientOriginalName(); $filename = $slugify ? self::slugifyFileName($filename) : $filename; $newPath = self::prepareMoveFile($tableName, $filename, $private); $newPath = str_replace(storage_path('app'), '', $newPath); - if (!$private) { + if (! $private) { // * Store public file. $file->storePubliclyAs( pathinfo($newPath, \PATHINFO_DIRNAME), pathinfo($newPath, \PATHINFO_BASENAME) ); + return 'storage' . str_replace('/public', '', $newPath); } @@ -132,23 +132,25 @@ class FileStorageHelper ); return str_replace('/private/', '', $newPath); - } //end if - if (\is_object($file) and $file instanceof \SplFileInfo) { - /** @var \SplFileInfo $file */ + } // end if + if ($file instanceof SplFileInfo) { + /** @var SplFileInfo $file */ $filename = $filename ?: $file->getBaseName(); $filename = $slugify ? self::slugifyFileName($filename) : $filename; $newPath = self::prepareMoveFile($tableName, $filename, $private); - if (!File::copy($file->getRealPath(), $newPath)) { - throw new \RuntimeException(sprintf( + if (! File::copy($file->getRealPath(), $newPath)) { + throw new RuntimeException(sprintf( 'Failed to copy file %s to %s', $file->getRealPath(), $newPath )); } + return $private ? \ltrim(str_replace(\storage_path('app/private'), '/storage/app/private', $newPath), '/') : \ltrim(str_replace(\storage_path('app/public'), '/storage', $newPath), '/'); } + return strval($file); } @@ -157,22 +159,22 @@ class FileStorageHelper * If oldHtmlString is passed, a diff is done with new and old files * to keep only files that are present in the new html string. * - * @param \Illuminate\Database\Eloquent\Model $model The model that will hold the picture. - * @param string $htmlString The html string to parse and modify files. - * @param string|null $oldHtmlString The old html string with alreadyParsed - * files using storeModelFilesFromHtml. + * @param Model $model The model that will hold the picture. + * @param string $htmlString The html string to parse and modify files. + * @param string|null $oldHtmlString The old html string with alreadyParsed + * files using storeModelFilesFromHtml. * @return string Html with files pathes replaced using storage strategy. */ public static function storeModelFilesFromHtml( Model $model, string $htmlString, - string $oldHtmlString = null + ?string $oldHtmlString = null ): string { \collect(self::onlyUploadedFilesWithFileManager(self::findFilesInHtml($htmlString))) - ->each(function (string $path) use ($model, &$htmlString) { - /** @var \Illuminate\Filesystem\FilesystemAdapter */ + ->each(function (string $path) use ($model, &$htmlString): void { + /** @var FilesystemAdapter */ $disk = Storage::disk('uploads'); - $fileInfo = new \SplFileInfo($disk->path( + $fileInfo = new SplFileInfo($disk->path( ToolboxHelper::mbReplace('/uploads/', '', \urldecode($path)) )); $htmlString = ToolboxHelper::mbReplace( @@ -193,9 +195,8 @@ class FileStorageHelper * Remove all old files from string attribute html that are stored in public that * are nove present anymore on new html string * - * @param string $newHtmlString The html string with alreadyParsed files using storeModelFilesFromHtml. - * @param string $oldHtmlString The old html string with alreadyParsed files using storeModelFilesFromHtml. - * @return void + * @param string $newHtmlString The html string with alreadyParsed files using storeModelFilesFromHtml. + * @param string $oldHtmlString The old html string with alreadyParsed files using storeModelFilesFromHtml. */ public static function removeOldModelFilesFromHtml(string $newHtmlString, string $oldHtmlString): void { @@ -206,16 +207,15 @@ class FileStorageHelper * Remove all old files that are stored in public that * are not present anymore on new array files * - * @param string[] $oldFiles The old array files. - * @param string[] $newFiles The new array files. - * @return void + * @param string[] $oldFiles The old array files. + * @param string[] $newFiles The new array files. */ public static function removeOldFiles(array $oldFiles, array $newFiles): void { $oldFiles = \collect(self::onlyUploadedFilesWithFileStorageHelper($oldFiles)); $filesToKeep = \collect(self::onlyUploadedFilesWithFileStorageHelper($newFiles)); $filesToRemove = $oldFiles->diff($filesToKeep); - $filesToRemove->each(function (string $publicStorageFilePath) { + $filesToRemove->each(function (string $publicStorageFilePath): void { $path = ToolboxHelper::mbReplace('storage/', '', \ltrim(\urldecode($publicStorageFilePath), '/')); if (Storage::disk('public')->exists($path)) { Storage::disk('public')->delete($path); @@ -226,13 +226,12 @@ class FileStorageHelper /** * Remove all files from string attribute html that are stored in public * - * @param string $htmlString The html string with alreadyParsed files using storeModelFilesFromHtml. - * @return void + * @param string $htmlString The html string with alreadyParsed files using storeModelFilesFromHtml. */ public static function removeModelFilesOfHtml(string $htmlString): void { $filesToRemove = \collect(self::onlyUploadedFilesWithFileStorageHelper(self::findFilesInHtml($htmlString))); - $filesToRemove->each(function (string $publicStorageFilePath) { + $filesToRemove->each(function (string $publicStorageFilePath): void { $path = ToolboxHelper::mbReplace('storage/', '', \ltrim(\urldecode($publicStorageFilePath), '/')); if (Storage::disk('public')->exists($path)) { Storage::disk('public')->delete($path); @@ -242,13 +241,11 @@ class FileStorageHelper /** * Find all occurence of files in html - * - * @param string $html - * @return array */ public static function findFilesInHtml(string $html): array { preg_match_all('/href="(?P.*)"|src="(?P.*)"|url="(?P.*)"/Um', $html, $m, PREG_SET_ORDER, 0); + return collect($m)->pluck('href')->filter() ->concat(collect($m)->pluck('url')->filter()) ->concat(collect($m)->pluck('src')->filter()) @@ -258,19 +255,18 @@ class FileStorageHelper /** * Filter array to get only uploaded files that exists * on disk 'public' (using helper storage strategy) - * - * @param array $urls - * @return array */ public static function onlyUploadedFilesWithFileStorageHelper(array $urls): array { return \collect($urls)->unique() // * Filter to get only /uploads and using app url or empty - ->filter(function (string $url) { + ->filter(function (string $url): bool { $path = \parse_url($url, \PHP_URL_PATH); - return \strpos(\ltrim($path, '/'), 'storage/modelfiles') === 0; + + return str_starts_with(\ltrim($path, '/'), 'storage/modelfiles'); })->filter(function (string $url) { $path = \parse_url($url, \PHP_URL_PATH); + return Storage::disk('public') ->exists(ToolboxHelper::mbReplace('storage/', '', \ltrim(\urldecode($path), '/'))); })->all(); @@ -279,21 +275,19 @@ class FileStorageHelper /** * Filter array to get only uploaded files that exists * on disk 'uploads' - * - * @param array $urls - * @return array */ private static function onlyUploadedFilesWithFileManager(array $urls): array { return \collect($urls)->unique() // * Filter to get only /uploads and using app url or empty - ->filter(function (string $url) { + ->filter(function (string $url): bool { $host = \parse_url($url, \PHP_URL_HOST); $path = \parse_url($url, \PHP_URL_PATH); - return ($host === \parse_url(config('app.url'), PHP_URL_HOST) or \is_null($host)) and - \strpos(\ltrim($path, '/'), 'uploads') === 0; + + return ($host === \parse_url(config('app.url'), PHP_URL_HOST) || \is_null($host)) && str_starts_with(\ltrim($path, '/'), 'uploads'); })->filter(function (string $url) { $path = \parse_url($url, \PHP_URL_PATH); + return Storage::disk('uploads') ->exists(ToolboxHelper::mbReplace('uploads/', '', \ltrim(\urldecode($path), '/'))); })->all(); @@ -303,10 +297,9 @@ class FileStorageHelper * Prepare storage path and return * the file full path * - * @param string $tableName Model table name. - * @param string $filename The basename for the file. - * @param boolean $private May the file be stored in a private dir. - * @return string + * @param string $tableName Model table name. + * @param string $filename The basename for the file. + * @param bool $private May the file be stored in a private dir. */ private static function prepareMoveFile(string $tableName, string $filename, bool $private = false): string { @@ -325,6 +318,7 @@ class FileStorageHelper $filename, ); $filename = self::getFileUniqueName($folderPath, $filename); + return "{$folderPath}/{$filename}"; } @@ -332,11 +326,6 @@ class FileStorageHelper * Create sub folders to store files using pattern * storage/modelfiles/posts/10/04/19/5f * year/month/day/md5 first 2 letters - * - * @param string $storage_dir - * @param string $table - * @param string $filename - * @return string */ private static function getStoragePath(string $storage_dir, string $table, string $filename): string { @@ -350,40 +339,34 @@ class FileStorageHelper gmdate('d'), substr($filenameHash, 0, 2) )); - if (!File::exists($pathFolder)) { + if (! File::exists($pathFolder)) { File::makeDirectory($pathFolder, 0755, true); } + return $pathFolder; } /** * Get unique filename if the path is already occupied * - * @param string $folderPath - * @param string $filename - * @return string - * @throws \RuntimeException If a unique filename cannot be obtained. + * @throws RuntimeException If a unique filename cannot be obtained. */ private static function getFileUniqueName(string $folderPath, string $filename): string { $attempts = 0; $maxAttempts = 20; while (File::exists("{$folderPath}/{$filename}")) { - if ($attempts++ >= $maxAttempts) { - throw new \RuntimeException("Failed to have a unique filename for {$folderPath}/{$filename}"); - } + throw_if($attempts++ >= $maxAttempts, RuntimeException::class, "Failed to have a unique filename for {$folderPath}/{$filename}"); $filename = pathinfo($filename, \PATHINFO_FILENAME) . \uniqid('-') . '.' . pathinfo($filename, \PATHINFO_EXTENSION); } + return $filename; } /** * Slugify the filename - * - * @param string $filename - * @return string */ public static function slugifyFileName(string $filename): string { @@ -393,8 +376,8 @@ class FileStorageHelper /** * Sanitize File name for uploaded files * - * @param string $filename The original uploaded client file name. - * @param boolean $beautify Beautify the filename. + * @param string $filename The original uploaded client file name. + * @param bool $beautify Beautify the filename. * @return string The sanitized file name. */ public static function sanitizeFileName(string $filename, bool $beautify = true): string @@ -417,7 +400,7 @@ class FileStorageHelper $filename = Str::of($filename)->ltrim('.-'); // * Optional beautification if ($beautify) { - $filename = self::beautifyFilename($filename); + $filename = self::beautifyFilename($filename->value()); } // * Maximize filename length to 255 bytes http://serverfault.com/a/9548/44086 /** @var string */ @@ -426,20 +409,18 @@ class FileStorageHelper $filename = pathinfo($filename, \PATHINFO_FILENAME); $encoding = mb_detect_encoding($filename); - $encoding = $encoding ? $encoding : null; + $encoding = $encoding ?: null; + return \mb_strcut( $filename, 0, - 255 - (!empty($extension) ? strlen($extension) + 1 : 0), + 255 - (! empty($extension) ? strlen($extension) + 1 : 0), $encoding - ) . (!empty($extension) ? ".$extension" : ''); + ) . (! empty($extension) ? ".$extension" : ''); } /** * Beautify a filename - * - * @param string $filename - * @return string */ private static function beautifyFilename(string $filename): string { @@ -450,18 +431,19 @@ class FileStorageHelper // * "file___name.zip" becomes 'file-name.zip' '/_+/', // * "file---name.zip" becomes 'file-name.zip' - '/-+/' + '/-+/', ], '-', $filename); $filename = preg_replace([ // * "file--.--.-.--name.zip" becomes "file.name.zip" '/-*\.-*/', // * "file...name..zip" becomes "file.name.zip" - '/\.{2,}/' + '/\.{2,}/', ], '.', $filename); // Lowercase for windows/unix interoperability http://support.microsoft.com/kb/100625 . $filename = mb_strtolower($filename, mb_detect_encoding($filename)); // * ".file-name.-" becomes "file-name" $filename = trim($filename, '.-'); + return $filename; } } diff --git a/app/Lib/Helpers/ToolboxHelper.php b/app/Lib/Helpers/ToolboxHelper.php index 55fec50..3a4cd8d 100644 --- a/app/Lib/Helpers/ToolboxHelper.php +++ b/app/Lib/Helpers/ToolboxHelper.php @@ -1,75 +1,84 @@ run(); + $process = Process::command($command)->run(); if ($process->failed()) { $code = $process->exitCode(); $ouput = $process->errorOutput(); - if ($throw) { - throw new \RuntimeException("Failed to run command exit code {$code} with output \n{$ouput}"); - } + throw_if($throw, RuntimeException::class, "Failed to run command exit code {$code} with output \n{$ouput}"); + return false; } + return $process->output(); } /** - * Assert game is not oppened + * Assert game is not oppened. * - * @return void - * @throws \RuntimeException If game has started. + * @throws RuntimeException If game has started. */ public static function assertGameIsNotOppened(): void { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - if ($settings->game_is_open) { - throw new \RuntimeException('Cannot delete prize while game is oppened'); - } + /** @var Settings */ + $settings = resolve(Settings::class); + throw_if($settings->game_is_open, RuntimeException::class, 'Cannot delete prize while game is oppened'); } + /** - * @param array $array1 - * @param array $array2 - * + * @param array $array1 + * @param array $array2 * @return array */ public static function arrayMergeRecursiveDistinct(array &$array1, array &$array2): array @@ -87,89 +96,69 @@ class ToolboxHelper } /** - * Validate recaptcha - * - * @param \Illuminate\Http\Request $request - * @param boolean $isV3 - * @return void + * Validate recaptcha. */ - public static function validateRecaptcha(Request $request, bool $isV3 = true) + public static function validateRecaptcha(Request $request, bool $isV3 = true): void { Validator::validate($request->all(), [ 'g-recaptcha-response' => [ 'required', 'string', - // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed - function ($attribute, $value, $fail) use ($isV3) { + // @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed, Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed + function ($attribute, $value, $fail) use ($isV3): void { try { $response = Http::asForm()->post('https://www.google.com/recaptcha/api/siteverify', [ - 'secret' => config('services.google.recaptcha.private'), + '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') + || ! $response->json('challenge_ts') + || Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) + || $response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST) + || ! $response->json('score'), RuntimeException::class); if (\floatval($response->json('score')) < 0.8) { $fail(trans('recaptcha.not_enough_score')); } + 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') + || ! $response->json('challenge_ts') + || Date::parse($response->json('challenge_ts'))->lessThan(\now('utc')->subMinutes(5)) + || $response->json('hostname') !== \parse_url(config('app.url'), \PHP_URL_HOST), RuntimeException::class); + } catch (Exception) { $fail(trans('recaptcha.error')); - } //end try - } - ] + } // end try + }, + ], ], [], ['g-recaptcha-response' => 'reCaptcha']); } /** - * Strip scheme (https) on oembed urls + * Strip scheme (https) on oembed urls. * Only embed allowed are for MP4 self hosted videos right now * * https is force by ckeditor MediaElements which natively supports * only cloud hosted medias (youtube, spotify etc..) - * - * @param string $input - * @return string */ public static function stripCkEditorSchemesOnMediaInputs(string $input): string { - $input = \preg_replace('/(?<=)/m', '', $input); - return $input; + return \preg_replace('/(?<=)/m', '', $input); } /** - * Assert That no Back Office url is present on txt + * Assert That no Back Office url is present on txt. * - * @param string $field - * @param string $text - * @return string - * @throws \Illuminate\Validation\ValidationException If url is a bo url. + * @throws ValidationException If url is a bo url. */ public static function assertNoInternalBoUrls(string $field, string $text): string { $routes = Route::getRoutes(); // * Url replace and email replace. $text = preg_replace_callback( - // phpcs:ignore Generic.Files.LineLength.TooLong + // @phpcs:ignore Generic.Files.LineLength.TooLong '/(?P(?:http[s]?:\/\/.)?(?:www\.)?[-a-zA-Z0-9@%._\+~#=]{2,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*))/', function ($matches) use ($routes, $field) { $match = collect($matches)->first() ?? ''; @@ -178,34 +167,33 @@ class ToolboxHelper $request = Request::create($url); // If a route is match then it do not throws exception. if ( - \parse_url(config('app.url'), \PHP_URL_HOST) === \parse_url($url, \PHP_URL_HOST) && - trim($routes->match($request)->getPrefix() ?? '', '/') === 'bo' + \parse_url(config('app.url'), \PHP_URL_HOST) === \parse_url($url, \PHP_URL_HOST) + && trim($routes->match($request)->getPrefix() ?? '', '/') === 'bo' ) { // Removes the matched url. throw ValidationException::withMessages([ $field => trans( 'crud.libs.toolbox.assertNoInternalBoUrls', ['attribute' => $field] - ) + ), ]); } + return $match; - } catch (NotFoundHttpException $e) { + } catch (NotFoundHttpException) { return $match; } }, $text ); + return $text; } /** - * Assert That only external url is present on txt + * Assert That only external url is present on txt. * - * @param string $field - * @param string $text - * @return string - * @throws \Illuminate\Validation\ValidationException If url is a bo url. + * @throws ValidationException If url is a bo url. */ public static function assertNoInternalUrls(string $field, string $text): string { @@ -213,7 +201,7 @@ class ToolboxHelper $routes = Route::getRoutes(); // * Url replace and email replace. $text = preg_replace_callback( - // phpcs:ignore Generic.Files.LineLength.TooLong + // @phpcs:ignore Generic.Files.LineLength.TooLong '/(?P(?:http[s]?:\/\/.)?(?:www\.)?[-a-zA-Z0-9@%._\+~#=]{2,256}\.[a-z]{2,6}\b(?:[-a-zA-Z0-9@:%_\+.~#?&\/\/=]*))/', function ($matches) use ($routes, $field) { $match = collect($matches)->first() ?? ''; @@ -229,35 +217,31 @@ class ToolboxHelper $field => trans( 'crud.libs.toolbox.assertNoInternalUrls', ['attribute' => $field, 'appname' => config('app.name')] - ) + ), ]); } + return $match; - } catch (NotFoundHttpException $e) { + } catch (NotFoundHttpException) { return $match; } }, $text ); + return $text; } /** - * Mutltibyte string replace - * - * @param array|string $search - * @param array|string $replace - * @param array|string $subject - * @param integer $count - * @return array|string|false + * Mutltibyte string replace. */ public static function mbReplace( - array|string $search, - array|string $replace, - array|string $subject, + array | string $search, + array | string $replace, + array | string $subject, int &$count = 0 - ): array|string|false { - if (!is_array($search) && is_array($replace)) { + ): array | string | false { + if (! is_array($search) && is_array($replace)) { return false; } if (is_array($subject)) { @@ -266,7 +250,7 @@ class ToolboxHelper $string = &self::mbReplace($search, $replace, $string, $count); } } elseif (is_array($search)) { - if (!is_array($replace)) { + if (! is_array($replace)) { foreach ($search as &$string) { $subject = self::mbReplace($string, $replace, $subject, $count); } @@ -280,37 +264,37 @@ class ToolboxHelper } } else { $parts = mb_split(preg_quote($search), $subject); + // @phpstan-ignore-next-line $count = count($parts) - 1; $subject = implode($replace, $parts); - } //end if + } // end if + return $subject; } /** - * Asserts that the field is unique + * Asserts that the field is unique. * - * @param string $table - * @param string $field - * @param string|integer|float|boolean|null|array $value - * @param integer|null $id - * @param callable|null $query - * @return void - * @throws \Illuminate\Validation\ValidationException If the field is not unique. + * + * @throws ValidationException If the field is not unique. */ public static function assertFieldIsUnique( string $table, string $field, - string|int|float|bool|null|array $value, + string | int | float | bool | null | array $value, ?int $id = null, ?callable $query = null - ) { - if (!$query) { + ): void { + if (! $query) { Validator::make([$field => $value], [ self::mbReplace('.', '\.', $field) => Rule::unique($table, $field)->ignore($id), ], [ - self::mbReplace('.', '\.', "{$field}.unique") - => trans('crud.libs.toolbox.assertFieldIsUnique', ['attribute' => $field, 'value' => $value]) + self::mbReplace('.', '\.', "{$field}.unique") => trans('crud.libs.toolbox.assertFieldIsUnique', [ + 'attribute' => $field, + 'value' => $value, + ]), ])->validate(); + return; } Validator::make([$field => $value], [ @@ -319,16 +303,12 @@ class ToolboxHelper $field . '.unique' => trans( 'crud.libs.toolbox.assertFieldIsUnique', ['attribute' => $field, 'value' => $value] - ) + ), ])->validate(); } /** - * Get original polyfill with autotranslate behavior - * - * @param \Illuminate\Database\Eloquent\Model $model - * @param string $attribute - * @return mixed + * Get original polyfill with autotranslate behavior. */ public static function getOriginal(Model $model, string $attribute): mixed { @@ -342,17 +322,12 @@ class ToolboxHelper $model->useFallbackLocale() ); } + return $model->getOriginal($attribute); } /** - * Dynamic model query - * - * @param string $defaultLocale - * @param \Illuminate\Database\Eloquent\Builder $q - * @param string $column - * @param string $value - * @return \Illuminate\Database\Eloquent\Builder + * Dynamic model query. */ public static function queryColumnWithLocales( string $defaultLocale, @@ -362,17 +337,17 @@ class ToolboxHelper ): Builder { $currentLocale = app()->currentLocale(); $locales = collect(config('app.locales')) - ->mapWithKeys(fn (string $locale) => [$locale => $locale]); - if (!$locales->has($defaultLocale)) { + ->mapWithKeys(fn (string $locale): array => [$locale => $locale]); + if (! $locales->has($defaultLocale)) { // * Remove default locale. $locales->pull($defaultLocale); } - if (!$locales->has($currentLocale)) { + if (! $locales->has($currentLocale)) { // * Remove current locale. $locales->pull($currentLocale); } - return $q->where(function (Builder $q) use ($defaultLocale, $currentLocale, $locales, $column, $value) { + return $q->where(function (Builder $q) use ($defaultLocale, $currentLocale, $locales, $column, $value): void { // * Query default locale $q->whereRaw("JSON_EXTRACT({$column}, '$.{$defaultLocale}') = '{$value}'"); if ($defaultLocale !== $currentLocale) { @@ -387,12 +362,7 @@ class ToolboxHelper } /** - * Generates an array from a dot separated string - * - * @param string $path - * @param mixed $value - * @param string $separator - * @return array + * Generates an array from a dot separated string. */ public static function dotStringToNestedArray(string $path, mixed $value, string $separator = '.'): array { @@ -402,85 +372,77 @@ class ToolboxHelper foreach ($keys as $key) { $arr = [$key => $arr]; } + return $arr; } /** - * Convert deeply an object to array + * Convert deeply an object to array. * - * @param mixed $input - * @return array - * @throws \RuntimeException If $input var is a scalar value. + * @throws RuntimeException If $input var is a scalar value. */ public static function objectToArray(mixed $input): array { // Only process if it's an object or array being passed to the function. - if (!(is_object($input) or is_array($input))) { - throw new \RuntimeException('Cannot handle $input of type ' . \gettype($input)); + if (!is_object($input) && !is_array($input)) { + throw new RuntimeException('Cannot handle $input of type ' . \gettype($input)); } $ret = (array) $input; foreach ($ret as &$item) { // Recursively process EACH element only if not scalar. - $item = (is_object($item) or is_array($item)) ? + $item = (is_object($item) || is_array($item)) ? self::objectToArray($item) : $item; } + return $ret; } /** - * Convert deeply an array to object + * Convert deeply an array to object. * - * @param mixed $input - * @return object - * @throws \RuntimeException If $input var is a scalar value. + * @throws RuntimeException If $input var is a scalar value. */ public static function arrayToObject(mixed $input): object { // Only process if it's an object or array being passed to the function. - if (!(is_object($input) or is_array($input))) { - throw new \RuntimeException('Cannot handle $input of type ' . \gettype($input)); + if (!is_object($input) && !is_array($input)) { + throw new RuntimeException('Cannot handle $input of type ' . \gettype($input)); } $ret = (object) $input; foreach ($ret as &$item) { // Recursively process EACH element only if not scalar. - $item = (is_object($item) or is_array($item)) ? + $item = (is_object($item) || is_array($item)) ? self::arrayToObject($item) : $item; } + return $ret; } - /** - * Validate picture - * - * @param string $attribute - * @param string|null $value - * @param callable $fail - * @param object $sizes - * @return void + * Validate picture. */ - public static function validatePicture(string $attribute, string|null $value, callable $fail, object $sizes) + public static function validatePicture(string $attribute, ?string $value, callable $fail, object $sizes): void { - if (!($useStorage = Storage::exists($value)) and !File::exists($value)) { + if (! ($useStorage = Storage::exists($value)) && ! File::exists($value)) { $fail(trans(':attribute n\'existe pas dans le système de fichier', [ - 'attribute' => $attribute + 'attribute' => $attribute, ])); + return; } - /** @var string */ $fileFullPath = self::getUploadedFileFullPath($value, $useStorage); if ( - !\in_array(self::getUploadedFileMimeType($value, $useStorage), [ - 'image/jpeg', 'image/jpg', 'image/png', 'image/gif' + ! \in_array(self::getUploadedFileMimeType($value, $useStorage), [ + 'image/jpeg', 'image/jpg', 'image/png', 'image/gif', ]) ) { $fail(trans(':attribute doit être une image de type \'image/jpeg,image/jpg,image/png,image/gif\'', [ - 'attribute' => $attribute + 'attribute' => $attribute, ])); } - if (!($dimensions = \getimagesize($fileFullPath))) { + if (! ($dimensions = \getimagesize($fileFullPath))) { $fail(trans(':attribute impossible de valider les dimensions', [ - 'attribute' => $attribute + 'attribute' => $attribute, ])); } else { $width = intval($dimensions[0]); @@ -499,60 +461,52 @@ class ToolboxHelper $yMessage = trans(":attribute la hauteur doit être de {$sizes->minHeight}px"); } - if (($width < $sizes->minWith) or ($width > $sizes->maxWith)) { + if ($width < $sizes->minWith || $width > $sizes->maxWith) { $fail($xMessage); } - if (($height < $sizes->minHeight) or ($height > $sizes->maxHeight)) { + if ($height < $sizes->minHeight || $height > $sizes->maxHeight) { $fail($yMessage); } - } //end if + } // end if } /** - * Get the file full path - * - * @param string $value - * @param boolean $useStorage - * @return string + * Get the file full path. */ private static function getUploadedFileFullPath(string $value, bool $useStorage): string { - /** @var \Illuminate\Filesystem\FilesystemAdapter */ + /** @var FilesystemAdapter */ $disk = Storage::disk(); - return !$useStorage ? (realpath($value) ?: $value) : $disk->path($value); + + return ! $useStorage ? (realpath($value) ?: $value) : $disk->path($value); } /** - * Get the file mimetype + * Get the file mimetype. * - * @param string $value - * @param boolean $useStorage * @return string|false */ private static function getUploadedFileMimeType(string $value, bool $useStorage) { - return !$useStorage ? File::mimeType($value) : Storage::mimeType($value); + return ! $useStorage ? File::mimeType($value) : Storage::mimeType($value); } /** - * Fetch class list from a specific namespace + * Fetch class list from a specific namespace. * - * @param string $namespace * @return array An array of classe namespaces */ public static function getClassesUsingNamespace(string $namespace): array { - return collect(File::files(\app_path(Str::of($namespace)->replaceFirst('\App', '')))) - ->filter(fn (SplFileInfo $splFileInfo) => $splFileInfo->getExtension() === 'php') + return collect(File::files(\app_path(Str::of($namespace)->replaceFirst('\App', '')->value()))) + ->filter(fn (SplFileInfo $splFileInfo): bool => $splFileInfo->getExtension() === 'php') ->map(fn (SplFileInfo $splFileInfo) => Str::of($splFileInfo->getBasename()) - ->replace('.' . $splFileInfo->getExtension(), '')->prepend("{$namespace}\\"))->all(); + ->replace('.' . $splFileInfo->getExtension(), '')->prepend("{$namespace}\\")->value())->all(); } /** - * Get all classes from a specific namespace that implement a specific interface + * Get all classes from a specific namespace that implement a specific interface. * - * @param string $namespace - * @param string $interface * @return array An array of classe namespaces */ public static function getClassesUsingInterface(string $namespace, string $interface): array @@ -560,17 +514,12 @@ class ToolboxHelper return Arr::where( static::getClassesUsingNamespace($namespace), fn (string $class_namespace) => \collect(class_implements($class_namespace, true))->filter() - ->contains(fn (string $class_interface) => $class_interface === $interface) + ->contains(fn (string $class_interface): bool => $class_interface === $interface) ); } /** * Get validated pagination from request. - * - * @param integer $default - * @param string $field - * @param string $enumPath - * @return integer */ public static function getValidatedEnum(int $default, string $field, string $enumPath): int { @@ -579,7 +528,7 @@ class ToolboxHelper [$field => \request()->get($field)], [$field => new Enum($enumPath)] )->validated()[$field]); - } catch (ValidationException $e) { + } catch (ValidationException) { return $default; } } diff --git a/app/Lib/vendor/LDCWEB/MesBr.php b/app/Lib/vendor/LDCWEB/MesBr.php index 544c768..c825daa 100644 --- a/app/Lib/vendor/LDCWEB/MesBr.php +++ b/app/Lib/vendor/LDCWEB/MesBr.php @@ -7,17 +7,8 @@ use LDC\LDCCRM\Models\Customer; class MesBr { - private $endpoint; - - private $refCamp; - - private $refSite; - - public function __construct($endpoint, $refCamp, $refSite) + public function __construct(private $endpoint, private $refCamp, private $refSite) { - $this->endpoint = $endpoint; - $this->refCamp = $refCamp; - $this->refSite = $refSite; } public function createCustomer(string $hashcode, string $email, string $country) @@ -43,70 +34,63 @@ class MesBr public function printCoupons(string $hashcode, array $coupons) { return $this->callApi("GET", '/coupons/print', [ - 'refcamp' => $this->refCamp, + 'refcamp' => $this->refCamp, 'hashcode' => $hashcode, - 'coupons' => implode(",", $coupons) + 'coupons' => implode(",", $coupons) ]); } - private function callApi($method, $url, $data = [], $path = '/api/v1') + private function callApi(string $method, string $url, array $data = [], string $path = '/api/v1') { $url = $this->endpoint . $path . $url; $curl = curl_init(); switch ($method) { case "POST": - curl_setopt($curl, CURLOPT_POST, 1); - if ($data) { + curl_setopt($curl, CURLOPT_POST, true); + if ($data !== []) { curl_setopt($curl, CURLOPT_POSTFIELDS, $data); } break; case "PUT": case "DELETE": curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); - if ($data) { + if ($data !== []) { curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); } break; default: - if ($data) { + if ($data !== []) { $url = sprintf("%s?%s", $url, http_build_query($data)); } } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_COOKIESESSION, true); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($curl); if (!curl_errno($curl)) { $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE); if (!in_array($http_code, [200, 201])) { return (object)[ - 'status' => 'KO', - 'code' => 500, + 'status' => 'KO', + 'code' => 500, 'message' => 'Connection to API failed - Code HTTP : ' . $http_code ]; } } else { return (object)[ - 'status' => 'KO', - 'code' => 500, + 'status' => 'KO', + 'code' => 500, 'message' => 'Connection to API failed : ' . curl_error($curl) ]; } - curl_close($curl); return json_decode($result); } // * Added METHODS - /** . * Update panier * - * @param \LDC\LDCCRM\Models\Customer $crm_customer - * @param string $crm_customer_hashcode - * @param string $ref_site - * @param string $coupon_id - * @param integer $quantity - * @return array + * @return array * 'status' => 'OK', * 'link' => URL, * 'verif' => URL, @@ -120,16 +104,16 @@ class MesBr int $quantity = 1 ): array { $res = $this->callAPI("GET", "/updatebasket", [ - 'refsite' => $ref_site, - 'refcamp' => $this->refCamp, + 'refsite' => $ref_site, + 'refcamp' => $this->refCamp, 'refadherent' => $crm_customer_hashcode, - 'nom' => $crm_customer->lastname, - 'prenom' => $crm_customer->firstname, - 'email' => $crm_customer->email, + 'nom' => $crm_customer->lastname, + 'prenom' => $crm_customer->firstname, + 'email' => $crm_customer->email, 'code_postal' => $crm_customer->postcode, - 'commune' => $crm_customer->city, - 'pays' => $this->getCountry($crm_customer->country), - 'panier' => "({$quantity}){$coupon_id}" + 'commune' => $crm_customer->city, + 'pays' => $this->getCountry($crm_customer->country), + 'panier' => "({$quantity}){$coupon_id}" ], ''); if (!$res) { @@ -148,10 +132,7 @@ class MesBr /** . * Update basket * - * @param \LDC\LDCCRM\Models\Customer $crm_customer - * @param string $coupon_id - * @param integer $quantity - * @return array + * @return array * 'status' => 'OK', * 'ref' => 'Basket REF' */ @@ -161,10 +142,10 @@ class MesBr int $quantity = 1 ): array { $res = $this->callAPI("GET", "/customer/basket/update", [ - 'refsite' => $this->refSite, - 'refcamp' => $this->refCamp, + 'refsite' => $this->refSite, + 'refcamp' => $this->refCamp, 'customer_hashcode' => $crm_customer->hashcode, - 'panier' => "({$quantity}){$coupon_id}" + 'panier' => "({$quantity}){$coupon_id}" ]); if (!$res) { @@ -181,15 +162,14 @@ class MesBr /** * Get customer basket - * - * @param \LDC\LDCCRM\Models\Customer $crm_customer - * @return array + * + * @return array */ public function getBasket( Customer $crm_customer, ): array { $res = $this->callApi("GET", '/customer/basket', [ - 'refcamp' => $this->refCamp, + 'refcamp' => $this->refCamp, 'hashcode' => $crm_customer->hashcode ]); @@ -208,15 +188,12 @@ class MesBr /** * Translate country to MesBr Country - * - * @param \LDC\LDCCRM\Enums\Country $country - * @return inteager */ private function getCountry(Country $country): int { return match ($country) { - Country::belgium() => 56, - Country::luxembourg() => 442, + Country::belgium => 56, + Country::luxembourg => 442, // * France default => 250 }; diff --git a/app/Mail/Jobs/CodeExportSucceed.php b/app/Mail/Jobs/CodeExportSucceed.php index e921ad7..caec74d 100644 --- a/app/Mail/Jobs/CodeExportSucceed.php +++ b/app/Mail/Jobs/CodeExportSucceed.php @@ -1,5 +1,7 @@ $this->archive_path, - 'nbCodeFic' => $this->nbCodeFic, - 'nbCodeTot' => $this->nbCodeTot, - 'nbCodeLigne' => $this->nbCodeLigne + 'nbCodeFic' => $this->nbCodeFic, + 'nbCodeTot' => $this->nbCodeTot, + 'nbCodeLigne' => $this->nbCodeLigne, ], ); } diff --git a/app/Mail/Jobs/CodeGenerationSucceed.php b/app/Mail/Jobs/CodeGenerationSucceed.php index fcfa75e..bddf47d 100644 --- a/app/Mail/Jobs/CodeGenerationSucceed.php +++ b/app/Mail/Jobs/CodeGenerationSucceed.php @@ -1,5 +1,7 @@ $this->amount, - 'gameName' => $this->gameName + 'gameName' => $this->gameName, ], ); } diff --git a/app/Mail/Jobs/JobFailed.php b/app/Mail/Jobs/JobFailed.php index a38da63..2b7cf78 100644 --- a/app/Mail/Jobs/JobFailed.php +++ b/app/Mail/Jobs/JobFailed.php @@ -1,5 +1,7 @@ $this->job, - 'exception' => $this->exception + 'job' => $this->job, + 'exception' => $this->exception, ], ); } diff --git a/app/Mail/PasswordReset.php b/app/Mail/PasswordReset.php index 2d17898..6d3a90a 100644 --- a/app/Mail/PasswordReset.php +++ b/app/Mail/PasswordReset.php @@ -1,5 +1,7 @@ user = $user; - $this->settings = $settings; } /** @@ -41,8 +31,11 @@ class PasswordReset extends Mailable implements ShouldQueue */ public function build() { + /** @var view-string $view */ + $view = 'front.basic.password-email'; + return $this->subject('Changement de votre mot de passe') - ->view('front.basic.password-email') - ->with(['user' => $this->user, 'settings' => $this->settings]); + ->view($view) + ->with(['user' => $this->user, 'settings' => $this->settings]); } } diff --git a/app/Mail/Won/DiscountWonMail.php b/app/Mail/Won/DiscountWonMail.php index fb67134..0222ebe 100644 --- a/app/Mail/Won/DiscountWonMail.php +++ b/app/Mail/Won/DiscountWonMail.php @@ -1,9 +1,10 @@ recipient], subject: trans('front.mails.subjects.game_winning', [ - 'game_name' => $this->game_name + 'game_name' => $this->game_name, ]), ); } /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ - public function content(): \Illuminate\Mail\Mailables\Content + public function content(): Content { // * Fix for async usage View::addNamespace('theme', resource_path('theme/mounted/views')); + + /** @var view-string $view */ + $view = 'theme::mails.won-discount'; + return new Content( - markdown: 'theme::mails.won-discount', + markdown: $view, with: [ 'first_name' => $this->recipient->name ?? $this->recipient->address, - 'game_name' => $this->game_name, - 'discount' => $this->discount, - 'print_url' => $this->print_url, - 'company' => $this->company, + 'game_name' => $this->game_name, + 'discount' => $this->discount, + 'print_url' => $this->print_url, + 'company' => $this->company, ], ); } diff --git a/app/Mail/Won/PrizeIsSentMail.php b/app/Mail/Won/PrizeIsSentMail.php index ec5718f..e48815c 100644 --- a/app/Mail/Won/PrizeIsSentMail.php +++ b/app/Mail/Won/PrizeIsSentMail.php @@ -1,5 +1,7 @@ recipient], @@ -45,19 +45,21 @@ class PrizeIsSentMail extends Mailable implements ShouldQueue /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ - public function content(): \Illuminate\Mail\Mailables\Content + public function content(): Content { // * Fix for async usage View::addNamespace('theme', resource_path('theme/mounted/views')); + + /** @var view-string $view */ + $view = 'theme::mails.prize-sent'; + return new Content( - markdown: 'theme::mails.prize-sent', + markdown: $view, with: [ 'first_name' => $this->recipient->name ?? $this->recipient->address, - 'game_name' => $this->game_name, - 'company' => $this->company, + 'game_name' => $this->game_name, + 'company' => $this->company, ], ); } diff --git a/app/Mail/Won/PrizeWonAdminMail.php b/app/Mail/Won/PrizeWonAdminMail.php index d4d9341..5f8f790 100644 --- a/app/Mail/Won/PrizeWonAdminMail.php +++ b/app/Mail/Won/PrizeWonAdminMail.php @@ -1,5 +1,7 @@ $this->game_name + 'game_name' => $this->game_name, ]), ); } /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ - public function content(): \Illuminate\Mail\Mailables\Content + public function content(): Content { $participation = []; - if (!is_null($this->unique_code)) { + if (! is_null($this->unique_code)) { $participation = [ trans('Code Unique : :code', ['code' => $this->unique_code]), ]; } - if (!is_null($this->ean_code)) { + if (! is_null($this->ean_code)) { $participation[] = trans('Code EAN : :code', ['code' => $this->ean_code]); } + return new Content( - htmlString: (new MailMessage()) + htmlString: new MailMessage() ->greeting(trans('Bonjour,')) ->line(trans( 'Le lot suivant a été gagné :prize_label le :date', [ 'prize_label' => $this->prize_label, - 'date' => $this->participation_date->isoFormat('LLLL') + 'date' => $this->participation_date->isoFormat('LLLL'), ] ))->lines([ trans('Gagnant :'), @@ -86,7 +83,7 @@ class PrizeWonAdminMail extends Mailable implements ShouldQueue "{$this->customer->postcode} {$this->customer->city} - {$this->customer->country->label()}", "{$this->customer->email}", "{$this->customer->phone}", - ])->lines($participation)->render() + ])->lines($participation)->render()->toHtml() ); } } diff --git a/app/Mail/Won/PrizeWonMail.php b/app/Mail/Won/PrizeWonMail.php index cbc2f4e..58d3f60 100644 --- a/app/Mail/Won/PrizeWonMail.php +++ b/app/Mail/Won/PrizeWonMail.php @@ -1,5 +1,7 @@ recipient], subject: trans('front.mails.subjects.game_winning', [ - 'game_name' => $this->game_name + 'game_name' => $this->game_name, ]), ); } /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ - public function content(): \Illuminate\Mail\Mailables\Content + public function content(): Content { // * Fix for async usage View::addNamespace('theme', resource_path('theme/mounted/views')); + + /** @var view-string $view */ + $view = 'theme::mails.won-prize'; + return new Content( - markdown: 'theme::mails.won-prize', + markdown: $view, with: [ - 'first_name' => $this->recipient->name ?? $this->recipient->address, - 'game_name' => $this->game_name, + 'first_name' => $this->recipient->name ?? $this->recipient->address, + 'game_name' => $this->game_name, 'prize_label' => $this->prize->label, - 'company' => $this->company + 'company' => $this->company, ], ); } diff --git a/app/Mail/Won/WinningProofAdminMail.php b/app/Mail/Won/WinningProofAdminMail.php index af83193..09f9220 100644 --- a/app/Mail/Won/WinningProofAdminMail.php +++ b/app/Mail/Won/WinningProofAdminMail.php @@ -1,5 +1,7 @@ $this->customer->lastname, - 'firstname' => $this->customer->firstname + 'lastname' => $this->customer->lastname, + 'firstname' => $this->customer->firstname, ]), ); } /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ - public function content(): \Illuminate\Mail\Mailables\Content + public function content(): Content { $participation = []; - if (!is_null($this->unique_code)) { + if (! is_null($this->unique_code)) { $participation = [ trans('Code Unique : :code', ['code' => $this->unique_code]), ]; } - if (!is_null($this->ean_code)) { + if (! is_null($this->ean_code)) { $participation[] = trans('Code EAN : :code', ['code' => $this->ean_code]); } + return new Content( - htmlString: (new MailMessage()) + htmlString: new MailMessage() ->greeting(trans('Bonjour,')) ->line(trans( 'Vous trouverez en PJ les preuves de gain du joueur suivant :', @@ -95,14 +92,14 @@ class WinningProofAdminMail extends Mailable implements ShouldQueue "{$this->customer->postcode} {$this->customer->city} - {$this->customer->country->label()}", "{$this->customer->email}", "{$this->customer->phone}", - ])->lines($participation)->render() + ])->lines($participation)->render()->toHtml() ); } /** * Get the attachments for the message. * - * @return array + * @return array */ public function attachments(): array { diff --git a/app/Mail/Won/WinningProofSubmitedMail.php b/app/Mail/Won/WinningProofSubmitedMail.php index 996b0f9..5eb544e 100644 --- a/app/Mail/Won/WinningProofSubmitedMail.php +++ b/app/Mail/Won/WinningProofSubmitedMail.php @@ -1,5 +1,7 @@ recipient], @@ -45,19 +45,20 @@ class WinningProofSubmitedMail extends Mailable implements ShouldQueue /** * Get the message content definition. - * - * @return \Illuminate\Mail\Mailables\Content */ - public function content(): \Illuminate\Mail\Mailables\Content + public function content(): Content { - // * Fix for async usage View::addNamespace('theme', resource_path('theme/mounted/views')); + + /** @var view-string $view */ + $view = 'theme::mails.submited-proof'; + return new Content( - markdown: 'theme::mails.submited-proof', + markdown: $view, with: [ 'first_name' => $this->recipient->name ?? $this->recipient->address, - 'game_name' => $this->game_name, - 'company' => $this->company + 'game_name' => $this->game_name, + 'company' => $this->company, ], ); } diff --git a/app/Models/ActivityLog.php b/app/Models/ActivityLog.php index 40b2977..e7133b3 100644 --- a/app/Models/ActivityLog.php +++ b/app/Models/ActivityLog.php @@ -44,15 +44,17 @@ class ActivityLog extends Model /** * Indicates if the model should be timestamped. * - * @var boolean + * @var bool */ + #[\Override] public $timestamps = false; /** * The attributes that are mass assignable. * - * @var array + * @var list */ + #[\Override] protected $fillable = [ 'is_anonymous', 'model_class', @@ -67,6 +69,7 @@ class ActivityLog extends Model * * @var array */ + #[\Override] protected $casts = [ 'is_anonymous' => 'bool', 'is_console' => 'bool', @@ -120,16 +123,15 @@ class ActivityLog extends Model $changes = $model->getChanges(); return collect($changes) - ->map(fn($val, $key) => $casts[$key] ?? 'string') + ->map(fn ($val, $key) => $casts[$key] ?? 'string') ->toArray(); } // * RELATIONS - /** * User BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\User> + * @return BelongsTo */ public function user(): BelongsTo { @@ -139,7 +141,7 @@ class ActivityLog extends Model /** * StaticPage BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\StaticPage> + * @return BelongsTo */ public function staticPage(): BelongsTo { @@ -149,7 +151,7 @@ class ActivityLog extends Model /** * Settings BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\Settings> + * @return BelongsTo */ public function settings(): BelongsTo { @@ -159,7 +161,7 @@ class ActivityLog extends Model /** * Range BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\Range> + * @return BelongsTo */ public function range(): BelongsTo { @@ -169,7 +171,7 @@ class ActivityLog extends Model /** * Product BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\Product> + * @return BelongsTo */ public function product(): BelongsTo { @@ -179,7 +181,7 @@ class ActivityLog extends Model /** * Prize BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\Prize> + * @return BelongsTo */ public function prize(): BelongsTo { @@ -189,7 +191,7 @@ class ActivityLog extends Model /** * Participation BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\Participation> + * @return BelongsTo */ public function participation(): BelongsTo { @@ -199,7 +201,7 @@ class ActivityLog extends Model /** * InstantWin BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\InstantWin> + * @return BelongsTo */ public function instantWin(): BelongsTo { @@ -209,7 +211,7 @@ class ActivityLog extends Model /** * FaqTheme BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\FaqTheme> + * @return BelongsTo */ public function faqTheme(): BelongsTo { @@ -219,7 +221,7 @@ class ActivityLog extends Model /** * FaqQuestion BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\FaqQuestion> + * @return BelongsTo */ public function faqQuestion(): BelongsTo { @@ -229,7 +231,7 @@ class ActivityLog extends Model /** * Customer BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\Customer> + * @return BelongsTo */ public function customer(): BelongsTo { @@ -239,7 +241,7 @@ class ActivityLog extends Model /** * Code BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\Code> + * @return BelongsTo */ public function code(): BelongsTo { @@ -249,7 +251,7 @@ class ActivityLog extends Model /** * BannedIp BelongsTo relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<$this,\App\Models\BannedIp> + * @return BelongsTo */ public function bannedIp(): BelongsTo { diff --git a/app/Models/BannedIp.php b/app/Models/BannedIp.php index 3def840..3773a35 100644 --- a/app/Models/BannedIp.php +++ b/app/Models/BannedIp.php @@ -1,38 +1,42 @@ + * @var list */ + #[\Override] protected $fillable = ['ip']; /** @@ -40,18 +44,17 @@ class BannedIp extends Model * * @var array */ + #[\Override] protected $casts = [ - 'ip' => Ip::class + 'ip' => Ip::class, ]; // * EVENTS /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { static::created(fn () => self::removeCached()); static::updated(fn () => self::removeCached()); @@ -59,13 +62,12 @@ class BannedIp extends Model } // * RELATIONS - /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/Code.php b/app/Models/Code.php index ef15fa4..3a64eb4 100644 --- a/app/Models/Code.php +++ b/app/Models/Code.php @@ -1,51 +1,56 @@ + * @var list */ + #[\Override] protected $fillable = [ 'code_exported', - 'date_creation' + 'date_creation', ]; /** @@ -53,6 +58,7 @@ class Code extends Model * * @var array */ + #[\Override] protected $casts = [ 'code_exported' => 'bool', 'date_creation' => 'date', @@ -61,18 +67,17 @@ class Code extends Model /** * Indicates if the model should be timestamped. * - * @var boolean + * @var bool */ + #[\Override] public $timestamps = false; // * EVENTS /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { static::created(fn () => Cache::forget('codes.count')); static::updated(fn () => Cache::forget('codes.count')); @@ -80,11 +85,10 @@ class Code extends Model } // * RELATIONS - /** * Has many Participation relation * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ public function participations(): HasMany { @@ -94,9 +98,9 @@ class Code extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } @@ -105,16 +109,15 @@ class Code extends Model /** * Generate code_unique attribute - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function codeUnique(): Attribute + protected function codeUnique(): Attribute { return Attribute::make( get: function (): ?string { - if (!$this->id or $this->id < 1) { + if (! $this->id || $this->id < 1) { return null; } + return self::intToSerial($this->id); } ); @@ -122,8 +125,6 @@ class Code extends Model /** * Get the key used for serial int caster - * - * @return integer */ public static function serialKeyHash(): int { @@ -133,9 +134,9 @@ class Code extends Model /** * Generate a serial from an int. * - * @param integer $int * @return string The serial - * @throws \Kwaadpepper\Serial\Exceptions\SerialCasterException If an error happens du to config. + * + * @throws SerialCasterException If an error happens du to config. */ public static function intToSerial(int $int): string { @@ -150,10 +151,10 @@ class Code extends Model /** * Get an int from a serial. * - * @param string $serial - * @return integer The ID represented - * @throws \Kwaadpepper\Serial\Exceptions\SerialCasterException If an error happens due to config or - * wrong serial is given. + * @return int The ID represented + * + * @throws SerialCasterException If an error happens due to config or + * wrong serial is given. */ public static function serialToInt(string $serial): int { @@ -168,20 +169,18 @@ class Code extends Model /** * Get has_been_used_too_namy_times attribute - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function hasBeenUsedTooManyTimes(): Attribute + protected function hasBeenUsedTooManyTimes(): Attribute { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); + return Attribute::make( - get: fn (): bool => $settings->nb_unique_code_use ? - Code::query()->where('id', $this->id)->whereHas( - 'participations', - operator: '>=', - count: $settings->nb_unique_code_use - )->count() : false + get: fn (): bool => $settings->nb_unique_code_use && Code::query()->where('id', $this->id)->whereHas( + 'participations', + operator: '>=', + count: $settings->nb_unique_code_use + )->exists() ); } } diff --git a/app/Models/Customer.php b/app/Models/Customer.php index c11d656..4c7e74c 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -1,12 +1,16 @@ + * @var list */ + #[\Override] protected $fillable = [ 'email', ]; @@ -58,8 +64,9 @@ class Customer extends Authenticatable implements MustVerifyEmail * * @var array */ + #[\Override] protected $casts = [ - 'last_connection' => 'datetime', + 'last_connection' => 'datetime', 'email_verified_at' => 'datetime', ]; @@ -67,24 +74,20 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { // * EVENT CLOSURES. - static::creating(function (self $model) { + static::creating(function (self $model): void { self::assertEmailIsUnique($model->id, $model->email); }); - static::updating(function (self $model) { + static::updating(function (self $model): void { self::assertEmailIsUnique($model->id, $model->email); }); - static::deleting(function (self $model) { - if ($model->existsInCrmAndIsActivated()) { - throw new \RuntimeException('This cannot be done because of MesBr'); - } + static::deleting(function (self $model): void { + throw_if($model->existsInCrmAndIsActivated(), RuntimeException::class, 'This cannot be done because of MesBr'); }); - static::deleted(function (self $model) { + static::deleted(function (self $model): void { if ($model->forceDeleting) { if ($model->existsInCrm()) { $model->api_data->delete(); @@ -94,7 +97,7 @@ class Customer extends Authenticatable implements MustVerifyEmail $model->notify(new DestroyCustomer()); } }); - static::restored(function () { + static::restored(function (): void { \session()->flash( 'warning', \trans('Votre compte à été réactivé.') @@ -102,23 +105,18 @@ class Customer extends Authenticatable implements MustVerifyEmail }); } - // * RELATIONSHIPS - /** * Set email attribute in lower case. - * - * @param string $value - * @return void */ - public function setEmailAttribute(string $value): void + protected function email(): Attribute { - $this->attributes['email'] = Str::lower($value); + return Attribute::make(set: fn (string $value): array => ['email' => Str::lower($value)]); } /** * Has Many Participation relation * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ public function participations(): HasMany { @@ -128,9 +126,9 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } @@ -142,15 +140,13 @@ class Customer extends Authenticatable implements MustVerifyEmail * de manière permanente. * * ! Les comptes non activés depuis une semaine ou les comptes supprimés depuis une semaine. - * - * @return \Illuminate\Database\Eloquent\Builder */ - public function prunable(): \Illuminate\Database\Eloquent\Builder + public function prunable(): Builder { - return static::query()->where(function (Builder $q) { + return static::query()->where(function (Builder $q): void { $q->where('updated_at', '<=', now()->subWeek()) ->whereNull('email_verified_at'); - })->orWhere(function (Builder $q) { + })->orWhere(function (Builder $q): void { $q->where('deleted_at', '<=', now()->subWeek()); }); } @@ -158,10 +154,7 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Asserts using validation that the email is unique * - * @param mixed $id - * @param mixed $email - * @return void - * @throws \Illuminate\Validation\ValidationException If user email as already used. + * @throws ValidationException If user email as already used. */ private static function assertEmailIsUnique(mixed $id, mixed $email): void { @@ -171,11 +164,7 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Asserts that the field is unique * - * @param mixed $id - * @param string $field - * @param mixed $value - * @return void - * @throws \Illuminate\Validation\ValidationException If the field is not unique. + * @throws ValidationException If the field is not unique. */ private static function assertFieldIsUnique(mixed $id, string $field, mixed $value): void { @@ -184,19 +173,16 @@ class Customer extends Authenticatable implements MustVerifyEmail ], [ $field . '.unique' => trans('La valeur :value pour le champ :attribute est déjà utilisé', [ 'attribute' => $field, - 'value' => $value - ]) + 'value' => $value, + ]), ])->validate(); } // * --- AUTH --- - /** * Send the email verification notification. - * - * @return void */ - public function sendEmailVerificationNotification() + public function sendEmailVerificationNotification(): void { $this->deleteIfDoesNotExistsInCrm(); $this->notify(new VerifyEmail()); @@ -205,9 +191,11 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Mark the given user's email as verified. * - * @return boolean - * @throws \LDC\LDCCRM\Exceptions\CrmException If an error occurs on server side or on getting response. - * @throws \LDC\LDCCRM\Exceptions\ApiErrorException If any error or \LDC\LDCCRM\Enums\ApiError occurs. + * @return bool + * + * @throws CrmException If an error occurs on server side or on getting response. + * @throws ApiErrorException If any error or \LDC\LDCCRM\Enums\ApiError occurs. + * * @phpcs:ignore Squiz.Commenting.FunctionCommentThrowTag.WrongNumber */ public function markEmailAsVerified() @@ -225,11 +213,8 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Send the password reset notification. - * - * @param mixed $token - * @return void */ - public function sendPasswordResetNotification(mixed $token) + public function sendPasswordResetNotification(mixed $token): void { $this->deleteIfDoesNotExistsInCrm(); /** @var string $token */ @@ -240,20 +225,19 @@ class Customer extends Authenticatable implements MustVerifyEmail { $crmCustomer = $this->getCrmCustomer(); - return $crmCustomer && $crmCustomer->status; + return $crmCustomer instanceof CrmCustomer && $crmCustomer->status; } public function existsInCrm(): bool { - return $this->getCrmCustomer() !== null; + return $this->getCrmCustomer() instanceof CrmCustomer; } /** * Force delete and logout if is logged in case the customer * does not exists in CRM. * - * @return void - * @throws \Illuminate\Validation\ValidationException If the account is deleted because does not exists in CRM. + * @throws ValidationException If the account is deleted because does not exists in CRM. */ private function deleteIfDoesNotExistsInCrm(): void { @@ -262,19 +246,19 @@ class Customer extends Authenticatable implements MustVerifyEmail } /** @var static|null $loggedCustomer */ $loggedCustomer = \auth('frontend')->user(); - $isLogged = \optional($loggedCustomer)->id === $this->id && !empty($this->id); + $isLogged = $loggedCustomer?->id === $this->id && ! empty($this->id); if ($isLogged) { \auth('frontend')->logout(); } $this->delete(); throw ValidationException::withMessages([ - 'error' => trans('Le compte \'existe pas.') + 'error' => trans('Le compte \'existe pas.'), ]); } private function getCrmCustomer(): ?CrmCustomer { - if (!$this->hashcode) { + if (! $this->hashcode) { return null; } @@ -282,6 +266,7 @@ class Customer extends Authenticatable implements MustVerifyEmail return CrmCustomer::find($this->hashcode); } catch (CrmException | ApiErrorException $e) { report($e); + return null; } } @@ -298,19 +283,16 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Get api_data attribute, the crm Data of a customer - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function apiData(): Attribute + protected function apiData(): Attribute { return Attribute::make( - get: fn (): CrmCustomer => self::cacheCrm($this->hashcode, "apiData", function () { - /** @var \LDC\LDCCRM\CrmApiV4 */ - $crm = app('crmAPI'); + get: fn (): CrmCustomer => self::cacheCrm($this->hashcode, 'apiData', function () { + /** @var CrmApiV4 */ + $crm = resolve('crmAPI'); $crmCustomer = $crm->getCustomer($this->hashcode); - if (!$crmCustomer) { - throw new CrmException('CRM get Customer returned null'); - } + throw_unless($crmCustomer, CrmException::class, 'CRM get Customer returned null'); + return $crmCustomer; }) ); @@ -319,11 +301,10 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Set the crm Data of a customer * - * @param array $data - * @return boolean * - * @throws \LDC\LDCCRM\Exceptions\CrmException If an error occurs on server side or on getting response. - * @throws \LDC\LDCCRM\Exceptions\ApiErrorException If any error or \LDC\LDCCRM\Enums\ApiError occurs. + * @throws CrmException If an error occurs on server side or on getting response. + * @throws ApiErrorException If any error or \LDC\LDCCRM\Enums\ApiError occurs. + * * @phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber */ public function updateApiData(array $data): bool @@ -331,9 +312,7 @@ class Customer extends Authenticatable implements MustVerifyEmail // phpcs:enable /** @var \LDC\LDCCRM\Models\Customer|null $crmCustomer */ $crmCustomer = $this->api_data; - if (!$crmCustomer) { - throw new CrmException('CRM get Customer returned null'); - } + throw_unless($crmCustomer, CrmException::class, 'CRM get Customer returned null'); $crmCustomer->fill($data); $result = $crmCustomer->save(); @@ -346,8 +325,6 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Clear cached apiData - * - * @return void */ public function clearApiDataCache(): void { @@ -360,14 +337,16 @@ class Customer extends Authenticatable implements MustVerifyEmail * Put customer crm part in cache * * @template T - * @param string $uuid The customer uuid. - * @param string $part_name The part name for the cache path. - * @param \Closure():T $part The part to cache. - * @param integer $ttl Time to live in seconds for the cache part. + * + * @param string $uuid The customer uuid. + * @param string $part_name The part name for the cache path. + * @param Closure():T $part The part to cache. + * @param int $ttl Time to live in seconds for the cache part. * @return T + * * @phpcs:disable Squiz.Commenting.FunctionComment.IncorrectTypeHint */ - public static function cacheCrm(string $uuid, string $part_name, \Closure $part, int $ttl = 60 * 60) + public static function cacheCrm(string $uuid, string $part_name, Closure $part, int $ttl = 60 * 60) { // phpcs:enable return Cache::remember("customers.{$uuid}.{$part_name}", $ttl, $part); @@ -375,10 +354,6 @@ class Customer extends Authenticatable implements MustVerifyEmail /** * Clear customer crm cache part or totally - * - * @param string $uuid - * @param string $part_name - * @return void */ public static function clearCrmCached(string $uuid, string $part_name): void { @@ -415,10 +390,10 @@ class Customer extends Authenticatable implements MustVerifyEmail 'city' => '', 'country' => '', 'opt_in' => '', - 'phone' => '' + 'phone' => '', ])->toArray(); - } else { - return parent::toArray(); } + + return parent::toArray(); } } diff --git a/app/Models/FaqQuestion.php b/app/Models/FaqQuestion.php index cafcfa5..ac815e7 100644 --- a/app/Models/FaqQuestion.php +++ b/app/Models/FaqQuestion.php @@ -1,57 +1,59 @@ + * @var list */ + #[\Override] protected $fillable = [ 'question', 'answer', - 'theme_id' + 'theme_id', ]; /** * The relations to eager load on every query. * - * @var array + * @var list */ + #[\Override] protected $with = ['theme']; // * EVENTS /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { static::created(fn () => self::removeCached()); static::updated(fn () => self::removeCached()); @@ -59,11 +61,10 @@ class FaqQuestion extends Model } // * RELATIONS - /** * Theme relation * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ public function theme(): BelongsTo { @@ -73,9 +74,9 @@ class FaqQuestion extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/FaqTheme.php b/app/Models/FaqTheme.php index 63af913..8d0ab62 100644 --- a/app/Models/FaqTheme.php +++ b/app/Models/FaqTheme.php @@ -1,70 +1,69 @@ + * @var list */ + #[\Override] protected $fillable = ['name']; // * EVENTS /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { static::created(fn () => self::removeCached()); static::updated(fn () => self::removeCached()); - static::deleting(function (self $model) { + static::deleting(function (self $model): void { if ($model->questions()->count()) { throw ValidationException::withMessages([ 'error' => // phpcs:ignore Generic.Files.LineLength.TooLong - trans("Il n'est pas possible de supprimer ce theme car il est associé a des questions,\u{00A0} suppirmer les questions d'abord.") + trans("Il n'est pas possible de supprimer ce theme car il est associé a des questions,\u{00A0} suppirmer les questions d'abord."), ]); } }); static::deleted(fn () => self::removeCached()); } - // * RELATIONS - /** - * Question relation + * Question relation. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ public function questions(): HasMany { @@ -74,9 +73,9 @@ class FaqTheme extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/InstantWin.php b/app/Models/InstantWin.php index f5ccdf3..2d190eb 100644 --- a/app/Models/InstantWin.php +++ b/app/Models/InstantWin.php @@ -1,70 +1,71 @@ + * @var list */ + #[\Override] protected $with = ['prize']; // * EVENTS /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { - static::creating(function () { + static::creating(function (): void { InstantWin::removeCached(); Prize::removeCached(); }); - static::updating(function () { + static::updating(function (): void { InstantWin::removeCached(); Prize::removeCached(); }); - static::deleting(function () { + static::deleting(function (): void { InstantWin::removeCached(); Prize::removeCached(); }); } // * RELATIONSHIPS - /** - * BelongsTo Prize relation + * BelongsTo Prize relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ public function prize(): BelongsTo { @@ -72,9 +73,9 @@ class InstantWin extends Model } /** - * One to one relation participation + * One to one relation participation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ public function participation(): BelongsTo { @@ -84,9 +85,9 @@ class InstantWin extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/Participation.php b/app/Models/Participation.php index 82aba4c..484e41e 100644 --- a/app/Models/Participation.php +++ b/app/Models/Participation.php @@ -1,54 +1,56 @@ + * @var list */ + #[\Override] protected $fillable = [ 'barcode', 'ticket', 'sticker', - 'discount_code' + 'discount_code', ]; /** @@ -56,9 +58,10 @@ class Participation extends Model * * @var array */ + #[\Override] protected $casts = [ 'ip' => Ip::class, - 'price_sent' => 'bool' + 'price_sent' => 'bool', ]; /** @@ -66,45 +69,47 @@ class Participation extends Model * * @var array */ + #[\Override] protected $attributes = [ 'sticker' => null, 'ticket' => null, 'barcode' => null, - 'discount_code' => null + 'discount_code' => null, ]; /** * Perform any actions required after the model boots. - * - * @return void */ protected static function booted(): void { - static::creating(function (self $model) { + static::creating(function (self $model): void { self::manageFields($model); }); - static::updating(function (self $model) { + static::updating(function (self $model): void { self::manageFields($model); - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); if ( // ? Les notification doivent être envoyées ? - $settings->notify_prize_sent and - // ? On veux marquer le lot comme envoyé ? - $model->prize_sent and - !$model->getOriginal('prize_sent') + $settings->notify_prize_sent && $model->prize_sent && ! $model->getOriginal('prize_sent') ) { - /** @var \App\Models\Customer */ + /** @var Customer */ $customer = $model->customer; $customer->notify(new PrizeHasBeenSent()); } }); - static::updated(function (self $model) { - FileStorageHelper::removeOldFile($model, 'barcode'); - FileStorageHelper::removeOldFile($model, 'ticket'); - FileStorageHelper::removeOldFile($model, 'sticker'); + static::updated(function (self $model): void { + if ($model->getOriginal('barcode')) { + FileStorageHelper::removeOldFile($model, 'barcode'); + } + if ($model->getOriginal('ticket')) { + FileStorageHelper::removeOldFile($model, 'ticket'); + } + if ($model->getOriginal('sticker')) { + FileStorageHelper::removeOldFile($model, 'sticker'); + } }); - static::deleted(function (self $model) { + static::deleted(function (self $model): void { FileStorageHelper::removeFile($model, 'barcode'); FileStorageHelper::removeFile($model, 'ticket'); FileStorageHelper::removeFile($model, 'sticker'); @@ -112,11 +117,10 @@ class Participation extends Model } // * RELATIONSHIPS - /** * BelongsTo User relation * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ public function customer(): BelongsTo { @@ -126,7 +130,7 @@ class Participation extends Model /** * BelongsTo Codes relation * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ public function code(): BelongsTo { @@ -136,7 +140,7 @@ class Participation extends Model /** * BelongsTo Product relation * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ public function product(): BelongsTo { @@ -146,7 +150,7 @@ class Participation extends Model /** * One to one InstantWin relation * - * @return \Illuminate\Database\Eloquent\Relations\HasOne + * @return HasOne */ public function instantWin(): HasOne { @@ -156,9 +160,9 @@ class Participation extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } @@ -167,26 +171,22 @@ class Participation extends Model /** * Accessor for ean_code, from product table. - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute; */ - public function eanCode(): Attribute + protected function eanCode(): Attribute { return Attribute::make( - get: fn() => optional($this->product)->ean_code, + get: fn () => $this->product?->ean_code, ); } // * METHODS - /** * Make new participation but do not persist on DB * - * @param \IPLib\Address\AddressInterface $ip Ip for the participation. - * @param \App\Models\Customer $customer The Customer playing the game. - * @param \App\Models\Code|null $code The unique code used to play. - * @param \App\Models\Product|null $product The product that holds the sticker if codes are actived. - * @return \App\Models\Participation + * @param AddressInterface $ip Ip for the participation. + * @param Customer $customer The Customer playing the game. + * @param Code|null $code The unique code used to play. + * @param Product|null $product The product that holds the sticker if codes are actived. */ public static function makeNew( AddressInterface $ip, @@ -197,35 +197,30 @@ class Participation extends Model $self = new self(); $self->ip = $ip; $self->customer()->associate($customer); - if (!is_null($code)) { + if (! is_null($code)) { $self->code()->associate($code); } - if (!is_null($product)) { + if (! is_null($product)) { $self->product()->associate($product); } + return $self; } /** * Check if a customer has already won - * - * @param \App\Models\Customer $customer - * @return boolean */ public static function customerAlreadyHasAnInstantWin(Customer $customer): bool { return self::query()->whereHas('instantWin') - ->whereHas('customer', fn(Builder $q) => $q->where('id', $customer->id)) + ->whereHas('customer', fn (Builder $q) => $q->where('id', $customer->id)) ->exists(); } /** * Common methods function. - * - * @param self $model - * @return void */ - private static function manageFields(self $model) + private static function manageFields(self $model): void { if ($model->barcode) { $model->barcode = FileStorageHelper::storeFile($model, $model->barcode, true); @@ -236,7 +231,7 @@ class Participation extends Model if ($model->sticker) { $model->sticker = FileStorageHelper::storeFile($model, $model->sticker, true); } - if (!$model->comment) { + if (! $model->comment) { $model->comment = ''; } } diff --git a/app/Models/Prize.php b/app/Models/Prize.php index e76ab18..239da60 100644 --- a/app/Models/Prize.php +++ b/app/Models/Prize.php @@ -1,46 +1,49 @@ + * @var list */ + #[\Override] protected $fillable = [ 'label', 'picture', @@ -50,45 +53,43 @@ class Prize extends Model 'arg_subtitle', 'arg_content', 'quantity', - 'pdf_winning_proof' + 'pdf_winning_proof', ]; // * EVENTS /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { - static::creating(function (self $model) { + static::creating(function (self $model): void { ToolboxHelper::assertGameIsNotOppened(); self::manageFields($model); }); - static::created(function () { + static::created(function (): void { self::removeCached(); }); - static::updating(function (self $model) { + static::updating(function (self $model): void { ToolboxHelper::assertGameIsNotOppened(); self::manageFields($model); }); - static::updated(function (self $model) { + static::updated(function (self $model): void { self::removeCached(); FileStorageHelper::removeOldFile($model, 'picture'); FileStorageHelper::removeOldFile($model, 'pdf_winning_proof'); }); - static::deleting(function (self $model) { + static::deleting(function (self $model): void { ToolboxHelper::assertGameIsNotOppened(); if ($model->instantWins()->count()) { throw ValidationException::withMessages([ 'error' => // phpcs:ignore Generic.Files.LineLength.TooLong - trans("Il n'est pas possible de supprimer ce lot car il est associé a des instants gagnants,\u{00A0} supprimer les instants gagnants d'abord.") + trans("Il n'est pas possible de supprimer ce lot car il est associé a des instants gagnants,\u{00A0} supprimer les instants gagnants d'abord."), ]); } }); - static::deleted(function (self $model) { + static::deleted(function (self $model): void { self::removeCached(); FileStorageHelper::removeFile($model, 'picture'); FileStorageHelper::removeFile($model, 'pdf_winning_proof'); @@ -99,11 +100,8 @@ class Prize extends Model /** * Common methods function. - * - * @param self $model - * @return void */ - private static function manageFields(self $model) + private static function manageFields(self $model): void { $model->picture = FileStorageHelper::storeFile($model, $model->picture, true); if ($model->pdf_winning_proof) { @@ -112,11 +110,10 @@ class Prize extends Model } // * RELATIONSHIPS - /** - * HasMany InstantWin relation + * HasMany InstantWin relation. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ public function instantWins(): HasMany { @@ -126,9 +123,9 @@ class Prize extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } @@ -136,9 +133,9 @@ class Prize extends Model // * CACHE METHOD /** - * Change query for cached elements + * Change query for cached elements. * - * @param \Illuminate\Database\Eloquent\Builder $query + * @param \Illuminate\Database\Eloquent\Builder $query * @return \Illuminate\Database\Eloquent\Builder */ protected static function queryCached(Builder $query): Builder diff --git a/app/Models/Product.php b/app/Models/Product.php index b174b5c..e3f3090 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -1,43 +1,46 @@ + * @var list */ + #[\Override] protected $fillable = [ 'name', 'picture', @@ -51,47 +54,40 @@ class Product extends Model /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { - static::creating(function (self $model) { + static::creating(function (self $model): void { self::manageFields($model); }); static::created(fn () => self::removeCached()); - static::updating(function (self $model) { + static::updating(function (self $model): void { self::manageFields($model); }); - static::updated(function (self $model) { + static::updated(function (self $model): void { self::removeCached(); FileStorageHelper::removeOldFile($model, 'picture'); }); - static::deleted(function (self $model) { + static::deleted(function (self $model): void { self::removeCached(); FileStorageHelper::removeFile($model, 'picture'); }); } // * METHODS - /** * Common methods function. - * - * @param self $model - * @return void */ - private static function manageFields(self $model) + private static function manageFields(self $model): void { $model->picture = FileStorageHelper::storeFile($model, $model->picture, true); } // * RELATIONSHIPS - /** - * Range relation + * Range relation. * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + * @return BelongsTo */ public function range(): BelongsTo { @@ -99,9 +95,9 @@ class Product extends Model } /** - * Participations relation + * Participations relation. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ public function participations(): HasMany { @@ -111,9 +107,9 @@ class Product extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/Range.php b/app/Models/Range.php index a29b524..9d13e25 100644 --- a/app/Models/Range.php +++ b/app/Models/Range.php @@ -1,38 +1,41 @@ + * @var list */ + #[\Override] protected $fillable = [ 'name', 'picture', @@ -44,21 +47,19 @@ class Range extends Model /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { - static::creating(function (self $model) { + static::creating(function (self $model): void { self::manageFields($model); }); - static::updating(function (self $model) { + static::updating(function (self $model): void { self::manageFields($model); }); - static::updated(function (self $model) { + static::updated(function (self $model): void { FileStorageHelper::removeOldFile($model, 'picture'); }); - static::deleted(function (self $model) { + static::deleted(function (self $model): void { FileStorageHelper::removeFile($model, 'picture'); }); } @@ -67,21 +68,17 @@ class Range extends Model /** * Common methods function. - * - * @param self $model - * @return void */ - private static function manageFields(self $model) + private static function manageFields(self $model): void { $model->picture = FileStorageHelper::storeFile($model, $model->picture, true); } // * RELATIONSHIPS - /** - * Product relation + * Product relation. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ public function products(): HasMany { @@ -91,9 +88,9 @@ class Range extends Model /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/Settings.php b/app/Models/Settings.php index 87d6b75..f48654a 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -1,66 +1,71 @@ $web_coupons Array of web coupons - * @property array $notification_emails Array of email to notify when there's a winnner - * @property array $authorized_countries All countries eligible to participate. - * @property boolean $winning_proof Is the winning proof needed - * @property-read \Illuminate\Support\Carbon $created_at Creation Date. - * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. - * - * @property-read boolean $game_is_open Le jeu est ouvert ? - * @property-read boolean $game_has_begun Le jeu à démarré ? - * @property-read boolean $game_has_ended Le jeu est terminé ? - * @property-read boolean $should_display_teaser_page Doit afficher la page de teaser ? - * @property-read boolean $should_display_end_page Doit afficher la page fin de jeu ? - * + * @property string $name The game name + * @property string $company Name of the company that organizes the game + * @property Carbon $start_date Start date of the game + * @property Carbon $end_date End date of the game + * @property int $nb_participation_player Max paticipation per player (0 = unlimited) + * @property int $nb_participation_ip Max paticipation per ip (0 = unlimited) + * @property int $nb_unique_code_use Max unique code use (0 = unlimited) + * Dans tous les cas 1 joueur ne peut utiliser + * qu'une seule fois 1 code donné + * @property bool $notify_prize_sent Should the game send notifications + * when the prize is sent ? + * @property CodeType $code_type Wich codes must be used. + * @property bool $activated_teaser Is the teaser active ? + * @property bool $activated_close_page Is the close page active ? + * @property Carbon $close_page_active_date End date of the close page + * @property string $redirect_close Link to redirect when the game is ended + * @property bool $discounts_activated Are the discounts active ? + * @property string $discounts_site Discount MesBr site + * @property string $discounts_campaign Discount MesBr campaign + * @property array $web_coupons Array of web coupons + * @property array $notification_emails Array of email to notify when there's a winnner + * @property array $authorized_countries All countries eligible to participate. + * @property bool $winning_proof Is the winning proof needed + * @property-read Carbon $created_at Creation Date. + * @property-read Carbon $updated_at Last update Date. + * @property-read bool $game_is_open Le jeu est ouvert ? + * @property-read bool $game_has_begun Le jeu à démarré ? + * @property-read bool $game_has_ended Le jeu est terminé ? + * @property-read bool $should_display_teaser_page Doit afficher la page de teaser ? + * @property-read bool $should_display_end_page Doit afficher la page fin de jeu ? * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class Settings extends Model { - use ActivityLog; + use HasActivityLog; use IsCachedAsCollection; /** * The attributes that are mass assignable. * - * @var array + * @var list */ + #[\Override] protected $fillable = [ 'name', 'company', @@ -90,6 +95,7 @@ class Settings extends Model * * @var array */ + #[\Override] protected $casts = [ 'notify_prize_sent' => 'bool', 'code_type' => CodeType::class, @@ -109,22 +115,20 @@ class Settings extends Model /** * Perform any actions required after the model boots. - * - * @return void */ - protected static function booted() + protected static function booted(): void { - static::created(function () { + static::created(function (): void { self::removeCached(); }); - static::updated(function (self $model) { + static::updated(function (self $model): void { self::removeCached(); FileStorageHelper::removeOldFiles( $model->fetchCouponsPictures(true), $model->fetchCouponsPictures() ); }); - static::deleted(function () { + static::deleted(function (): void { self::removeCached(); }); } @@ -133,17 +137,15 @@ class Settings extends Model /** * Fetch all widget Files - * - * @param boolean $useOldAttribute - * @return array */ public function fetchCouponsPictures(bool $useOldAttribute = false): array { $files = []; - \collect(!$useOldAttribute ? $this->web_coupons : $this->getOriginal('web_coupons')) - ->each(function (Discount $coupon) use (&$files) { + \collect(! $useOldAttribute ? $this->web_coupons : $this->getOriginal('web_coupons')) + ->each(function (Discount $coupon) use (&$files): void { $files = \array_merge($files, [$coupon->picture]); }); + return FileStorageHelper::onlyUploadedFilesWithFileStorageHelper(collect($files)->filter()->all()); } @@ -156,39 +158,43 @@ class Settings extends Model * - Min 1 Instant gagnant. * - Min 1 Product if Settings code_type is ean or both codes. * - Min 1 WebCoupon if Settings discounts_activated - * - * @return boolean */ public function checkGameCanBePlayed(): bool { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - if (!(bool) Prize::getCached()->count()) { - report(new \RuntimeException('Need prizes to enable the game')); + /** @var Settings */ + $settings = resolve(Settings::class); + if (! (bool) Prize::getCached()->count()) { + report(new RuntimeException('Need prizes to enable the game')); + return false; } if ( ($settings->code_type->equals(CodeType::unique) || $settings->code_type->equals(CodeType::both)) - and !(bool) Cache::remember('codes.count', CarbonInterval::day(), fn() => Code::query()->count()) + && ! (bool) Cache::remember('codes.count', CarbonInterval::day(), fn () => Code::query()->count()) ) { - report(new \RuntimeException('Need codes to enable the game')); + report(new RuntimeException('Need codes to enable the game')); + return false; } - if (!(bool) InstantWin::getCached()->count()) { - report(new \RuntimeException('Need instant win to enable the game')); + if (! (bool) InstantWin::getCached()->count()) { + report(new RuntimeException('Need instant win to enable the game')); + return false; } if ( ($settings->code_type->equals(CodeType::ean) || $settings->code_type->equals(CodeType::both)) - and !(bool) Product::getCached()->count() + && ! (bool) Product::getCached()->count() ) { - report(new \RuntimeException('Need products to enable the game using ean codes')); + report(new RuntimeException('Need products to enable the game using ean codes')); + return false; } - if ($settings->discounts_activated and !(bool) collect($this->web_coupons)->count()) { - report(new \RuntimeException('Need MesBr coupons to enable the game using discounts')); + if ($settings->discounts_activated && ! (bool) collect($this->web_coupons)->count()) { + report(new RuntimeException('Need MesBr coupons to enable the game using discounts')); + return false; } + return true; } @@ -198,10 +204,8 @@ class Settings extends Model * Get game_has_begun attribute * * The game has started ? - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function gameHasBegun(): Attribute + protected function gameHasBegun(): Attribute { return Attribute::make( get: fn (): bool => $this->start_date->lte(now()) @@ -212,13 +216,11 @@ class Settings extends Model * Get game_has_ended attribute * * The game has ended ? - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function gameHasEnded(): Attribute + protected function gameHasEnded(): Attribute { return Attribute::make( - get: fn (): bool => $this->game_has_begun and $this->end_date->lte(now()) + get: fn (): bool => $this->game_has_begun && $this->end_date->lte(now()) ); } @@ -226,13 +228,11 @@ class Settings extends Model * Get game_is_open attribute * * The game is oppen ? - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function gameIsOpen(): Attribute + protected function gameIsOpen(): Attribute { return Attribute::make( - get: fn (): bool => $this->game_has_begun and !$this->game_has_ended + get: fn (): bool => $this->game_has_begun && ! $this->game_has_ended ); } @@ -240,15 +240,11 @@ class Settings extends Model * Get should_display_teaser_page attribute * * The teaser page has to be displayed ? - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function shouldDisplayTeaserPage(): Attribute + protected function shouldDisplayTeaserPage(): Attribute { return Attribute::make( - get: fn (): bool => !$this->game_has_begun and - !$this->game_has_ended and - $this->activated_teaser + get: fn (): bool => ! $this->game_has_begun && ! $this->game_has_ended && $this->activated_teaser ); } @@ -256,51 +252,45 @@ class Settings extends Model * Get should_display_end_page attribute * * The end page has to be displayed ? - * - * @return \Illuminate\Database\Eloquent\Casts\Attribute */ - public function shouldDisplayEndPage(): Attribute + protected function shouldDisplayEndPage(): Attribute { return Attribute::make( - get: fn (): bool => $this->game_has_begun and - $this->game_has_ended and - $this->activated_close_page and - $this->close_page_active_date->gte(now()) + get: fn (): bool => $this->game_has_begun + && $this->game_has_ended + && $this->activated_close_page + && $this->close_page_active_date->gte(now()) ); } /** * Get all authorized countries. - * - * @return \Illuminate\Support\Collection */ - public function getAuthorizedCountries(): \Illuminate\Support\Collection + public function getAuthorizedCountries(): Collection { - /** @var \App\Models\Settings $settings */ - $settings = app(Settings::class); + /** @var Settings $settings */ + $settings = resolve(Settings::class); if (count($settings->authorized_countries)) { // * Authorized countries defined in settings. - $countries = collect(Country::getValidCountries()) - ->filter(fn($enum) => in_array($enum->value, $settings->authorized_countries)); - } else { - // * Only DROM-COM + France. - $franceCountries = collect(Country::getValidCountries()) - ->filter(fn($enum) => !in_array($enum, [Country::belgium, Country::luxembourg, Country::germany])); - $otherCountries = collect(Country::getValidCountries()) - ->filter(fn($enum) => !$franceCountries->contains($enum)); - $countries = $franceCountries->merge($otherCountries); + return collect(Country::getValidCountries()) + ->filter(fn ($enum): bool => in_array($enum->value, $settings->authorized_countries)); } - return $countries; + // * Only DROM-COM + France. + $franceCountries = collect(Country::getValidCountries()) + ->reject(fn ($enum): bool => in_array($enum, [Country::belgium, Country::luxembourg, Country::germany])); + $otherCountries = collect(Country::getValidCountries()) + ->reject(fn ($enum): bool => $franceCountries->contains($enum)); + + return $franceCountries->merge($otherCountries); } // * RELATIONS - /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/StaticPage.php b/app/Models/StaticPage.php index 028d475..b99737e 100644 --- a/app/Models/StaticPage.php +++ b/app/Models/StaticPage.php @@ -1,36 +1,41 @@ + * @var list */ + #[\Override] protected $fillable = [ 'seo_title', 'seo_description', @@ -43,6 +48,7 @@ class StaticPage extends Model * * @var array */ + #[\Override] protected $casts = [ 'type' => StaticPageType::class, ]; @@ -51,19 +57,17 @@ class StaticPage extends Model /** * Perform any actions required after the model boots. - * - * @return void */ protected static function booted(): void { - static::creating(function (self $model) { + static::creating(function (self $model): void { // * ASSERTIONS self::assertTitleIsUnique($model->title); // * CHANGES $model->slug = Str::slug($model->title); }); - static::updating(function (self $model) { + static::updating(function (self $model): void { // * ASSERTIONS self::assertTitleIsUnique($model->title, $model->id); @@ -81,8 +85,9 @@ class StaticPage extends Model */ public function getRouteKey() { - /** @var \App\Enums\StaticPageType */ + /** @var StaticPageType */ $enum = $this->getAttribute($this->getRouteKeyName()); + return $enum->value(); } @@ -90,8 +95,6 @@ class StaticPage extends Model * Get the route key for the model. * * ! Type is the routable parameter - * - * @return string */ public function getRouteKeyName(): string { @@ -99,30 +102,26 @@ class StaticPage extends Model } // * METHODS - /** * Asserts using validation that the title is unique * - * @param string|null $title - * @param integer|null $id - * @return void - * @throws \Illuminate\Validation\ValidationException If an actu title already exists. + * + * @throws ValidationException If an actu title already exists. */ - private static function assertTitleIsUnique(string|null $title, ?int $id = null) + private static function assertTitleIsUnique(?string $title, ?int $id = null): void { - $table = (new self())->getTable(); + $table = new self()->getTable(); ToolboxHelper::assertFieldIsUnique($table, 'title', $title, $id); ToolboxHelper::assertFieldIsUnique($table, 'slug', Str::slug($title), $id); } // * RELATIONS - /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Models/User.php b/app/Models/User.php index fae2f5e..e5f55bb 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -1,39 +1,43 @@ + * @var list */ + #[\Override] protected $fillable = [ 'first_name', 'last_name', @@ -47,8 +51,9 @@ class User extends Authenticatable /** * The attributes that should be hidden for serialization. * - * @var array + * @var list */ + #[\Override] protected $hidden = [ 'password', 'remember_token', @@ -59,6 +64,7 @@ class User extends Authenticatable * * @var array */ + #[\Override] protected $casts = [ 'role' => RoleEnum::class, 'email_verified_at' => 'datetime', @@ -69,22 +75,20 @@ class User extends Authenticatable /** * Perform any actions required after the model boots. - * - * @return void */ protected static function booted(): void { - static::creating(function (self $model) { + static::creating(function (self $model): void { self::updatePassword($model); // * Prevent user elevation privileges throw_if( - auth('backend')->user() and auth('backend')->user()->role->value() > $model->role->value(), + auth('backend')->user() && auth('backend')->user()->role->value() > $model->role->value(), AuthorizationException::class ); }); - static::updating(function (self $model) { + static::updating(function (self $model): void { self::updatePassword($model); - if (optional(auth('backend')->user())->getKey() === $model->getKey()) { + if (auth('backend')->user()?->getKey() === $model->getKey()) { \validator( ['published' => $model->published], ['published' => 'required|boolean|accepted'], @@ -93,7 +97,7 @@ class User extends Authenticatable } // * Prevent user elevation privileges throw_if( - auth('backend')->user() and auth('backend')->user()->role->value() > $model->role->value(), + auth('backend')->user() && auth('backend')->user()->role->value() > $model->role->value(), AuthorizationException::class ); }); @@ -103,9 +107,6 @@ class User extends Authenticatable /** * Update password. - * - * @param self $model - * @return void */ private static function updatePassword(self $model): void { @@ -115,13 +116,12 @@ class User extends Authenticatable } // * RELATIONS - /** * Activities logs One-to-many relationship. * - * @return \Illuminate\Database\Eloquent\Relations\HasMany + * @return HasMany */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + public function activityLogs(): HasMany { return $this->hasMany(ActivityLog::class); } diff --git a/app/Notifications/Customer/DestroyCustomer.php b/app/Notifications/Customer/DestroyCustomer.php index 892420a..583c052 100644 --- a/app/Notifications/Customer/DestroyCustomer.php +++ b/app/Notifications/Customer/DestroyCustomer.php @@ -1,5 +1,7 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -23,22 +25,19 @@ class DestroyCustomer extends Notification /** * Get the mail representation of the notification. - * - * @param object $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail(object $notifiable): MailMessage { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); /** @var \App\Models\Customer $notifiable */ /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; - return (new MailMessage()) + return new MailMessage() ->subject(trans('front.mails.subjects.destroy_customer', [ - 'site_name' => $settings->name + 'site_name' => $settings->name, ])) ->greeting(trans('front.mails.greetings.with_name', ['first_name' => $first_name])) ->line(trans( diff --git a/app/Notifications/Customer/DestroyedCustomer.php b/app/Notifications/Customer/DestroyedCustomer.php index 114ee3f..14e6d77 100644 --- a/app/Notifications/Customer/DestroyedCustomer.php +++ b/app/Notifications/Customer/DestroyedCustomer.php @@ -1,18 +1,20 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -24,21 +26,17 @@ class DestroyedCustomer extends Notification /** * Build the mail representation of the notification. * - * @param object $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function toMail(object $notifiable): MailMessage { // phpcs:enable - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); - /** @var \App\Models\Customer $notifiable */ - - return (new MailMessage()) + return new MailMessage() ->subject(trans('front.mails.subjects.destroyed_customer', [ - 'site_name' => $settings->name + 'site_name' => $settings->name, ])) ->greeting('front.mails.greetings.without_name') ->line(trans( diff --git a/app/Notifications/Customer/HasSubmitedWinProof.php b/app/Notifications/Customer/HasSubmitedWinProof.php index 92c65ee..9c2f8ed 100644 --- a/app/Notifications/Customer/HasSubmitedWinProof.php +++ b/app/Notifications/Customer/HasSubmitedWinProof.php @@ -1,8 +1,11 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -39,22 +42,20 @@ class HasSubmitedWinProof extends Notification implements ShouldQueue /** * Get the mail representation of the notification. - * - * @param object $notifiable - * @return \Illuminate\Contracts\Mail\Mailable */ public function toMail(object $notifiable): Mailable { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - /** @var \App\Models\Customer $notifiable */ - return (new WinningProofSubmitedMail( + /** @var Settings */ + $settings = resolve(Settings::class); + + /** @var Customer $notifiable */ + return new WinningProofSubmitedMail( new Address( $notifiable->email, $this->first_name, ), $settings->name, $settings->company, - )); + ); } } diff --git a/app/Notifications/Customer/HasWonDiscount.php b/app/Notifications/Customer/HasWonDiscount.php index 186dbab..7d71dea 100644 --- a/app/Notifications/Customer/HasWonDiscount.php +++ b/app/Notifications/Customer/HasWonDiscount.php @@ -1,9 +1,12 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -42,16 +45,14 @@ class HasWonDiscount extends Notification implements ShouldQueue /** * Get the mail representation of the notification. - * - * @param object $notifiable - * @return \Illuminate\Contracts\Mail\Mailable */ public function toMail(object $notifiable): Mailable { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - /** @var \App\Models\Customer $notifiable */ - return (new DiscountWonMail( + /** @var Settings */ + $settings = resolve(Settings::class); + + /** @var Customer $notifiable */ + return new DiscountWonMail( new Address( $notifiable->email, $this->first_name @@ -60,6 +61,6 @@ class HasWonDiscount extends Notification implements ShouldQueue $this->discount, route('fo.view-winning-participations'), $settings->company, - )); + ); } } diff --git a/app/Notifications/Customer/HasWonInstantWin.php b/app/Notifications/Customer/HasWonInstantWin.php index d563888..d19b6be 100644 --- a/app/Notifications/Customer/HasWonInstantWin.php +++ b/app/Notifications/Customer/HasWonInstantWin.php @@ -1,8 +1,11 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -42,16 +44,14 @@ class HasWonInstantWin extends Notification implements ShouldQueue /** * Get the mail representation of the notification. - * - * @param object $notifiable - * @return \Illuminate\Contracts\Mail\Mailable */ public function toMail(object $notifiable): Mailable { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - /** @var \App\Models\Customer $notifiable */ - return (new PrizeWonMail( + /** @var Settings */ + $settings = resolve(Settings::class); + + /** @var Customer $notifiable */ + return new PrizeWonMail( new Address( $notifiable->email, $this->first_name @@ -60,6 +60,6 @@ class HasWonInstantWin extends Notification implements ShouldQueue $this->prize, config('app.url'), $settings->company, - )); + ); } } diff --git a/app/Notifications/Customer/PrizeHasBeenSent.php b/app/Notifications/Customer/PrizeHasBeenSent.php index 50e97d3..f222d20 100644 --- a/app/Notifications/Customer/PrizeHasBeenSent.php +++ b/app/Notifications/Customer/PrizeHasBeenSent.php @@ -1,8 +1,11 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -25,21 +28,19 @@ class PrizeHasBeenSent extends Notification /** * Get the mail representation of the notification. - * - * @param object $notifiable - * @return \Illuminate\Contracts\Mail\Mailable */ public function toMail(object $notifiable): Mailable { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - /** @var \App\Models\Customer $notifiable */ - return (new PrizeIsSentMail( + /** @var Settings */ + $settings = resolve(Settings::class); + + /** @var Customer $notifiable */ + return new PrizeIsSentMail( new Address( $notifiable->email ), $settings->name, $settings->company, - )); + ); } } diff --git a/app/Notifications/Customer/ResetPassword.php b/app/Notifications/Customer/ResetPassword.php index 483bae9..da26e2c 100644 --- a/app/Notifications/Customer/ResetPassword.php +++ b/app/Notifications/Customer/ResetPassword.php @@ -1,8 +1,12 @@ addHours(24), - [ - 'token' => $token, - 'email' => $notifiable->getEmailForPasswordReset(), - ], - true - )); - }; + static::$createUrlCallback = (fn ($notifiable, $token) => \url(URL::temporarySignedRoute( + 'fo.password.reset', + now()->addHours(24), + [ + 'token' => $token, + 'email' => $notifiable->getEmailForPasswordReset(), + ], + true + ))); } /** * Build the mail representation of the notification. * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @param mixed $notifiable + * @return MailMessage + * * @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing */ public function toMail($notifiable) { // phpcs:enable - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); - /** @var \App\Models\Customer $notifiable */ + /** @var Customer $notifiable */ $resetUrl = $this->resetUrl($notifiable); /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; - return (new MailMessage()) + return new MailMessage() ->subject(trans('front.mails.subjects.reset_password', ['site_name' => $settings->name])) ->greeting(trans('front.mails.greetings.with_name', ['first_name' => $first_name])) ->line(trans( diff --git a/app/Notifications/Customer/UpdateEmail.php b/app/Notifications/Customer/UpdateEmail.php index a1a164c..f6680a5 100644 --- a/app/Notifications/Customer/UpdateEmail.php +++ b/app/Notifications/Customer/UpdateEmail.php @@ -1,18 +1,20 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -23,26 +25,23 @@ class UpdateEmail extends Notification /** * Get the mail representation of the notification. - * - * @param object $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail(object $notifiable): MailMessage { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); /** @var \App\Models\Customer $notifiable */ /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; - return (new MailMessage()) + return new MailMessage() ->subject(trans('front.mails.subjects.update_email', [ - 'site_name' => $settings->name + 'site_name' => $settings->name, ])) ->greeting(trans('front.mails.greetings.with_name', ['first_name' => $first_name])) ->line(trans('front.mails.contents.update_email', [ - 'site_name' => $settings->name + 'site_name' => $settings->name, ])); } } diff --git a/app/Notifications/Customer/UpdatePassword.php b/app/Notifications/Customer/UpdatePassword.php index 766315d..c593122 100644 --- a/app/Notifications/Customer/UpdatePassword.php +++ b/app/Notifications/Customer/UpdatePassword.php @@ -1,18 +1,20 @@ + * * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass */ public function via(object $notifiable): array @@ -23,26 +25,23 @@ class UpdatePassword extends Notification /** * Get the mail representation of the notification. - * - * @param object $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage */ public function toMail(object $notifiable): MailMessage { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); /** @var \App\Models\Customer $notifiable */ /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; - return (new MailMessage()) + return new MailMessage() ->subject(trans('front.mails.subjects.update_password', [ - 'site_name' => $settings->name + 'site_name' => $settings->name, ])) ->greeting(trans('front.mails.greetings.with_name', ['first_name' => $first_name])) ->line(trans('front.mails.contents.update_password', [ - 'site_name' => $settings->name + 'site_name' => $settings->name, ])); } } diff --git a/app/Notifications/Customer/VerifyEmail.php b/app/Notifications/Customer/VerifyEmail.php index d70758c..81173b4 100644 --- a/app/Notifications/Customer/VerifyEmail.php +++ b/app/Notifications/Customer/VerifyEmail.php @@ -1,12 +1,15 @@ addMinutes(Config::get('auth.verification.expire', 60)), - [ - 'id' => $notifiable->getKey(), - 'hash' => sha1($notifiable->getEmailForVerification()), - ], - true - )); - }; + static::$createUrlCallback = (fn ($notifiable) => \url(URL::temporarySignedRoute( + 'fo.verification.verify', + Date::now()->addMinutes(Config::get('auth.verification.expire', 60)), + [ + 'id' => $notifiable->getKey(), + 'hash' => sha1($notifiable->getEmailForVerification()), + ], + true + ))); } /** * Build the mail representation of the notification. * - * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @param mixed $notifiable + * @return MailMessage + * * @phpcs:disable Squiz.Commenting.FunctionComment.TypeHintMissing */ public function toMail($notifiable) { // phpcs:enable - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); /** @var \App\Models\Customer $notifiable */ /** @var string $verificationUrl */ @@ -57,9 +58,9 @@ class VerifyEmail extends NotificationsVerifyEmail /** @var string $first_name */ $first_name = $notifiable->api_data->firstname; - return (new MailMessage()) + return new MailMessage() ->success() - ->subject(trans("front.mails.subjects.verify_email", ['site_name' => $settings->name])) + ->subject(trans('front.mails.subjects.verify_email', ['site_name' => $settings->name])) ->greeting(trans('front.mails.greetings.with_name', ['first_name' => $first_name])) ->line(trans('front.mails.contents.verify_email_1')) ->line(trans('front.mails.contents.verify_email_2')) diff --git a/app/Observers/ModelObserver.php b/app/Observers/ModelObserver.php index 71d194b..d8c67c1 100644 --- a/app/Observers/ModelObserver.php +++ b/app/Observers/ModelObserver.php @@ -1,5 +1,7 @@ count() and !InstantWin::count()) ? true : false); + return UserStaticRules::atLeastRole($authUser, RoleEnum::admin) && (Prize::getCached()->count() && ! InstantWin::count()); } } diff --git a/app/Policies/ParticipationPolicy.php b/app/Policies/ParticipationPolicy.php index f7f95db..6aaca1c 100644 --- a/app/Policies/ParticipationPolicy.php +++ b/app/Policies/ParticipationPolicy.php @@ -1,5 +1,7 @@ nb_participation_ip) { $playerCanParticipateIp = (Participation::query()->whereHas( 'customer', - fn (Builder $q) => $q->where('ip', app('clientIp')) + fn (Builder $q) => $q->where('ip', resolve('clientIp')) )->count() < $settings->nb_participation_ip); } - $playerCanParticipate = (!empty($playerCanParticipateAccount) && !empty($playerCanParticipateIp)) ? - true : - false; + $playerCanParticipate = ! empty($playerCanParticipateAccount) && ! empty($playerCanParticipateIp); // * Deny banned IP, Check did not participate too much - return !(bool) BannedIp::getCached() - ->where('ip', app('clientIp'))->count() and - $playerCanParticipate; + return ! (bool) BannedIp::getCached() + ->where('ip', resolve('clientIp'))->count() && $playerCanParticipate; } /** * Wether a customer can access to won list page - * - * @param \App\Models\Customer|\App\Models\User $authUser - * @return boolean */ - public function viewWonList(Customer|User $authUser): bool + public function viewWonList(Customer | User $authUser): bool { if ($authUser instanceof User) { // * Recettage return true; } - return (bool) $authUser->participations()->where(function (Builder $q) { + + return (bool) $authUser->participations()->where(function (Builder $q): void { $q->whereNotNull('discount_code')->orWhereHas('instantWin'); })->count(); } /** * Can a customer submit winning proof ? - * - * @param \App\Models\Customer $authUser - * @param \App\Models\Participation $model - * @return boolean */ public function submitProof(Customer $authUser, Participation $model): bool { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); // Columns of the winning proofs enabled in the config. $enabledProofs = array_keys(array_filter(config('proofs'))); // Winning proofs are disabled globally or no proof is enabled in the config. - if (! $settings->winning_proof || empty($enabledProofs)) { + if (! $settings->winning_proof || $enabledProofs === []) { return false; } @@ -115,9 +102,6 @@ class ParticipationPolicy /** * Can a user change comment ? * - * @param \App\Models\User $authUser - * @param \App\Models\Participation $model - * @return boolean * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed */ public function setComment(User $authUser, Participation $model): bool @@ -128,13 +112,9 @@ class ParticipationPolicy /** * Can a user change prize_sent ? - * - * @param \App\Models\User $authUser - * @param \App\Models\Participation $model - * @return boolean */ public function changePrizeSent(User $authUser, Participation $model): bool { - return !$model->prize_sent and UserStaticRules::atLeastRole($authUser, RoleEnum::marketing); + return ! $model->prize_sent && UserStaticRules::atLeastRole($authUser, RoleEnum::marketing); } } diff --git a/app/Policies/PrizePolicy.php b/app/Policies/PrizePolicy.php index 62c073c..5cecb1e 100644 --- a/app/Policies/PrizePolicy.php +++ b/app/Policies/PrizePolicy.php @@ -1,5 +1,7 @@ game_is_open and - UserStaticRules::atLeastRole($authUser, RoleEnum::admin); + /** @var Settings */ + $settings = resolve(Settings::class); + + return ! $settings->game_is_open && UserStaticRules::atLeastRole($authUser, RoleEnum::admin); } /** * Determine whether the user can update the model. * - * @param \App\Models\User $authUser - * @param \App\Models\Prize $prize - * @return boolean * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed */ public function update(User $authUser, Prize $prize): bool { // phpcs:enable - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - return !$settings->game_is_open and - UserStaticRules::atLeastRole($authUser, RoleEnum::admin); + /** @var Settings */ + $settings = resolve(Settings::class); + + return ! $settings->game_is_open && UserStaticRules::atLeastRole($authUser, RoleEnum::admin); } /** * Determine whether the user can delete the model. * - * @param \App\Models\User $authUser - * @param \App\Models\Prize $prize - * @return boolean * @phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed */ public function delete(User $authUser, Prize $prize): bool { // phpcs:enable - /** @var \App\Models\Settings */ - $settings = app(Settings::class); - return !$settings->game_is_open and - UserStaticRules::atLeastRole($authUser, RoleEnum::admin); + /** @var Settings */ + $settings = resolve(Settings::class); + + return ! $settings->game_is_open && UserStaticRules::atLeastRole($authUser, RoleEnum::admin); } } diff --git a/app/Policies/ProductPolicy.php b/app/Policies/ProductPolicy.php index 33d868b..e38bb04 100644 --- a/app/Policies/ProductPolicy.php +++ b/app/Policies/ProductPolicy.php @@ -1,5 +1,7 @@ getRouteKey() !== $user->getRouteKey() and - UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); + return $authUser->getRouteKey() !== $user->getRouteKey() && UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); } /** * Determine whether the user can restore the model. - * - * @param \App\Models\User $authUser - * @param \App\Models\User $user - * @return boolean */ public function restore(User $authUser, User $user): bool { - return $authUser->getRouteKey() !== $user->getRouteKey() and - UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); + return $authUser->getRouteKey() !== $user->getRouteKey() && UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); } /** * Determine whether the user can permanently delete the model. - * - * @param \App\Models\User $authUser - * @param \App\Models\User $user - * @return boolean */ public function forceDelete(User $authUser, User $user): bool { - return $authUser->getRouteKey() !== $user->getRouteKey() and - UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); + return $authUser->getRouteKey() !== $user->getRouteKey() && UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); } /** * Determine whether the user can duplicate the model. - * - * @param \App\Models\User $authUser - * @param \App\Models\User $user - * @return boolean */ public function duplicate(User $authUser, User $user): bool { - return $authUser->getRouteKey() !== $user->getRouteKey() and - UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); + return $authUser->getRouteKey() !== $user->getRouteKey() && UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); } /** * Determine whether the user can publish/unpublish the model. - * - * @param \App\Models\User $authUser - * @param \App\Models\User $user - * @return boolean */ public function changePublished(User $authUser, User $user): bool { - return $authUser->getRouteKey() !== $user->getRouteKey() and - UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); + return $authUser->getRouteKey() !== $user->getRouteKey() && UserStaticRules::atLeastRole($authUser, RoleEnum::conceptor); } } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1ebb990..f616f03 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,25 +1,27 @@ app->environment('production')); + Model::shouldBeStrict(! $this->app->environment('production')); // * HTTPS FIX URL::forceScheme('https'); @@ -27,13 +29,12 @@ class AppServiceProvider extends ServiceProvider // * HA PROXY FIX. App::singleton('clientIp', function () { if (config('app.env') === 'local') { - return \IPLib\Factory::parseAddressString(request()->getClientIp()); - } else { - return \IPLib\Factory::parseAddressString( - request()->server('HTTP_X_FORWARDED_FOR') ?? - request()->getClientIp() - ); + return Factory::parseAddressString(request()->getClientIp()); } + + return Factory::parseAddressString( + request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp() + ); }); // * LOCAL FORCE eg: for Carbon @@ -42,14 +43,13 @@ class AppServiceProvider extends ServiceProvider config('app.locale'), \strtoupper(config('app.locale')) )); - Carbon::setLocale(config('app.locale')); + Date::setLocale(config('app.locale')); Pluralizer::useLanguage('french'); // * Settings Provider app()->singleton(Settings::class, function () { - if (!($settings = Settings::getCached()->first())) { - throw new \ErrorException('Settings not found in DB'); - } + throw_unless($settings = Settings::getCached()->first(), ErrorException::class, 'Settings not found in DB'); + return $settings; }); } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index f061667..0aa1b0f 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -1,5 +1,7 @@ */ + #[\Override] protected $policies = []; /** * Register any authentication / authorization services. - * - * @return void */ public function boot(): void { - Gate::define('isConceptor', function (User $user) { - return $user->role === RoleEnum::conceptor; - }); + Gate::define('isConceptor', fn (User $user): bool => $user->role === RoleEnum::conceptor); // * POLICIES Gate::define( 'fo.showRe7', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found - fn (User|Customer $user) => ($user instanceof User) and !app()->environment(['production']) and - $user->role->value() <= RoleEnum::marketing->value() + fn (User | Customer $user): bool => $user instanceof User + && ! app()->environment(['production']) + && $user->role->value() <= RoleEnum::marketing->value() ); Gate::define( 'fo.showProducts', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found - fn (User|Customer|null $user) => View::exists('theme::pages.products') and - (bool) Product::getCached()->count() + fn (User | Customer | null $user): bool => View::exists('theme::pages.products') && (bool) Product::getCached()->count() ); Gate::define( 'fo.showFaq', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found - fn (User|Customer|null $user) => View::exists('theme::pages.faq') and - (bool) FaqQuestion::getCached()->count() + fn (User | Customer | null $user): bool => View::exists('theme::pages.faq') && (bool) FaqQuestion::getCached()->count() ); Gate::define( 'fo.gameEnabled', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.Found - function (User|Customer|null $user) { - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + function (User | Customer | null $user) { + /** @var Settings */ + $settings = resolve(Settings::class); + return $settings->checkGameCanBePlayed(); } ); - Auth::provider('crm', function ($app, array $config) { - return new CrmUserProvider($app['hash'], $config['model']); - }); + Auth::provider('crm', fn ($app, array $config): CrmUserProvider => new CrmUserProvider($app['hash'], $config['model'])); } } diff --git a/app/Providers/CrmApiServiceProvider.php b/app/Providers/CrmApiServiceProvider.php index 20732fc..4c8d896 100644 --- a/app/Providers/CrmApiServiceProvider.php +++ b/app/Providers/CrmApiServiceProvider.php @@ -1,5 +1,7 @@ new CrmApiV4( + config('crm.endpoint'), + config('crm.token'), + config('crm.password') + )); } } diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 6e0c396..20955b8 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -1,5 +1,7 @@ > */ + #[\Override] protected $listen = [ Registered::class => [ SendEmailVerificationNotification::class, @@ -21,8 +24,6 @@ class EventServiceProvider extends ServiceProvider /** * Determine if events and listeners should be automatically discovered. - * - * @return boolean */ public function shouldDiscoverEvents(): bool { diff --git a/app/Providers/MesBrApiServiceProvider.php b/app/Providers/MesBrApiServiceProvider.php index dd50e24..3468615 100644 --- a/app/Providers/MesBrApiServiceProvider.php +++ b/app/Providers/MesBrApiServiceProvider.php @@ -1,5 +1,7 @@ cspReportRoute(); - $this->routes(function () { + $this->routes(function (): void { Route::middleware('web') ->namespace($this->namespace) ->group(base_path('routes/web-fo.php')); @@ -48,20 +50,12 @@ class RouteServiceProvider extends ServiceProvider /** * Configure the rate limiters for the application. - * - * @return void */ protected function configureRateLimiting(): void { - RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(150)->by($request->user()?->id ?: app('clientIp')); - }); - RateLimiter::for('web', function (Request $request) { - return Limit::perMinute(150)->by($request->user()?->id ?: app('clientIp')); - }); - RateLimiter::for('credentials', function (Request $request) { - return Limit::perMinute(30)->by($request->user()?->id ?: app('clientIp')); - }); + RateLimiter::for('api', fn (Request $request) => Limit::perMinute(150)->by($request->user()?->id ?: resolve('clientIp'))); + RateLimiter::for('web', fn (Request $request) => Limit::perMinute(150)->by($request->user()?->id ?: resolve('clientIp'))); + RateLimiter::for('credentials', fn (Request $request) => Limit::perMinute(30)->by($request->user()?->id ?: resolve('clientIp'))); } /** @@ -69,34 +63,28 @@ class RouteServiceProvider extends ServiceProvider * * Put this function inside RouteServiceProvider, * and call it in RouteServiceProvider::boot - * - * @return void */ - private function cspReportRoute() + private function cspReportRoute(): void { // * CSP REPORT URI, Please add /csp-report to VerifyCsrfToken $except middleware - \Illuminate\Support\Facades\Route::post('/csp-report', function () { + Route::post('/csp-report', function (): void { $isCspRequest = request()->header('Content-Type') === 'application/csp-report'; - if (!$isCspRequest or !request()->json('csp-report') or !is_array(request()->json('csp-report'))) { - abort(401); - } + abort_if(! $isCspRequest || ! request()->json('csp-report') || ! is_array(request()->json('csp-report')), 401); // * Flatten if needed $cspReport = collect(request()->json('csp-report')) - ->flatMap(function ($v, $k) { - return [$k => is_array($v) ? collect($v)->flatten()->implode(', ') : $v]; - })->all(); + ->flatMap(fn ($v, $k): array => [$k => is_array($v) ? collect($v)->flatten()->implode(', ') : $v])->all(); // * Filter array keys $cspReport = collect(array_intersect_key($cspReport, [ 'blocked-uri' => '', 'document-uri' => '', 'original-policy' => '', - 'referrer' => '', 'violated-directive' => '' + 'referrer' => '', 'violated-directive' => '', ])); - \Illuminate\Support\Facades\Log::warning(sprintf( + Log::warning(sprintf( "CSP REPORT for %s : \n %s", $cspReport->get('document-uri'), $cspReport->implode("\n") )); })->middleware('throttle:5,2') - ->withoutMiddleware(\App\Http\Middleware\VerifyCsrfToken::class) + ->withoutMiddleware(VerifyCsrfToken::class) ->name('cspReportUri'); } } diff --git a/app/Providers/TranslationServiceProvider.php b/app/Providers/TranslationServiceProvider.php index 4849099..1d083ea 100644 --- a/app/Providers/TranslationServiceProvider.php +++ b/app/Providers/TranslationServiceProvider.php @@ -1,10 +1,12 @@ collectLocalesStrings() as $locale) { // * Suported locales - Cache::rememberForever(sprintf('translations.%s', $locale), function () use ($locale) { - $translations = [ - 'php' => $this->phpTranslations($locale), - 'json' => $this->jsonTranslations($locale), - ]; - return $translations; - }); + Cache::rememberForever(sprintf('translations.%s', $locale), fn (): array => [ + 'php' => $this->phpTranslations($locale), + 'json' => $this->jsonTranslations($locale), + ]); } } /** * Gather provided langs checking from files * - * @return \Illuminate\Support\Collection + * @return Collection */ private function collectLocalesStrings(): Collection { return collect(File::allFiles(resource_path('lang/')))->flatMap(function (SplFileInfo $file) { - if ($file->getRelativePath() and \strpos($file->getRelativePath(), 'vendor') !== 0) { + if ($file->getRelativePath() && ! str_starts_with($file->getRelativePath(), 'vendor')) { return [$file->getRelativePath() => '']; } })->keys(); @@ -46,15 +43,15 @@ class TranslationServiceProvider extends ServiceProvider /** * Gather all php translations * - * @param string $locale * @return array */ private function phpTranslations(string $locale): array { $path = resource_path("lang/$locale"); - return collect(File::allFiles($path))->flatMap(function ($file) use ($locale) { + return collect(File::allFiles($path))->flatMap(function ($file) use ($locale): array { $translation = $file->getBasename('.php'); + return [$translation => trans($translation, [], $locale)]; })->all(); } @@ -62,7 +59,6 @@ class TranslationServiceProvider extends ServiceProvider /** * Gather json translations * - * @param string $locale * @return array */ private function jsonTranslations(string $locale): array diff --git a/app/Providers/ViewServiceProvider.php b/app/Providers/ViewServiceProvider.php index 96ab1e4..6e37453 100644 --- a/app/Providers/ViewServiceProvider.php +++ b/app/Providers/ViewServiceProvider.php @@ -1,5 +1,7 @@ runningInConsole()) { + if (! app()->runningInConsole()) { // * View shares // ! Add view file pathes (also needed for console xml job). View::addNamespace('back', resource_path('views')); View::addNamespace('theme', resource_path('theme/mounted/views')); - $appInfos = Cache::remember('composer', 84600, function () { - return json_decode(File::get(\app_path('../composer.json'))); - }); + $appInfos = Cache::remember('composer', 84600, fn (): mixed => json_decode(File::get(\app_path('../composer.json')))); // Share composer.json infos. - if (isset($appInfos->name) and isset($appInfos->version)) { + if (isset($appInfos->name, $appInfos->version)) { View::share('cpsr_name', $appInfos->name); View::share('cpsr_version', $appInfos->version); } @@ -42,14 +40,14 @@ class ViewServiceProvider extends ServiceProvider Paginator::useBootstrapFive(); } - /** @var \App\Models\Settings */ - $settings = app(Settings::class); + /** @var Settings */ + $settings = resolve(Settings::class); // On ramène le nom du jeu et le nom de la société sur toute les pages. View::share('settingsGlobal', $settings); // On ramène aussi tout les prix car on en a besoin sur le header. View::share('prizesGlobal', Prize::getCached()); - } //end if + } // end if } } diff --git a/app/Repositories/Fo/CrmRepository.php b/app/Repositories/Fo/CrmRepository.php index f84870b..24b04b5 100644 --- a/app/Repositories/Fo/CrmRepository.php +++ b/app/Repositories/Fo/CrmRepository.php @@ -1,9 +1,13 @@ api_data; // ? Le compte du joueur est vérifié ? - if (!$crmUser->status) { + if (! $crmUser->status) { // * Le joueur doit avoir un compte vérifié pour participer. response()->redirectToRoute('fo.verification.notice') ->with('error', trans('Pour participer votre compte doit être activé')) ->throwResponse(); } + return $crmUser; } catch (ApiErrorException $e) { // * Customer is not found. @@ -47,11 +50,10 @@ class CrmRepository } catch (HttpResponseException $e) { // * continue this throw $e; - } catch (CrmException | \Exception $e) { + } catch (CrmException | Exception $e) { report($e); // * Retenter ? back()->with('error', trans('Une erreur est survenue, veuillez réssayer.'))->throwResponse(); - } //end try - return back()->withErrors(trans('Une erreur est survenue, merci de réessayer ultérieurement.')); + } // end try } } diff --git a/app/Rules/IsAdult.php b/app/Rules/IsAdult.php index 7bcb192..06a6a49 100644 --- a/app/Rules/IsAdult.php +++ b/app/Rules/IsAdult.php @@ -1,9 +1,14 @@ subYears(18); + // @phpcs:enable + $MJ = Date::now()->subYears(18); if ($this->isIsoFormat($value)) { - $d = Carbon::parse($value); + $d = Date::parse($value); } if ($this->isSqlDate($value)) { - $d = Carbon::createFromFormat('Y-m-d', $value); + $d = Date::createFromFormat('Y-m-d', $value); } if ($this->isFormDate($value)) { - $d = Carbon::createFromFormat('d/m/Y', $value); + $d = Date::createFromFormat('d/m/Y', $value); } // * Could not parse date. - if (!isset($d)) { - throw new \RuntimeException("Could not parse date {$value} for attribute '{$attribute}'."); - } - if (!$d->lessThanOrEqualTo($MJ)) { + throw_unless(isset($d), RuntimeException::class, "Could not parse date {$value} for attribute '{$attribute}'."); + if (! $d->lessThanOrEqualTo($MJ)) { $fail($this->error_message); } } /** * Check if provided string is formatted for mysql - * - * @param string $date - * @return boolean */ - private function isSqlDate(string $date) + private function isSqlDate(string $date): bool { - if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $date)) { - return true; - } - return false; + return (bool) preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $date); } /** * Check if provided string is formatted DD/MM/AAAA - * - * @param string $date - * @return boolean */ - private function isFormDate(string $date) + private function isFormDate(string $date): bool { - if (preg_match("/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-9]{4}$/", $date)) { - return true; - } - return false; + return (bool) preg_match("/^(0[1-9]|[1-2][0-9]|3[0-1])\/(0[1-9]|1[0-2])\/[0-9]{4}$/", $date); } /** * Check if provided string is iso format * * * https://www.w3.org/TR/NOTE-datetime - * - * @param string $date - * @return boolean */ - private function isIsoFormat(string $date) + private function isIsoFormat(string $date): bool { // phpcs:ignore Generic.Files.LineLength.TooLong - if (preg_match("/^(\d{4})(?:-?W(\d+)(?:-?(\d+)D?)?|(?:-(\d+))?-(\d+))(?:[T ](\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?)?(?:Z(-?\d*))?$/", $date)) { - return true; - } - return false; + return (bool) preg_match("/^(\d{4})(?:-?W(\d+)(?:-?(\d+)D?)?|(?:-(\d+))?-(\d+))(?:[T ](\d+):(\d+)(?::(\d+)(?:\.(\d+))?)?)?(?:Z(-?\d*))?$/", $date); } } diff --git a/app/Traits/Controllers/ChangesModelOrder.php b/app/Traits/Controllers/ChangesModelOrder.php index 1797d90..8d2cf96 100644 --- a/app/Traits/Controllers/ChangesModelOrder.php +++ b/app/Traits/Controllers/ChangesModelOrder.php @@ -1,46 +1,45 @@ route()->parameterNames); $className = Str::ucfirst(Str::lower($params->get($params->count() - 2))); $className = "\\App\\Models\\$className"; - if (!class_exists($className)) { - throw new \RuntimeException("The $className class doesn't exist."); - } + throw_unless(class_exists($className), RuntimeException::class, "The $className class doesn't exist."); - /** @var \Illuminate\Database\Eloquent\Model|null */ + /** @var Model|null */ $model = $className::where($model->getRouteKeyName(), $model->getRouteKey())->first(); - if (!$model) { + if (! $model) { return back()->with('error', trans('crud.messages.order_not_changed')); } return DB::transaction(function () use ($request, $className, $model) { - /** @var \Illuminate\Database\Eloquent\Model|null */ + /** @var Model|null */ $tmp = $className::where('order', $request->direction ? '<' : '>', $model->getOriginal('order')) ->orderBy('order', $request->direction ? 'DESC' : 'ASC')->first(); - if (!$tmp) { + if (! $tmp) { return back()->with('error', trans('crud.messages.order_not_changed')); } diff --git a/app/Traits/Controllers/UpdateModelPublished.php b/app/Traits/Controllers/UpdateModelPublished.php index 50d08b8..bfce0dd 100644 --- a/app/Traits/Controllers/UpdateModelPublished.php +++ b/app/Traits/Controllers/UpdateModelPublished.php @@ -21,6 +21,6 @@ trait UpdateModelPublished { $model->update(['published' => ! $model->getOriginal('published')]); - return redirect()->back()->with('success', trans(__('crud.messages.publish_status_saved'))); + return back()->with('success', trans(__('crud.messages.publish_status_saved'))); } } diff --git a/app/Traits/Enums/BaseEnum.php b/app/Traits/Enums/BaseEnum.php index a8734d1..4cdd6c2 100644 --- a/app/Traits/Enums/BaseEnum.php +++ b/app/Traits/Enums/BaseEnum.php @@ -1,8 +1,14 @@ name]; } /** * Get enum label. - * - * @return string */ public function label(): string { @@ -30,8 +32,6 @@ trait BaseEnum /** * Get enum name. - * - * @return string */ public function name(): string { @@ -50,36 +50,37 @@ trait BaseEnum if (empty(self::getCache('labels'))) { $labels = self::getLabelsConstant(); self::setCache('labels', \collect(self::cases()) - ->mapWithKeys(function ($enum) use ($labels) { - if (!\is_null($labels) and !isset($labels[$enum->name])) { - throw new \Error('Missing definition label ' . self::class . " for {$enum->name}"); + ->mapWithKeys(function ($enum) use ($labels): array { + if (! \is_null($labels) && ! isset($labels[$enum->name])) { + throw new Error('Missing definition label ' . self::class . " for {$enum->name}"); } + return [$enum->name => \trans( - !\is_null($labels) ? $labels[$enum->name] : Str::ucfirst($enum->name) + ! \is_null($labels) ? $labels[$enum->name] : Str::ucfirst($enum->name) )]; })->all()); } + return self::getCache('labels'); } /** * Get enum values. * - * @return array + * @return array */ public static function toValues(): array { if (empty(self::getCache('values'))) { self::setCache('values', \collect(self::cases()) - ->mapWithKeys(fn ($enum) => [$enum->name => $enum->value])->all()); + ->mapWithKeys(fn ($enum): array => [$enum->name => $enum->value])->all()); } + return self::getCache('values'); } /** * Get enums. - * - * @return array */ public static function all(): array { @@ -88,176 +89,152 @@ trait BaseEnum /** * Get enums. - * - * @return array */ public static function toArray(): array { if (empty(self::getCache('enums'))) { $definitions = self::getCustomDefinitions(); self::setCache('enums', \collect(self::cases()) - ->mapWithKeys(function ($enum) use ($definitions) { + ->mapWithKeys(function ($enum) use ($definitions): array { $baseArray = [ - 'name' => $enum->name, + 'name' => $enum->name, 'label' => $enum->label(), 'value' => $enum->value, ]; foreach ($definitions as $index => $elements) { $index = Str::lower(Str::singular($index)); - if (!isset($elements[$enum->name])) { - throw new \Error("Missing definition {$index} " . self::class . " for {$enum->name}"); + if (! isset($elements[$enum->name])) { + throw new Error("Missing definition {$index} " . self::class . " for {$enum->name}"); } $baseArray[$index] = $elements[$enum->name]; } + return [$enum->name => (object) $baseArray]; })->all()); } + return self::getCache('enums'); } /** * Fetch enum using value. - * - * @param self|integer|string $value - * @param string $field - * @return self|null */ - public static function make(self|int|string $value, string $field = 'value'): self|null + public static function make(self | int | string $value, string $field = 'value'): ?self { - if ($field === "label") { + if ($field === 'label') { $enumLabels = array_change_key_case(array_flip(self::toLabels()), CASE_LOWER); - $value = (isset($enumLabels[strtolower($value)])) ? $enumLabels[strtolower($value)] : false; + $value = $enumLabels[strtolower($value)] ?? false; $field = 'name'; } - return !\is_object($value) ? + + return ! \is_object($value) ? \collect(self::cases())->keyBy($field)->get($value) : $value; } /** * Test if 2 enum are equals. * - * @param object ...$others - * @return boolean - * @throws \Error If provided element are not enums that extends BaseEnum. + * @throws Error If provided element are not enums that extends BaseEnum. */ public function equals(object ...$others): bool { foreach ($others as $other) { - if (!\in_array(BaseEnum::class, \class_uses_recursive($other))) { - throw new \Error(__METHOD__ . - ' requires $enum to use ' . BaseEnum::class); - } + throw_unless(\in_array(BaseEnum::class, \class_uses_recursive($other)), Error::class, __METHOD__ . + ' requires $enum to use ' . BaseEnum::class); if ( - get_class($this) === get_class($other) + $this::class === $other::class && $this->value === $other->value ) { return true; } } + return false; } /** * Serialize to json. - * - * @return mixed */ public function jsonSerialize(): mixed { return $this->value; } - // * CACHE /** * Get cache array. - * - * @param string $index - * @return array */ private static function getCache(string $index): array { self::initCache(); - if (!isset($GLOBALS[self::class]['props'][$index])) { - $GLOBALS[self::class]['props'][$index] = []; - } + $GLOBALS[self::class]['props'][$index] ??= []; + return $GLOBALS[self::class]['props'][$index]; } /** * Set cache array. - * - * @param string $index - * @param array $items - * @return void */ private static function setCache(string $index, array $items): void { self::initCache(); - if (!isset($GLOBALS[self::class]['props'][$index])) { - $GLOBALS[self::class]['props'][$index] = []; - } + $GLOBALS[self::class]['props'][$index] ??= []; $GLOBALS[self::class]['props'][$index] = $items; } /** * Init cache if needed. - * - * @return void */ private static function initCache(): void { - if (!isset($GLOBALS[self::class])) { - $GLOBALS[self::class] = [ - 'props' => [ - 'enums' => [], - 'values' => [], - 'labels' => [] - ], - 'customProps' => null - ]; - } + $GLOBALS[self::class] ??= [ + 'props' => [ + 'enums' => [], + 'values' => [], + 'labels' => [], + ], + 'customProps' => null, + ]; } // * PRIVATE /** * Fetch the LABELS constant if exists. - * - * @return array|null */ - private static function getLabelsConstant(): array|null + private static function getLabelsConstant(): ?array { $class_name = self::class; try { - $constant_reflex = new \ReflectionClassConstant($class_name, 'LABELS'); + $constant_reflex = new ReflectionClassConstant($class_name, 'LABELS'); + return $constant_reflex->getValue(); - } catch (\ReflectionException $e) { + } catch (ReflectionException) { return null; } } /** * Get custom constants. - * - * @return array */ private static function getCustomDefinitions(): array { // ? Has custom props in cache ? - if (!isset($GLOBALS[self::class]) or \is_null($GLOBALS[self::class]['customProps'])) { + if (! isset($GLOBALS[self::class]) || \is_null($GLOBALS[self::class]['customProps'])) { $names = \collect(self::cases())->keyBy('name'); - $GLOBALS[self::class]['customProps'] = \collect((new \ReflectionClass(self::class))->getConstants()) + $GLOBALS[self::class]['customProps'] = \collect(new ReflectionClass(self::class)->getConstants()) ->filter(function (mixed $constant, string $key) use ($names) { - if ($key === 'LABELS' or !\is_array($constant)) { + if ($key === 'LABELS' || ! \is_array($constant)) { return false; } + return \collect($constant)->keys() ->filter(fn (string $name) => $names->has($name))->count(); })->all(); } + return $GLOBALS[self::class]['customProps']; } } diff --git a/app/Traits/Models/ActivityLog.php b/app/Traits/Models/HasActivityLog.php similarity index 77% rename from app/Traits/Models/ActivityLog.php rename to app/Traits/Models/HasActivityLog.php index 67973e1..fb21cfc 100644 --- a/app/Traits/Models/ActivityLog.php +++ b/app/Traits/Models/HasActivityLog.php @@ -1,5 +1,7 @@ $cacheConditions - * Eloquent condition to cache elements (to be used in where statement). + * @property array $cacheConditions + * Eloquent condition to cache elements (to be used in where statement). */ trait IsCachedAsCollection { @@ -19,25 +21,25 @@ trait IsCachedAsCollection * Get all available instances from cache. * If cache was reset, it will fetch them from DB. * - * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection<(int|string), mixed> + * @return \Illuminate\Database\Eloquent\Collection|Collection<(int|string), mixed> */ public static function getCached(): Collection { - if (!Cache::has(static::getCacheKeyName())) { + if (! Cache::has(static::getCacheKeyName())) { try { static::setCached(); } catch (QueryException $e) { report($e); + return \collect(); } } + return Cache::get(static::getCacheKeyName()); } /** * Remove cached elements - * - * @return void */ public static function removeCached(): void { @@ -46,25 +48,20 @@ trait IsCachedAsCollection /** * Put all instances into cache. - * - * @return void */ protected static function setCached(): void { $conditions = []; - if (property_exists(get_called_class(), 'cacheConditions')) { - $conditions = collect(get_called_class()::${'cacheConditions'})->all(); + if (property_exists(static::class, 'cacheConditions')) { + $conditions = collect(static::class::${'cacheConditions'})->all(); } Cache::put(static::getCacheKeyName(), static::queryCached(static::query()) ->where($conditions)->get() - ->pipe(fn (Collection $collection) => \call_user_func([self::class, 'filterQuery'], $collection))); + ->pipe(fn (Collection $collection): Collection => \call_user_func(self::filterQuery(...), $collection))); } /** * Change query for cached elements - * - * @param \Illuminate\Database\Eloquent\Builder $query - * @return \Illuminate\Database\Eloquent\Builder */ protected static function queryCached(Builder $query): Builder { @@ -73,9 +70,6 @@ trait IsCachedAsCollection /** * Change query for cached elements - * - * @param \Illuminate\Support\Collection $results - * @return \Illuminate\Support\Collection */ protected static function filterQuery(Collection $results): Collection { @@ -84,8 +78,6 @@ trait IsCachedAsCollection /** * Get the class basename - * - * @return string */ protected static function getCacheKeyName(): string { @@ -94,11 +86,9 @@ trait IsCachedAsCollection /** * Get the class basename - * - * @return string */ protected static function getCallClassBaseName(): string { - return str_replace(__NAMESPACE__ . '\\', '', get_called_class()); + return str_replace(__NAMESPACE__ . '\\', '', static::class); } } diff --git a/app/Traits/Models/MiniCrudModel.php b/app/Traits/Models/MiniCrudModel.php deleted file mode 100644 index 09109f1..0000000 --- a/app/Traits/Models/MiniCrudModel.php +++ /dev/null @@ -1,180 +0,0 @@ -setData($attributes['data']); - } - } - - /** - * Apply function on data typed text while on save event - * - * @return void - */ - public function minicrudCreating() - { - /** @var array */ - $data = $this->data; - foreach ($data as &$input) { - switch ($input['inputType']) { - case InputType::text->value: - $input['text'] = clean($input['text']); - $input['text'] = FileStorageHelper::storeModelFilesFromHtml($this, $input['text']); - break; - } //end switch - } //end foreach - $this->data = $data; - } - - /** - * Apply function on data typed text while on update event - * - * @return void - */ - public function minicrudUpdating() - { - $this->minicrudCreating(); - } - - /** - * Apply function on data typed text while on updated event - * - * @return void - */ - public function minicrudUpdated() - { - /** @var array */ - foreach ($this->data as $index => $input) { - switch ($input['inputType']) { - case InputType::text->value: - $original = ToolboxHelper::getOriginal($this, 'data'); - FileStorageHelper::removeOldModelFilesFromHtml( - $input['text'], - $original[$index]['text'] ?? '' - ); - break; - } //end switch - } //end foreach - } - - /** - * Apply function on data typed text while on deleted event - * - * @return void - */ - public function minicrudDeleted() - { - /** @var array */ - foreach ($this->data as $input) { - switch ($input['inputType']) { - case InputType::text->value: - FileStorageHelper::removeModelFilesOfHtml($input['text']); - break; - } //end switch - } //end foreach - } - - /** - * Set a specific prop - * - * @param array $data - * @return void - */ - private function setData(array $data): void - { - $attrs = $this->attributes; - if (isset($attrs['data'])) { - unset($attrs['data']); - } - $this->setAttribute('data', $data); - } - - /** - * Set a specific prop - * - * @param array $value - * @return void - */ - protected function setDataAttribute(array $value): void - { - $this->attributes['data'] = $this->castAttributeAsJson( - 'data', - $this->serializeData($value) - ); - } - - /** - * Set a specific prop - * - * @param string|null $data - * @return array - */ - protected function getDataAttribute(string|null $data): array - { - return $this->fromJson($data ?? $this->attributes['data'] ?? '[]'); - } - - /** - * Serialize properties - * - * @param array $data - * @return array - * @throws \ErrorException If input type is no handled. - * @throws \Illuminate\Validation\ValidationException If url is a bo url. - * @phpcs:disable Squiz.Commenting.FunctionCommentThrowTag.WrongNumber - * @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh - */ - private function serializeData(array $data): array - { - foreach ($data as $o => $input) { - switch ($input['inputType']) { - case InputType::image->value: - $data[$o]['value'] = \preg_replace( - '/^\/|^/', - '', - FileStorageHelper::storeFile($this, $input['value'], true) - ); - break; - case InputType::selectEnum->value: - case InputType::boolean->value: - case InputType::password->value: - case InputType::email->value: - case InputType::number->value: - case InputType::videoVimeo->value: - case InputType::videoYoutube->value: - case InputType::video->value: - break; - case InputType::string->value: - case InputType::text->value: - case InputType::url->value: - ToolboxHelper::assertNoInternalBoUrls('content', $input['value']); - break; - default: - throw new \ErrorException(sprintf( - 'Unknown input Type %s', - $input['inputType'] - )); - } //end switch - } //end foreach - return $data; - } -} diff --git a/app/Traits/Requests/HasPicture.php b/app/Traits/Requests/HasPicture.php index e48750b..9aa5158 100644 --- a/app/Traits/Requests/HasPicture.php +++ b/app/Traits/Requests/HasPicture.php @@ -1,5 +1,7 @@ $minWith ?? $this->minWith, + 'minWith' => $minWith ?? $this->minWith, 'minHeight' => $minHeight ?? $this->minHeight, - 'maxWith' => $maxWith ?? $this->maxWith, - 'maxHeight' => $maxHeight ?? $this->maxHeight + 'maxWith' => $maxWith ?? $this->maxWith, + 'maxHeight' => $maxHeight ?? $this->maxHeight, ]; + return [ $name => [ - !$nullable ? 'required' : 'nullable', - function (string $attribute, $value, callable $fail) use ($sizes) { + ! $nullable ? 'required' : 'nullable', + function (string $attribute, ?string $value, callable $fail) use ($sizes): void { ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes); - } - ] + }, + ], ]; } /** * Images rules - * - * @param string $name - * @param integer|null $minWith - * @param integer|null $minHeight - * @param integer|null $maxWith - * @param integer|null $maxHeight - * @return array */ public function picturesRules( string $name = 'pictures', @@ -90,28 +78,26 @@ trait HasPicture ?int $maxHeight = null ): array { $sizes = (object) [ - 'minWith' => $minWith ?? $this->minWith, + 'minWith' => $minWith ?? $this->minWith, 'minHeight' => $minHeight ?? $this->minHeight, - 'maxWith' => $maxWith ?? $this->maxWith, - 'maxHeight' => $maxHeight ?? $this->maxHeight + 'maxWith' => $maxWith ?? $this->maxWith, + 'maxHeight' => $maxHeight ?? $this->maxHeight, ]; + return [ - $name => 'sometimes|array', - "{$name}Validate" => "required_with:{$name}|array", + $name => 'sometimes|array', + "{$name}Validate" => "required_with:{$name}|array", "{$name}Validate.*" => [ 'required', - function (string $attribute, $value, callable $fail) use ($sizes) { + function (string $attribute, ?string $value, callable $fail) use ($sizes): void { ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes); - } - ] + }, + ], ]; } /** * Merges products pictures fields with request data - * - * @param string $name - * @return void */ protected function mergePicture(string $name = 'picture'): void { @@ -122,6 +108,7 @@ trait HasPicture if ($picturePath === 'false') { // * Empty picture and exit $this->merge([$name => []]); + return; } $decodedPath = \urldecode($picturePath); @@ -129,20 +116,17 @@ trait HasPicture "{$name}Validate" => array_merge( $this->{"{$name}Validate"}, [\public_path(ltrim($decodedPath, '/'))] - ) + ), ]); $changedPicture = ltrim($decodedPath, '/'); $this->merge([ - $name => $changedPicture + $name => $changedPicture, ]); - } //end if + } // end if } /** * Merges products pictures fields with request data - * - * @param string $name - * @return void */ protected function mergePictures(string $name = 'pictures'): void { @@ -154,6 +138,7 @@ trait HasPicture if ($picturePath === 'false') { // * Empty picture and exit $this->merge([$name => []]); + return; } $decodedPath = \urldecode($picturePath); @@ -161,14 +146,14 @@ trait HasPicture "{$name}Validate" => array_merge( $this->{"{$name}Validate"}, [\public_path(ltrim($decodedPath, '/'))] - ) + ), ]); $changedPicture = $this->{$name}; $changedPicture[$key] = ltrim($decodedPath, '/'); $this->merge([ - $name => $changedPicture + $name => $changedPicture, ]); } - } //end if + } // end if } } diff --git a/bootstrap/app.php b/bootstrap/app.php index 037e17d..237c8f8 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,5 +1,13 @@ singleton( - Illuminate\Contracts\Http\Kernel::class, - App\Http\Kernel::class + \Illuminate\Contracts\Http\Kernel::class, + Kernel::class ); $app->singleton( - Illuminate\Contracts\Console\Kernel::class, - App\Console\Kernel::class + \Illuminate\Contracts\Console\Kernel::class, + \App\Console\Kernel::class ); $app->singleton( - Illuminate\Contracts\Debug\ExceptionHandler::class, - App\Exceptions\Handler::class + ExceptionHandler::class, + Handler::class ); /* @@ -50,6 +58,6 @@ $app->singleton( | the calling script so we can separate the building of the instances | from the actual running of the application and sending responses. | -*/ + */ return $app; diff --git a/composer.json b/composer.json index cd8d5c1..5d4e452 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ ], "license": "MIT", "require": { - "php": "^8.2", + "php": "^8.5", "axlon/laravel-postal-code-validation": "^3.4", "diglactic/laravel-breadcrumbs": "^10.0", "guzzlehttp/guzzle": "^7.2", @@ -30,13 +30,16 @@ "uwil/sitemap-generator": "^5.0" }, "require-dev": { + "driftingly/rector-laravel": "^2.6", "fakerphp/faker": "^1.9.1", - "larastan/larastan": "^2.8", - "laravel-lang/common": "^4.0", + "larastan/larastan": "^3.10", + "laravel-lang/common": "^6.0", "laravel/pint": "^1.0", "laravel/sail": "^1.18", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^8.1", + "pestphp/pest": "^3.8", + "phpstan/phpstan-webmozart-assert": "^2.0", "phpunit/phpunit": "^11.0", "slevomat/coding-standard": "^8.10", "spatie/laravel-ignition": "^2.0", diff --git a/composer.lock b/composer.lock index 1cc523c..9c6ce32 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "149149c6436a7c1a9de79d093b1018ca", + "content-hash": "b1941a8c90033e6d40c19954d05a1af7", "packages": [ { "name": "axlon/laravel-postal-code-validation", @@ -8129,28 +8129,35 @@ "packages-dev": [ { "name": "archtechx/enums", - "version": "v0.3.2", + "version": "v1.1.2", "source": { "type": "git", "url": "https://github.com/archtechx/enums.git", - "reference": "475f45e682b0771253707f9403b704759a08da5f" + "reference": "81375b71c176f680880a95e7448d84258cfb5c72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/archtechx/enums/zipball/475f45e682b0771253707f9403b704759a08da5f", - "reference": "475f45e682b0771253707f9403b704759a08da5f", + "url": "https://api.github.com/repos/archtechx/enums/zipball/81375b71c176f680880a95e7448d84258cfb5c72", + "reference": "81375b71c176f680880a95e7448d84258cfb5c72", "shasum": "" }, "require": { "php": "^8.1" }, "require-dev": { - "nunomaduro/larastan": "^1.0|^2.4", - "orchestra/testbench": "^6.9|^7.0|^8.0", - "pestphp/pest": "^1.2|^2.0", - "pestphp/pest-plugin-laravel": "^1.0|^2.0" + "larastan/larastan": "^2.4", + "orchestra/testbench": "^8.0 || ^9.0", + "pestphp/pest": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0" }, "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, "autoload": { "psr-4": { "ArchTech\\Enums\\": "src/" @@ -8169,9 +8176,317 @@ "description": "Helpers for making PHP enums more lovable.", "support": { "issues": "https://github.com/archtechx/enums/issues", - "source": "https://github.com/archtechx/enums/tree/v0.3.2" + "source": "https://github.com/archtechx/enums/tree/v1.1.2" }, - "time": "2023-02-15T13:05:41+00:00" + "time": "2025-06-06T23:15:09+00:00" + }, + { + "name": "brianium/paratest", + "version": "v7.8.5", + "source": { + "type": "git", + "url": "https://github.com/paratestphp/paratest.git", + "reference": "9b324c8fc319cf9728b581c7a90e1c8f6361c5e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/9b324c8fc319cf9728b581c7a90e1c8f6361c5e5", + "reference": "9b324c8fc319cf9728b581c7a90e1c8f6361c5e5", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-simplexml": "*", + "fidry/cpu-core-counter": "^1.3.0", + "jean85/pretty-package-versions": "^2.1.1", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "phpunit/php-code-coverage": "^11.0.12", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-timer": "^7.0.1", + "phpunit/phpunit": "^11.5.46", + "sebastian/environment": "^7.2.1", + "symfony/console": "^6.4.22 || ^7.3.4 || ^8.0.3", + "symfony/process": "^6.4.20 || ^7.3.4 || ^8.0.3" + }, + "require-dev": { + "doctrine/coding-standard": "^12.0.0", + "ext-pcov": "*", + "ext-posix": "*", + "phpstan/phpstan": "^2.1.33", + "phpstan/phpstan-deprecation-rules": "^2.0.3", + "phpstan/phpstan-phpunit": "^2.0.11", + "phpstan/phpstan-strict-rules": "^2.0.7", + "squizlabs/php_codesniffer": "^3.13.5", + "symfony/filesystem": "^6.4.13 || ^7.3.2 || ^8.0.1" + }, + "bin": [ + "bin/paratest", + "bin/paratest_for_phpstorm" + ], + "type": "library", + "autoload": { + "psr-4": { + "ParaTest\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Scaturro", + "email": "scaturrob@gmail.com", + "role": "Developer" + }, + { + "name": "Filippo Tessarotto", + "email": "zoeslam@gmail.com", + "role": "Developer" + } + ], + "description": "Parallel testing for PHP", + "homepage": "https://github.com/paratestphp/paratest", + "keywords": [ + "concurrent", + "parallel", + "phpunit", + "testing" + ], + "support": { + "issues": "https://github.com/paratestphp/paratest/issues", + "source": "https://github.com/paratestphp/paratest/tree/v7.8.5" + }, + "funding": [ + { + "url": "https://github.com/sponsors/Slamdunk", + "type": "github" + }, + { + "url": "https://paypal.me/filippotessarotto", + "type": "paypal" + } + ], + "time": "2026-01-08T08:02:38+00:00" + }, + { + "name": "codezero/browser-locale", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/codezero-be/browser-locale.git", + "reference": "dd6c50e5557b06b57960df6db7f52e85ef683e5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/codezero-be/browser-locale/zipball/dd6c50e5557b06b57960df6db7f52e85ef683e5e", + "reference": "dd6c50e5557b06b57960df6db7f52e85ef683e5e", + "shasum": "" + }, + "require": { + "php": "^7.0|^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.3.3", + "phpunit/phpunit": "^6.0|^7.0|^8.0|^9.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "CodeZero\\BrowserLocale\\Laravel\\BrowserLocaleServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "CodeZero\\BrowserLocale\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ivan Vermeyen", + "email": "ivan@codezero.be" + } + ], + "description": "Get the most preferred locales from your visitor's browser.", + "keywords": [ + "browser", + "country", + "detect", + "language", + "locale", + "php", + "website" + ], + "support": { + "issues": "https://github.com/codezero-be/browser-locale/issues", + "source": "https://github.com/codezero-be/browser-locale/tree/3.4.0" + }, + "funding": [ + { + "url": "https://paypal.me/ivanvermeyen", + "type": "custom" + }, + { + "url": "https://ko-fi.com/ivanvermeyen", + "type": "ko_fi" + } + ], + "time": "2024-03-02T12:51:17+00:00" + }, + { + "name": "composer/class-map-generator", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/composer/class-map-generator.git", + "reference": "c0efbeb2f3fd7e23c7f180a59765c0b48a31fbc4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/c0efbeb2f3fd7e23c7f180a59765c0b48a31fbc4", + "reference": "c0efbeb2f3fd7e23c7f180a59765c0b48a31fbc4", + "shasum": "" + }, + "require": { + "composer/pcre": "^2.1 || ^3.1", + "php": "^7.2 || ^8.0", + "symfony/finder": "^4.4 || ^5.3 || ^6 || ^7 || ^8" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-deprecation-rules": "^1 || ^2", + "phpstan/phpstan-phpunit": "^1 || ^2", + "phpstan/phpstan-strict-rules": "^1.1 || ^2", + "phpunit/phpunit": "^8", + "symfony/filesystem": "^5.4 || ^6 || ^7 || ^8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\ClassMapGenerator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Utilities to scan PHP code and generate class maps.", + "keywords": [ + "classmap" + ], + "support": { + "issues": "https://github.com/composer/class-map-generator/issues", + "source": "https://github.com/composer/class-map-generator/tree/1.8.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-09-25T15:24:19+00:00" + }, + { + "name": "composer/pcre", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "d5a341b3fb61f3001970940afb1d332968a183ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/d5a341b3fb61f3001970940afb1d332968a183ed", + "reference": "d5a341b3fb61f3001970940afb1d332968a183ed", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<2.2.2" + }, + "require-dev": { + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.4.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2026-06-07T11:47:49+00:00" }, { "name": "composer/semver", @@ -8346,6 +8661,54 @@ ], "time": "2026-05-06T08:26:05+00:00" }, + { + "name": "doctrine/deprecations", + "version": "1.1.6", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=14" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^12 || ^14", + "phpstan/phpstan": "1.4.10 || 2.1.30", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0", + "psr/log": "^1 || ^2 || ^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.6" + }, + "time": "2026-02-07T07:09:04+00:00" + }, { "name": "dragon-code/contracts", "version": "2.25.0", @@ -8573,6 +8936,64 @@ ], "time": "2026-04-03T15:06:29+00:00" }, + { + "name": "driftingly/rector-laravel", + "version": "2.6.2", + "source": { + "type": "git", + "url": "https://github.com/driftingly/rector-laravel.git", + "reference": "c0f9a2ff7365cec45d4dc64223608e7cec74604a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/c0f9a2ff7365cec45d4dc64223608e7cec74604a", + "reference": "c0f9a2ff7365cec45d4dc64223608e7cec74604a", + "shasum": "" + }, + "require": { + "php": ">=8.3", + "rector/rector": "^2.6.4", + "symplify/rule-doc-generator-contracts": "^11.2", + "webmozart/assert": "^1.11 || ^2.0" + }, + "require-dev": { + "boundwize/structarmed": "^0.16", + "nette/utils": "^4.0", + "nikic/php-parser": "^5.6", + "phpstan/extension-installer": "^1.3", + "phpstan/phpstan": "^2.2", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpstan/phpstan-webmozart-assert": "^2.0", + "phpunit/phpunit": "^10.5", + "symplify/rule-doc-generator": "^12.2", + "tightenco/duster": "^3.1", + "tracy/tracy": "^2.10" + }, + "type": "rector-extension", + "extra": { + "rector": { + "includes": [ + "config/config.php" + ] + } + }, + "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.6.2" + }, + "time": "2026-08-29T21:42:57+00:00" + }, { "name": "fakerphp/faker", "version": "v1.24.1", @@ -8636,6 +9057,68 @@ }, "time": "2024-11-21T13:46:39+00:00" }, + { + "name": "fidry/cpu-core-counter", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "d384a7d0d6e67aa497327260ca95023e92dc2032" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/d384a7d0d6e67aa497327260ca95023e92dc2032", + "reference": "d384a7d0d6e67aa497327260ca95023e92dc2032", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0 || ^1.1.2", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "symfony/polyfill-mbstring": "^1.33", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.4.1" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2026-09-29T22:11:39+00:00" + }, { "name": "filp/whoops", "version": "2.18.5", @@ -8764,16 +9247,16 @@ }, { "name": "iamcal/sql-parser", - "version": "v0.5", + "version": "v0.7", "source": { "type": "git", "url": "https://github.com/iamcal/SQLParser.git", - "reference": "644fd994de3b54e5d833aecf406150aa3b66ca88" + "reference": "610392f38de49a44dab08dc1659960a29874c4b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/iamcal/SQLParser/zipball/644fd994de3b54e5d833aecf406150aa3b66ca88", - "reference": "644fd994de3b54e5d833aecf406150aa3b66ca88", + "url": "https://api.github.com/repos/iamcal/SQLParser/zipball/610392f38de49a44dab08dc1659960a29874c4b8", + "reference": "610392f38de49a44dab08dc1659960a29874c4b8", "shasum": "" }, "require-dev": { @@ -8799,49 +9282,49 @@ "description": "MySQL schema parser", "support": { "issues": "https://github.com/iamcal/SQLParser/issues", - "source": "https://github.com/iamcal/SQLParser/tree/v0.5" + "source": "https://github.com/iamcal/SQLParser/tree/v0.7" }, - "time": "2024-03-22T22:46:32+00:00" + "time": "2026-01-28T22:20:33+00:00" }, { "name": "larastan/larastan", - "version": "v2.11.2", + "version": "v3.12.2", "source": { "type": "git", "url": "https://github.com/larastan/larastan.git", - "reference": "1aae902a5851c03dc1a58cbd9010a0c3ef8def63" + "reference": "c328727e6103c1147d1c64cc96b3aedfda26bc20" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/larastan/larastan/zipball/1aae902a5851c03dc1a58cbd9010a0c3ef8def63", - "reference": "1aae902a5851c03dc1a58cbd9010a0c3ef8def63", + "url": "https://api.github.com/repos/larastan/larastan/zipball/c328727e6103c1147d1c64cc96b3aedfda26bc20", + "reference": "c328727e6103c1147d1c64cc96b3aedfda26bc20", "shasum": "" }, "require": { - "ext-json": "*", - "iamcal/sql-parser": "^0.5.0", - "illuminate/console": "^9.52.20 || ^10.48.28 || ^11.41.3", - "illuminate/container": "^9.52.20 || ^10.48.28 || ^11.41.3", - "illuminate/contracts": "^9.52.20 || ^10.48.28 || ^11.41.3", - "illuminate/database": "^9.52.20 || ^10.48.28 || ^11.41.3", - "illuminate/http": "^9.52.20 || ^10.48.28 || ^11.41.3", - "illuminate/pipeline": "^9.52.20 || ^10.48.28 || ^11.41.3", - "illuminate/support": "^9.52.20 || ^10.48.28 || ^11.41.3", - "php": "^8.0.2", - "phpstan/phpstan": "^1.12.17" + "iamcal/sql-parser": "^0.7.0", + "illuminate/console": "^11.44.2 || ^12.4.1 || ^13", + "illuminate/container": "^11.44.2 || ^12.4.1 || ^13", + "illuminate/contracts": "^11.44.2 || ^12.4.1 || ^13", + "illuminate/database": "^11.44.2 || ^12.4.1 || ^13", + "illuminate/http": "^11.44.2 || ^12.4.1 || ^13", + "illuminate/pipeline": "^11.44.2 || ^12.4.1 || ^13", + "illuminate/support": "^11.44.2 || ^12.4.1 || ^13", + "php": "^8.2", + "phpstan/phpstan": "^2.2.14" }, "require-dev": { - "doctrine/coding-standard": "^13", - "laravel/framework": "^9.52.20 || ^10.48.28 || ^11.41.3", - "mockery/mockery": "^1.5.1", - "nikic/php-parser": "^4.19.1", - "orchestra/canvas": "^7.11.1 || ^8.11.0 || ^9.0.2", - "orchestra/testbench-core": "^7.33.0 || ^8.13.0 || ^9.0.9", - "phpstan/phpstan-deprecation-rules": "^1.2", - "phpunit/phpunit": "^9.6.13 || ^10.5.16" + "doctrine/coding-standard": "^14", + "laravel/framework": "^11.44.2 || ^12.7.2 || ^13", + "mockery/mockery": "^1.6.12", + "nikic/php-parser": "^5.4", + "orchestra/canvas": "^v9.2.2 || ^10.0.1 || ^11", + "orchestra/testbench-core": "^9.12.0 || ^10.1 || ^11", + "phpstan/phpstan-deprecation-rules": "^2.0.1", + "phpunit/phpunit": "^10.5.35 || ^11.5.15 || ^12.5.8 || ^13.3.0" }, "suggest": { - "orchestra/testbench": "Using Larastan for analysing a package needs Testbench" + "orchestra/testbench": "Using Larastan for analysing a package needs Testbench", + "phpmyadmin/sql-parser": "Install to enable Larastan's optional phpMyAdmin-based SQL parser automatically" }, "type": "phpstan-extension", "extra": { @@ -8851,7 +9334,7 @@ ] }, "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -8882,7 +9365,7 @@ ], "support": { "issues": "https://github.com/larastan/larastan/issues", - "source": "https://github.com/larastan/larastan/tree/v2.11.2" + "source": "https://github.com/larastan/larastan/tree/v3.12.2" }, "funding": [ { @@ -8890,7 +9373,84 @@ "type": "github" } ], - "time": "2025-06-10T22:06:33+00:00" + "time": "2026-09-19T10:46:58+00:00" + }, + { + "name": "laravel-lang/actions", + "version": "1.13.2", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/actions.git", + "reference": "5e9bbd3b8af3fed4b733e424c56810b0d3e81377" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/actions/zipball/5e9bbd3b8af3fed4b733e424c56810b0d3e81377", + "reference": "5e9bbd3b8af3fed4b733e424c56810b0d3e81377", + "shasum": "" + }, + "require": { + "ext-json": "*", + "laravel-lang/publisher": "^14.0 || ^15.0 || ^16.0", + "php": "^8.1" + }, + "require-dev": { + "laravel-lang/status-generator": "^2.3.1", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "symfony/var-dumper": "^6.3 || ^7.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\Actions\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\Actions\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://dragon-code.pro" + }, + { + "name": "Laravel Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "Translation of buttons and other action elements", + "keywords": [ + "actions", + "buttons", + "lang", + "languages", + "laravel", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/actions/issues", + "source": "https://github.com/Laravel-Lang/actions/tree/1.13.2" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-05-30T12:11:11+00:00" }, { "name": "laravel-lang/attributes", @@ -8973,29 +9533,37 @@ }, { "name": "laravel-lang/common", - "version": "v4.0.0", + "version": "6.8.0", "source": { "type": "git", "url": "https://github.com/Laravel-Lang/common.git", - "reference": "31744c7f64610990a77c7705e590e04c1fca372d" + "reference": "f1e3383f94c4f157f0f41324792382bf2dd84d52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Laravel-Lang/common/zipball/31744c7f64610990a77c7705e590e04c1fca372d", - "reference": "31744c7f64610990a77c7705e590e04c1fca372d", + "url": "https://api.github.com/repos/Laravel-Lang/common/zipball/f1e3383f94c4f157f0f41324792382bf2dd84d52", + "reference": "f1e3383f94c4f157f0f41324792382bf2dd84d52", "shasum": "" }, "require": { - "laravel-lang/attributes": "^2.3.3", - "laravel-lang/http-statuses": "^3.3.1", - "laravel-lang/lang": "^13.0", - "laravel-lang/publisher": "^14.6.4", + "laravel-lang/actions": "^1.9", + "laravel-lang/attributes": "^2.12", + "laravel-lang/http-statuses": "^3.8", + "laravel-lang/json-fallback": "^2.2", + "laravel-lang/lang": "^13.12 || ^14.0 || ^15.5.1", + "laravel-lang/locales": "^2.10", + "laravel-lang/models": "^1.3", + "laravel-lang/moonshine": "^1.2", + "laravel-lang/publisher": "^16.5", + "laravel-lang/routes": "^1.7", + "laravel-lang/starter-kits": "^1.0", "php": "^8.1" }, "require-dev": { - "orchestra/testbench": "^8.5 || ^9.0", - "phpunit/phpunit": "^10.0", - "symfony/var-dumper": "^6.3" + "dragon-code/support": "^6.13", + "orchestra/testbench": "^8.17 || ^9.1.2 || ^10.0 || ^11.0", + "phpunit/phpunit": "^10.5.20 || ^11.0 || ^12.0", + "symfony/var-dumper": "^6.4 || ^7.1.1 || ^8.0" }, "type": "library", "notification-url": "https://packagist.org/downloads/", @@ -9010,15 +9578,17 @@ { "name": "Andrey Helldar", "email": "helldar@dragon-code.pro", - "homepage": "https://github.com/andrey-helldar" + "homepage": "https://dragon-code.pro" } ], "description": "Easily connect the necessary language packs to the application", "keywords": [ "Laravel-lang", + "actions", "attribute", "attributes", "breeze", + "buttons", "cashier", "fortify", "framework", @@ -9033,6 +9603,9 @@ "laravel", "locale", "locales", + "localization", + "localizations", + "moonshine", "nova", "publisher", "spark", @@ -9046,11 +9619,89 @@ }, "funding": [ { - "url": "https://opencollective.com/laravel-lang", - "type": "open_collective" + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" } ], - "time": "2023-08-09T09:24:50+00:00" + "time": "2026-03-17T23:15:14+00:00" + }, + { + "name": "laravel-lang/config", + "version": "1.17.1", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/config.git", + "reference": "7970b89045998b73aab4ffd99a04c6f7f5b3f4f8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/config/zipball/7970b89045998b73aab4ffd99a04c6f7f5b3f4f8", + "reference": "7970b89045998b73aab4ffd99a04c6f7f5b3f4f8", + "shasum": "" + }, + "require": { + "archtechx/enums": "^1.0", + "illuminate/config": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/locale-list": "^1.6", + "php": "^8.1" + }, + "require-dev": { + "orchestra/testbench": "^8.23 || ^9.1 || ^10.0 || ^11.0", + "pestphp/pest": "^2.34 || ^3.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\Config\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\Config\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://dragon-code.pro" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "The Laravel-Lang config package", + "keywords": [ + "Laravel-lang", + "Settings", + "config", + "lang", + "languages", + "laravel", + "locale", + "locales", + "localization", + "localizations", + "translation", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/config/issues", + "source": "https://github.com/Laravel-Lang/config/tree/1.17.1" + }, + "time": "2026-09-20T09:41:38+00:00" }, { "name": "laravel-lang/http-statuses", @@ -9130,28 +9781,93 @@ "time": "2026-05-30T12:11:06+00:00" }, { - "name": "laravel-lang/lang", - "version": "13.12.1", + "name": "laravel-lang/json-fallback", + "version": "2.3.0", "source": { "type": "git", - "url": "https://github.com/Laravel-Lang/lang.git", - "reference": "25a5a07b635f0694cb34a37b58cfb78d0f4ee19e" + "url": "https://github.com/Laravel-Lang/json-fallback.git", + "reference": "1b02c798da837c63e2d01f45b45bb49367d5b6a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Laravel-Lang/lang/zipball/25a5a07b635f0694cb34a37b58cfb78d0f4ee19e", - "reference": "25a5a07b635f0694cb34a37b58cfb78d0f4ee19e", + "url": "https://api.github.com/repos/Laravel-Lang/json-fallback/zipball/1b02c798da837c63e2d01f45b45bb49367d5b6a1", + "reference": "1b02c798da837c63e2d01f45b45bb49367d5b6a1", + "shasum": "" + }, + "require": { + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/translation": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "php": "^8.1" + }, + "require-dev": { + "orchestra/testbench": "^8.0 || ^9.0 || ^10.0 || ^11.0", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaravelLang\\JsonFallback\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://github.com/andrey-helldar" + }, + { + "name": "Felipe Dsdev", + "homepage": "https://github.com/felipe-dsdev" + } + ], + "description": "Adds support for fallback JSON string translation", + "support": { + "issues": "https://github.com/Laravel-Lang/json-fallback/issues", + "source": "https://github.com/Laravel-Lang/json-fallback/tree/2.3.0" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-03-17T21:18:08+00:00" + }, + { + "name": "laravel-lang/lang", + "version": "15.37.3", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/lang.git", + "reference": "a3504212776c77984273beb9b7ef9ecbacc2e4e4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/lang/zipball/a3504212776c77984273beb9b7ef9ecbacc2e4e4", + "reference": "a3504212776c77984273beb9b7ef9ecbacc2e4e4", "shasum": "" }, "require": { "ext-json": "*", - "laravel-lang/publisher": "^14.0 || ^15.0 || ^16.0", - "php": "^8.1" + "laravel-lang/publisher": "^16.0", + "php": "^8.2" + }, + "conflict": { + "laravel/framework": "<11.0.7" }, "require-dev": { - "laravel-lang/status-generator": "^1.19 || ^2.0", - "phpunit/phpunit": "^10.0", - "symfony/var-dumper": "^6.0 || ^7.0" + "dragon-code/codestyler": "^6.0", + "laravel-lang/status-generator": "^2.11", + "phpunit/phpunit": "^11.0 || ^12.0", + "symfony/var-dumper": "^7.0" }, "type": "library", "extra": { @@ -9176,7 +9892,7 @@ "homepage": "https://github.com/Laravel-Lang" } ], - "description": "List of 78 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI", + "description": "List of 126 languages for Laravel Framework, Laravel Jetstream, Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova, Laravel Spark and Laravel UI", "keywords": [ "lang", "languages", @@ -9187,64 +9903,127 @@ "issues": "https://github.com/Laravel-Lang/lang/issues", "source": "https://github.com/Laravel-Lang/lang" }, - "time": "2023-12-16T17:26:12+00:00" + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-10-01T08:03:34+00:00" }, { - "name": "laravel-lang/publisher", - "version": "14.7.1", + "name": "laravel-lang/locale-list", + "version": "1.7.0", "source": { "type": "git", - "url": "https://github.com/Laravel-Lang/publisher.git", - "reference": "946405e3d8c7105b0ae8cf8de34a3e6e98a70a84" + "url": "https://github.com/Laravel-Lang/locale-list.git", + "reference": "48e61c7f0a957420d4aaf5d35653889c25c4e2d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Laravel-Lang/publisher/zipball/946405e3d8c7105b0ae8cf8de34a3e6e98a70a84", - "reference": "946405e3d8c7105b0ae8cf8de34a3e6e98a70a84", + "url": "https://api.github.com/repos/Laravel-Lang/locale-list/zipball/48e61c7f0a957420d4aaf5d35653889c25c4e2d4", + "reference": "48e61c7f0a957420d4aaf5d35653889c25c4e2d4", "shasum": "" }, "require": { - "archtechx/enums": "^0.3", - "composer/semver": "^3.3", - "dragon-code/pretty-array": "^4.0", - "dragon-code/support": "^6.3", - "ext-json": "*", - "illuminate/console": "^8.79 || ^9.18 || ^10.0 || ^11.0", - "illuminate/support": "^8.79 || ^9.18 || ^10.0 || ^11.0", - "league/commonmark": "^2.3", - "league/config": "^1.2", + "archtechx/enums": "^0.3.2 || ^1.0", "php": "^8.1" }, - "conflict": { - "laravel-lang/attributes": "<2.0", - "laravel-lang/http-statuses": "<3.0", - "laravel-lang/lang": "<11.0" + "type": "library", + "autoload": { + "psr-4": { + "LaravelLang\\LocaleList\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://dragon-code.pro" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "List of localizations available in Laravel Lang projects", + "keywords": [ + "Laravel-lang", + "lang", + "languages", + "laravel", + "locale", + "locales", + "localization", + "translation", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/locale-list/issues", + "source": "https://github.com/Laravel-Lang/locale-list" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-01-20T08:17:15+00:00" + }, + { + "name": "laravel-lang/locales", + "version": "2.11.0", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/locales.git", + "reference": "761aa3cfbc5bbe29eb958c9839e7dd3806193bac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/locales/zipball/761aa3cfbc5bbe29eb958c9839e7dd3806193bac", + "reference": "761aa3cfbc5bbe29eb958c9839e7dd3806193bac", + "shasum": "" + }, + "require": { + "archtechx/enums": "^0.3.2 || ^1.0", + "dragon-code/support": "^6.11.3", + "ext-json": "*", + "illuminate/collections": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/config": "^1.12", + "laravel-lang/locale-list": "^1.5", + "laravel-lang/native-country-names": "^1.5", + "laravel-lang/native-currency-names": "^1.6", + "laravel-lang/native-locale-names": "^2.5", + "php": "^8.1" }, "require-dev": { - "laravel-lang/json-fallback-hotfix": "^1.0", - "orchestra/testbench": "^6.25 || ^7.22 || ^8.0 || ^9.0", - "phpunit/phpunit": "^9.6 || ^10.0", - "symfony/var-dumper": "^5.0 || ^6.0" - }, - "suggest": { - "laravel-lang/attributes": "List of 78 languages for form field names", - "laravel-lang/http-statuses": "List of 78 languages for HTTP statuses", - "laravel-lang/lang": "List of 78 languages for Laravel Framework, Jetstream, Fortify, Breeze, Cashier, Nova, Spark and UI." + "orchestra/testbench": "^8.0 || ^9.0 || ^10.0 || ^11.0", + "pestphp/pest": "^2.24.1 || ^3.0 || ^4.0", + "symfony/var-dumper": "^6.0 || ^7.0" }, "type": "library", "extra": { "laravel": { "providers": [ - "LaravelLang\\Publisher\\ServiceProvider" + "LaravelLang\\Locales\\ServiceProvider" ] } }, "autoload": { - "files": [ - "helper.php" - ], "psr-4": { - "LaravelLang\\Publisher\\": "src" + "LaravelLang\\Locales\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -9256,13 +10035,504 @@ "name": "Andrey Helldar", "email": "helldar@dragon-code.pro" }, + { + "name": "Laravel-Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "Basic functionality for working with localizations", + "keywords": [ + "laravel", + "locale", + "locales", + "localization", + "translation", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/locales/issues", + "source": "https://github.com/Laravel-Lang/locales" + }, + "time": "2026-03-17T22:40:41+00:00" + }, + { + "name": "laravel-lang/models", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/models.git", + "reference": "a9aa0205ca019f4459ace26b0432b3b6d1886f66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/models/zipball/a9aa0205ca019f4459ace26b0432b3b6d1886f66", + "reference": "a9aa0205ca019f4459ace26b0432b3b6d1886f66", + "shasum": "" + }, + "require": { + "composer/class-map-generator": "^1.3", + "dragon-code/support": "^6.13", + "illuminate/database": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/config": "^1.12", + "laravel-lang/locales": "^2.10.0", + "laravel/prompts": ">=0.1", + "php": "^8.1" + }, + "require-dev": { + "laravel/pint": "^1.20", + "orchestra/testbench": "^8.0 || ^9.0 || ^10.0 || ^11.0", + "pestphp/pest": "^2.34 || ^3.0 || ^4.0", + "pestphp/pest-plugin-laravel": "^2.4 || ^3.0 || ^4.0", + "symfony/var-dumper": "^6.0 || ^7.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\Models\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\Models\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://dragon-code.pro", + "role": "Maintainer" + }, + { + "name": "Andrey Sokolov", + "email": "walfireru@gmail.com", + "homepage": "https://github.com/Quiss", + "role": "Usability consultant" + }, { "name": "Laravel-Lang Team", "homepage": "https://github.com/Laravel-Lang" } ], - "description": "Publisher lang files for the Laravel and Lumen Frameworks, Jetstream, Fortify, Cashier, Spark and Nova from Laravel-Lang/lang", + "description": "Easy and fast way to localize models", "keywords": [ + "database", + "l18n", + "languages", + "laravel", + "locales", + "localization", + "models", + "translate", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/models/issues", + "source": "https://github.com/Laravel-Lang/models" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-03-17T23:00:20+00:00" + }, + { + "name": "laravel-lang/moonshine", + "version": "1.9.2", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/moonshine.git", + "reference": "3927bcf658d392c9f2eb03c773f52ff650b37f63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/moonshine/zipball/3927bcf658d392c9f2eb03c773f52ff650b37f63", + "reference": "3927bcf658d392c9f2eb03c773f52ff650b37f63", + "shasum": "" + }, + "require": { + "ext-json": "*", + "laravel-lang/publisher": "^15.0 || ^16.4.1", + "php": "^8.1" + }, + "require-dev": { + "dragon-code/support": "^6.15.2", + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/lang": "^14.8 || ^15.14", + "laravel-lang/status-generator": "^2.12", + "phpunit/phpunit": "^10.0 || ^11.0 || ^12.0", + "symfony/var-dumper": "^6.3 || ^7.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\MoonShine\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\MoonShine\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro" + }, + { + "name": "Laravel Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "Translation for MoonShine admin panel", + "keywords": [ + "lang", + "languages", + "laravel", + "moonshine", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/moonshine/issues", + "source": "https://github.com/Laravel-Lang/moonshine/tree/1.9.2" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-05-30T12:11:41+00:00" + }, + { + "name": "laravel-lang/native-country-names", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/native-country-names.git", + "reference": "1d293138e34eb9e914bc4568cdebac2cb0a2eb0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/native-country-names/zipball/1d293138e34eb9e914bc4568cdebac2cb0a2eb0e", + "reference": "1d293138e34eb9e914bc4568cdebac2cb0a2eb0e", + "shasum": "" + }, + "require": { + "dragon-code/support": "^6.11", + "ext-json": "*", + "illuminate/collections": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "php": "^8.1" + }, + "require-dev": { + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/locale-list": "^1.5", + "pestphp/pest": "^2.0 || ^3.0 || ^4.0", + "punic/punic": "^3.8", + "symfony/console": "^6.0 || ^7.0 || ^8.0", + "symfony/process": "^6.0 || ^7.0 || ^8.0", + "symfony/var-dumper": "^6.0 || ^7.0 || ^8.0", + "vlucas/phpdotenv": "^5.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaravelLang\\NativeCountryNames\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "The project contains native translations of country names", + "keywords": [ + "Laravel-lang", + "countries", + "country", + "lang", + "languages", + "laravel", + "locale", + "locales", + "localization", + "territories", + "territory", + "translation", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/native-country-names/issues", + "source": "https://github.com/Laravel-Lang/native-country-names" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-03-17T22:01:15+00:00" + }, + { + "name": "laravel-lang/native-currency-names", + "version": "1.10.0", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/native-currency-names.git", + "reference": "7ebe95a9942bebf6afd61986fa18c82dade3d583" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/native-currency-names/zipball/7ebe95a9942bebf6afd61986fa18c82dade3d583", + "reference": "7ebe95a9942bebf6afd61986fa18c82dade3d583", + "shasum": "" + }, + "require": { + "dragon-code/support": "^6.11", + "ext-json": "*", + "illuminate/collections": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "php": "^8.1" + }, + "require-dev": { + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/locale-list": "^1.2", + "pestphp/pest": "^2.0 || ^3.0 || ^4.0", + "punic/punic": "^3.8", + "symfony/console": "^6.0 || ^7.0", + "symfony/process": "^6.0 || ^7.0", + "symfony/var-dumper": "^6.0 || ^7.0", + "vlucas/phpdotenv": "^5.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaravelLang\\NativeCurrencyNames\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "The project contains native translations of currency names", + "keywords": [ + "Laravel-lang", + "currency", + "lang", + "languages", + "laravel", + "locale", + "locales", + "localization", + "translation", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/native-currency-names/issues", + "source": "https://github.com/Laravel-Lang/native-currency-names" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-06-20T16:50:37+00:00" + }, + { + "name": "laravel-lang/native-locale-names", + "version": "2.9.0", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/native-locale-names.git", + "reference": "e5925182bad34654203a5d93544357ca00a6d9c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/native-locale-names/zipball/e5925182bad34654203a5d93544357ca00a6d9c0", + "reference": "e5925182bad34654203a5d93544357ca00a6d9c0", + "shasum": "" + }, + "require": { + "dragon-code/support": "^6.11", + "ext-json": "*", + "php": "^8.1" + }, + "require-dev": { + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/locale-list": "^1.2", + "pestphp/pest": "^2.24.3 || ^3.0 || ^4.0", + "punic/punic": "^3.8", + "symfony/console": "^6.0 || ^7.0", + "symfony/process": "^6.0 || ^7.0", + "symfony/var-dumper": "^6.0 || ^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "LaravelLang\\NativeLocaleNames\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "The project contains native translations of locale names", + "keywords": [ + "Laravel-lang", + "lang", + "languages", + "laravel", + "locale", + "locales", + "localization", + "translation", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/native-locale-names/issues", + "source": "https://github.com/Laravel-Lang/native-locale-names" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-06-20T16:52:11+00:00" + }, + { + "name": "laravel-lang/publisher", + "version": "16.8.0", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/publisher.git", + "reference": "e5d3383f5385c2102f8a0d3dbe488ed86cd0250f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/publisher/zipball/e5d3383f5385c2102f8a0d3dbe488ed86cd0250f", + "reference": "e5d3383f5385c2102f8a0d3dbe488ed86cd0250f", + "shasum": "" + }, + "require": { + "composer/semver": "^3.4", + "dragon-code/pretty-array": "^4.1", + "dragon-code/support": "^6.11.3", + "ext-json": "*", + "illuminate/collections": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/console": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/config": "^1.12", + "laravel-lang/locales": "^2.10", + "league/commonmark": "^2.4.1", + "league/config": "^1.2", + "php": "^8.1" + }, + "conflict": { + "laravel-lang/attributes": "<2.0", + "laravel-lang/http-statuses": "<3.0", + "laravel-lang/lang": "<11.0" + }, + "require-dev": { + "laravel-lang/json-fallback": "^2.2", + "orchestra/testbench": "^8.14 || ^9.0 || ^10.0 || ^11.0", + "phpunit/phpunit": "^10.4.2 || ^11.0 || ^12.0", + "symfony/var-dumper": "^6.3.6 || ^7.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\Publisher\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\Publisher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "Localization publisher for your Laravel application", + "keywords": [ + "Laravel-lang", "breeze", "cashier", "fortify", @@ -9275,12 +10545,14 @@ "locale", "locales", "localization", + "localizations", "lpm", "lumen", "nova", "publisher", "spark", "trans", + "translation", "translations", "validations" ], @@ -9290,11 +10562,180 @@ }, "funding": [ { - "url": "https://opencollective.com/laravel-lang", - "type": "open_collective" + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" } ], - "time": "2023-10-29T21:03:27+00:00" + "time": "2026-03-17T22:56:20+00:00" + }, + { + "name": "laravel-lang/routes", + "version": "1.11.0", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/routes.git", + "reference": "29d7f83f2679f51187aa4e761d73bb4e0d133bf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/routes/zipball/29d7f83f2679f51187aa4e761d73bb4e0d133bf4", + "reference": "29d7f83f2679f51187aa4e761d73bb4e0d133bf4", + "shasum": "" + }, + "require": { + "codezero/browser-locale": "^3.4", + "dragon-code/support": "^6.13", + "illuminate/config": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/http": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/routing": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "illuminate/support": "^10.0 || ^11.0 || ^12.0 || ^13.0", + "laravel-lang/config": "^1.13", + "laravel-lang/locales": "^2.10", + "php": "^8.1" + }, + "require-dev": { + "orchestra/testbench": "^8.23 || ^9.1 || ^10.0 || ^11.0", + "pestphp/pest": "^2.34 || ^3.0 || ^4.0", + "pestphp/pest-plugin-laravel": "^2.4 || ^3.0 || ^4.0", + "symfony/var-dumper": "^6.0 || ^7.0 || ^8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\Routes\\ServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "helpers/functions.php" + ], + "psr-4": { + "LaravelLang\\Routes\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro", + "homepage": "https://dragon-code.pro" + }, + { + "name": "Laravel-Lang Team", + "homepage": "https://github.com/Laravel-Lang" + } + ], + "description": "Easy and fast way to localize routes", + "keywords": [ + "l18n", + "languages", + "laravel", + "localization", + "routes", + "translate", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/routes/issues", + "source": "https://github.com/Laravel-Lang/routes" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-03-17T23:06:16+00:00" + }, + { + "name": "laravel-lang/starter-kits", + "version": "1.16.1", + "source": { + "type": "git", + "url": "https://github.com/Laravel-Lang/starter-kits.git", + "reference": "87c00c77bbb73385d0526b35dbe07ea2bbfc32db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Laravel-Lang/starter-kits/zipball/87c00c77bbb73385d0526b35dbe07ea2bbfc32db", + "reference": "87c00c77bbb73385d0526b35dbe07ea2bbfc32db", + "shasum": "" + }, + "require": { + "ext-json": "*", + "laravel-lang/publisher": "^16.6", + "php": "^8.1" + }, + "require-dev": { + "laravel-lang/status-generator": "^2.13", + "phpunit/phpunit": "^11.0 || ^12.0", + "symfony/var-dumper": "^7.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "LaravelLang\\StarterKits\\ServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "LaravelLang\\StarterKits\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andrey Helldar", + "email": "helldar@dragon-code.pro" + }, + { + "name": "Laravel Lang Team", + "homepage": "https://laravel-lang.com" + } + ], + "description": "Translations for Laravel Starter Kits", + "keywords": [ + "i18n", + "lang", + "languages", + "laravel", + "starter-kit", + "starter-kits", + "translations" + ], + "support": { + "issues": "https://github.com/Laravel-Lang/starter-kits/issues", + "source": "https://github.com/Laravel-Lang/starter-kits/tree/1.16.1" + }, + "funding": [ + { + "url": "https://boosty.to/dragon-code", + "type": "boosty" + }, + { + "url": "https://yoomoney.ru/to/410012608840929", + "type": "yoomoney" + } + ], + "time": "2026-07-16T18:13:26+00:00" }, { "name": "laravel/pint", @@ -9667,6 +11108,330 @@ ], "time": "2026-07-15T19:09:14+00:00" }, + { + "name": "pestphp/pest", + "version": "v3.8.7", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest.git", + "reference": "f108313b52e8c28dc7121ce34303f817a3790202" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest/zipball/f108313b52e8c28dc7121ce34303f817a3790202", + "reference": "f108313b52e8c28dc7121ce34303f817a3790202", + "shasum": "" + }, + "require": { + "brianium/paratest": "^7.8.5", + "nunomaduro/collision": "^8.9.4", + "nunomaduro/termwind": "^2.4.0", + "pestphp/pest-plugin": "^3.0.0", + "pestphp/pest-plugin-arch": "^3.1.1", + "pestphp/pest-plugin-mutate": "^3.0.5", + "php": "^8.2.0", + "phpunit/phpunit": "^11.5.56" + }, + "conflict": { + "filp/whoops": "<2.16.0", + "phpunit/phpunit": ">11.5.56", + "sebastian/exporter": "<6.0.0", + "webmozart/assert": "<1.11.0" + }, + "require-dev": { + "pestphp/pest-dev-tools": "^3.4.0", + "pestphp/pest-plugin-type-coverage": "^3.6.1", + "symfony/process": "^7.4.13" + }, + "bin": [ + "bin/pest" + ], + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Mutate\\Plugins\\Mutate", + "Pest\\Plugins\\Configuration", + "Pest\\Plugins\\Bail", + "Pest\\Plugins\\Cache", + "Pest\\Plugins\\Coverage", + "Pest\\Plugins\\Init", + "Pest\\Plugins\\Environment", + "Pest\\Plugins\\Help", + "Pest\\Plugins\\Memory", + "Pest\\Plugins\\Only", + "Pest\\Plugins\\Printer", + "Pest\\Plugins\\ProcessIsolation", + "Pest\\Plugins\\Profile", + "Pest\\Plugins\\Retry", + "Pest\\Plugins\\Snapshot", + "Pest\\Plugins\\Verbose", + "Pest\\Plugins\\Version", + "Pest\\Plugins\\Parallel" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "files": [ + "src/Functions.php", + "src/Pest.php" + ], + "psr-4": { + "Pest\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "The elegant PHP Testing Framework.", + "keywords": [ + "framework", + "pest", + "php", + "test", + "testing", + "unit" + ], + "support": { + "issues": "https://github.com/pestphp/pest/issues", + "source": "https://github.com/pestphp/pest/tree/v3.8.7" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2026-07-06T17:04:21+00:00" + }, + { + "name": "pestphp/pest-plugin", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin.git", + "reference": "e79b26c65bc11c41093b10150c1341cc5cdbea83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin/zipball/e79b26c65bc11c41093b10150c1341cc5cdbea83", + "reference": "e79b26c65bc11c41093b10150c1341cc5cdbea83", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0.0", + "composer-runtime-api": "^2.2.2", + "php": "^8.2" + }, + "conflict": { + "pestphp/pest": "<3.0.0" + }, + "require-dev": { + "composer/composer": "^2.7.9", + "pestphp/pest": "^3.0.0", + "pestphp/pest-dev-tools": "^3.0.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Pest\\Plugin\\Manager" + }, + "autoload": { + "psr-4": { + "Pest\\Plugin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Pest plugin manager", + "keywords": [ + "framework", + "manager", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2024-09-08T23:21:41+00:00" + }, + { + "name": "pestphp/pest-plugin-arch", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-arch.git", + "reference": "db7bd9cb1612b223e16618d85475c6f63b9c8daa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/db7bd9cb1612b223e16618d85475c6f63b9c8daa", + "reference": "db7bd9cb1612b223e16618d85475c6f63b9c8daa", + "shasum": "" + }, + "require": { + "pestphp/pest-plugin": "^3.0.0", + "php": "^8.2", + "ta-tikoma/phpunit-architecture-test": "^0.8.4" + }, + "require-dev": { + "pestphp/pest": "^3.8.1", + "pestphp/pest-dev-tools": "^3.4.0" + }, + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Arch\\Plugin" + ] + } + }, + "autoload": { + "files": [ + "src/Autoload.php" + ], + "psr-4": { + "Pest\\Arch\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Arch plugin for Pest PHP.", + "keywords": [ + "arch", + "architecture", + "framework", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-arch/tree/v3.1.1" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2025-04-16T22:59:48+00:00" + }, + { + "name": "pestphp/pest-plugin-mutate", + "version": "v3.0.5", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-mutate.git", + "reference": "e10dbdc98c9e2f3890095b4fe2144f63a5717e08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-mutate/zipball/e10dbdc98c9e2f3890095b4fe2144f63a5717e08", + "reference": "e10dbdc98c9e2f3890095b4fe2144f63a5717e08", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.2.0", + "pestphp/pest-plugin": "^3.0.0", + "php": "^8.2", + "psr/simple-cache": "^3.0.0" + }, + "require-dev": { + "pestphp/pest": "^3.0.8", + "pestphp/pest-dev-tools": "^3.0.0", + "pestphp/pest-plugin-type-coverage": "^3.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Pest\\Mutate\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sandro Gehri", + "email": "sandrogehri@gmail.com" + } + ], + "description": "Mutates your code to find untested cases", + "keywords": [ + "framework", + "mutate", + "mutation", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-mutate/tree/v3.0.5" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/gehrisandro", + "type": "github" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2024-09-22T07:54:40+00:00" + }, { "name": "phar-io/manifest", "version": "2.0.4", @@ -9785,6 +11550,187 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "ee15a5a2022c8383906b225055e9496a6a5e6e3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/ee15a5a2022c8383906b225055e9496a6a5e6e3b", + "reference": "ee15a5a2022c8383906b225055e9496a6a5e6e3b", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.8", + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "https://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.2.1" + }, + "time": "2025-11-10T21:21:55+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "6.0.3", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/7bae67520aa9f5ecc506d646810bd40d9da54582", + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.1", + "ext-filter": "*", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^2.0", + "phpstan/phpdoc-parser": "^2.0", + "webmozart/assert": "^1.9.1 || ^2" + }, + "require-dev": { + "mockery/mockery": "~1.3.5 || ~1.6.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^5.26", + "shipmonk/dead-code-detector": "^0.5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/6.0.3" + }, + "time": "2026-03-18T20:49:53+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "dbe2133bb23e2e33a6834f4ed417f24a1b167769" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dbe2133bb23e2e33a6834f4ed417f24a1b167769", + "reference": "dbe2133bb23e2e33a6834f4ed417f24a1b167769", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev", + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/2.1.0" + }, + "time": "2026-09-27T19:32:54+00:00" + }, { "name": "phpstan/phpdoc-parser", "version": "2.3.6", @@ -9834,15 +11780,15 @@ }, { "name": "phpstan/phpstan", - "version": "1.12.34", + "version": "2.2.16", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4dd89ca7aa30fdc6760be21550d583bcc32e8476", - "reference": "4dd89ca7aa30fdc6760be21550d583bcc32e8476", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46a6d9060e5a7763adfcc21ebcb8b504ebdbcb92", + "reference": "46a6d9060e5a7763adfcc21ebcb8b504ebdbcb92", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -9861,6 +11807,17 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], "description": "PHPStan - PHP Static Analysis Tool", "keywords": [ "dev", @@ -9883,7 +11840,58 @@ "type": "github" } ], - "time": "2026-07-28T10:04:39+00:00" + "time": "2026-09-25T09:31:51+00:00" + }, + { + "name": "phpstan/phpstan-webmozart-assert", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-webmozart-assert.git", + "reference": "0c641817d2a8f05c7157f92d91986e74d3c8ab0c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-webmozart-assert/zipball/0c641817d2a8f05c7157f92d91986e74d3c8ab0c", + "reference": "0c641817d2a8f05c7157f92d91986e74d3c8ab0c", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" + }, + "require-dev": { + "nikic/php-parser": "^5.1", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", + "webmozart/assert": "^1.11.0" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan webmozart/assert extension", + "support": { + "issues": "https://github.com/phpstan/phpstan-webmozart-assert/issues", + "source": "https://github.com/phpstan/phpstan-webmozart-assert/tree/2.0.0" + }, + "time": "2024-10-14T03:45:26+00:00" }, { "name": "phpunit/php-code-coverage", @@ -10326,6 +12334,63 @@ ], "time": "2026-07-06T14:52:39+00:00" }, + { + "name": "rector/rector", + "version": "2.6.7", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "f4aa224edb9b0630fb43826d4cb6a49b62e48d4c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4aa224edb9b0630fb43826d4cb6a49b62e48d4c", + "reference": "f4aa224edb9b0630fb43826d4cb6a49b62e48d4c", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.2.14" + }, + "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.6.7" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2026-09-13T20:17:44+00:00" + }, { "name": "sebastian/cli-parser", "version": "3.0.2", @@ -11974,6 +14039,125 @@ ], "time": "2026-09-26T06:33:49+00:00" }, + { + "name": "symplify/rule-doc-generator-contracts", + "version": "11.2.0", + "source": { + "type": "git", + "url": "https://github.com/symplify/rule-doc-generator-contracts.git", + "reference": "479cfcfd46047f80624aba931d9789e50475b5c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symplify/rule-doc-generator-contracts/zipball/479cfcfd46047f80624aba931d9789e50475b5c6", + "reference": "479cfcfd46047f80624aba931d9789e50475b5c6", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.3", + "phpstan/extension-installer": "^1.2", + "rector/rector": "^0.15.10", + "symplify/easy-ci": "^11.1", + "symplify/easy-coding-standard": "^11.1", + "symplify/easy-testing": "^11.1", + "symplify/phpstan-extensions": "^11.1", + "symplify/phpstan-rules": "11.2.3.72", + "tomasvotruba/unused-public": "^0.0.34" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "11.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\RuleDocGenerator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Contracts for production code of RuleDocGenerator", + "support": { + "source": "https://github.com/symplify/rule-doc-generator-contracts/tree/11.2.0" + }, + "funding": [ + { + "url": "https://www.paypal.me/rectorphp", + "type": "custom" + }, + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "abandoned": true, + "time": "2024-03-18T22:02:54+00:00" + }, + { + "name": "ta-tikoma/phpunit-architecture-test", + "version": "0.8.7", + "source": { + "type": "git", + "url": "https://github.com/ta-tikoma/phpunit-architecture-test.git", + "reference": "1248f3f506ca9641d4f68cebcd538fa489754db8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/1248f3f506ca9641d4f68cebcd538fa489754db8", + "reference": "1248f3f506ca9641d4f68cebcd538fa489754db8", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18.0 || ^5.0.0", + "php": "^8.1.0", + "phpdocumentor/reflection-docblock": "^5.3.0 || ^6.0.0", + "phpunit/phpunit": "^10.5.5 || ^11.0.0 || ^12.0.0 || ^13.0.0", + "symfony/finder": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "require-dev": { + "laravel/pint": "^1.13.7", + "phpstan/phpstan": "^1.10.52" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPUnit\\Architecture\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ni Shi", + "email": "futik0ma011@gmail.com" + }, + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Methods for testing application architecture", + "keywords": [ + "architecture", + "phpunit", + "stucture", + "test", + "testing" + ], + "support": { + "issues": "https://github.com/ta-tikoma/phpunit-architecture-test/issues", + "source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.8.7" + }, + "time": "2026-02-17T17:25:14+00:00" + }, { "name": "thedoctor0/laravel-factory-generator", "version": "1.5.0", @@ -12088,6 +14272,72 @@ } ], "time": "2025-11-17T20:03:58+00:00" + }, + { + "name": "webmozart/assert", + "version": "2.4.1", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/2ccb7c2e821038c03a3e6e1700c570c158c55f70", + "reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-filter": "*", + "php": "^8.2" + }, + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" + }, + "type": "library", + "extra": { + "psalm": { + "pluginClass": "Webmozart\\Assert\\PsalmPlugin" + }, + "branch-alias": { + "dev-master": "2.0-dev", + "dev-feature/2-0": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/2.4.1" + }, + "time": "2026-06-15T15:31:57+00:00" } ], "aliases": [], @@ -12096,7 +14346,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": "^8.2" + "php": "^8.5" }, "platform-dev": {}, "plugin-api-version": "2.9.0" diff --git a/config/app.php b/config/app.php index d772f0a..5b4b32e 100644 --- a/config/app.php +++ b/config/app.php @@ -1,6 +1,36 @@ env('APP_NAME', 'Laravel'), @@ -26,7 +56,7 @@ return [ | running in. This may determine how you prefer to configure various | services the application utilizes. Set this in your ".env" file. | - */ + */ 'env' => env('APP_ENV', 'production'), @@ -39,7 +69,7 @@ return [ | stack traces will be shown on every error that occurs within your | application. If disabled, a simple generic error page is shown. | - */ + */ 'debug' => (bool) env('APP_DEBUG', false), @@ -52,7 +82,7 @@ return [ | the Artisan command line tool. You should set this to the root of | your application so that it is used when running Artisan tasks. | - */ + */ 'url' => env('APP_URL', 'http://localhost'), @@ -67,7 +97,7 @@ return [ | will be used by the PHP date and date-time functions. We have gone | ahead and set this to a sensible default for you out of the box. | - */ + */ 'timezone' => 'Europe/Paris', @@ -80,7 +110,7 @@ return [ | by the translation service provider. You are free to set this value | to any of the locales which will be supported by the application. | - */ + */ 'locale' => env('APP_LOCALE', 'fr'), @@ -93,7 +123,7 @@ return [ | is not available. You may change the value to correspond to any of | the language folders that are provided through your application. | - */ + */ 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'fr'), @@ -106,7 +136,7 @@ return [ | data for your database seeds. For example, this will be used to get | localized telephone numbers, street address information and more. | - */ + */ 'faker_locale' => env('APP_FAKER_LOCALE', 'fr_FR'), @@ -119,7 +149,7 @@ return [ | to a random, 32 character string, otherwise these encrypted strings | will not be safe. Please do this before deploying an application! | - */ + */ 'key' => env('APP_KEY'), @@ -136,10 +166,10 @@ return [ | | Supported drivers: "file", "cache" | - */ + */ 'maintenance' => [ - 'driver' => 'file' + 'driver' => 'file', ], /* @@ -151,7 +181,7 @@ return [ | request to your application. Feel free to add your own services to | this array to grant expanded functionality to your applications. | - */ + */ 'providers' => [ @@ -159,28 +189,28 @@ return [ * Laravel Framework Service Providers... */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Notifications\NotificationServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, + AuthServiceProvider::class, + BroadcastServiceProvider::class, + BusServiceProvider::class, + CacheServiceProvider::class, + ConsoleSupportServiceProvider::class, + CookieServiceProvider::class, + DatabaseServiceProvider::class, + EncryptionServiceProvider::class, + FilesystemServiceProvider::class, + FoundationServiceProvider::class, + HashServiceProvider::class, + MailServiceProvider::class, + NotificationServiceProvider::class, + PaginationServiceProvider::class, + PipelineServiceProvider::class, + QueueServiceProvider::class, + RedisServiceProvider::class, + PasswordResetServiceProvider::class, + SessionServiceProvider::class, + TranslationServiceProvider::class, + ValidationServiceProvider::class, + ViewServiceProvider::class, /* * Package Service Providers... @@ -190,14 +220,14 @@ return [ * Application Service Providers... */ - App\Providers\AppServiceProvider::class, - App\Providers\AuthServiceProvider::class, - App\Providers\EventServiceProvider::class, - App\Providers\RouteServiceProvider::class, - App\Providers\TranslationServiceProvider::class, - App\Providers\ViewServiceProvider::class, - App\Providers\CrmApiServiceProvider::class, - App\Providers\MesBrApiServiceProvider::class, + AppServiceProvider::class, + \App\Providers\AuthServiceProvider::class, + EventServiceProvider::class, + RouteServiceProvider::class, + \App\Providers\TranslationServiceProvider::class, + \App\Providers\ViewServiceProvider::class, + CrmApiServiceProvider::class, + MesBrApiServiceProvider::class, ], /* @@ -209,10 +239,10 @@ return [ | is started. However, feel free to register as many as you wish as | the aliases are "lazy" loaded so they don't hinder performance. | - */ + */ 'aliases' => Facade::defaultAliases()->merge([ - 'Carbon' => \Illuminate\Support\Carbon::class, + 'Carbon' => Carbon::class, ])->toArray(), ]; diff --git a/config/auth.php b/config/auth.php index c370135..a9541f6 100644 --- a/config/auth.php +++ b/config/auth.php @@ -1,5 +1,10 @@ [ - 'guard' => 'frontend', + 'guard' => 'frontend', 'passwords' => 'users', ], @@ -33,16 +38,16 @@ return [ | | Supported: "session" | - */ + */ 'guards' => [ 'backend' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], 'frontend' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'customers', ], ], @@ -62,16 +67,16 @@ return [ | | Supported: "database", "eloquent" | - */ + */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => \App\Models\User::class, + 'model' => User::class, ], 'customers' => [ 'driver' => 'crm', - 'model' => \App\Models\Customer::class, + 'model' => Customer::class, ], ], @@ -92,19 +97,19 @@ return [ | generating more password reset tokens. This prevents the user from | quickly generating a very large amount of password reset tokens. | - */ + */ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, 'throttle' => 60, ], 'customers' => [ 'provider' => 'customers', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, 'throttle' => 60, ], ], @@ -118,7 +123,7 @@ return [ | times out and the user is prompted to re-enter their password via the | confirmation screen. By default, the timeout lasts for three hours. | - */ + */ 'password_timeout' => 10800, diff --git a/config/breadcrumbs.php b/config/breadcrumbs.php index 6c96342..a404d36 100644 --- a/config/breadcrumbs.php +++ b/config/breadcrumbs.php @@ -1,5 +1,10 @@ 'modules/breadcrumbs/breadcrumb-layout', @@ -35,7 +40,7 @@ return [ | - base_path('routes/breadcrumbs.php') | - glob(base_path('breadcrumbs/*.php')) | - */ + */ 'files' => [ base_path('routes/breadcrumbs-bo.php'), @@ -49,7 +54,7 @@ return [ | | Determine when to throw an exception. | - */ + */ // * When route-bound breadcrumbs are used but the current route doesn't have a name (UnnamedRouteException) 'unnamed-route-exception' => true, @@ -67,12 +72,12 @@ return [ | | Subclass the default classes for more advanced customisations. | - */ + */ // * Manager - 'manager-class' => Diglactic\Breadcrumbs\Manager::class, + 'manager-class' => Manager::class, // * Generator - 'generator-class' => Diglactic\Breadcrumbs\Generator::class, + 'generator-class' => Generator::class, ]; diff --git a/config/broadcasting.php b/config/broadcasting.php index ae079a6..538e6b6 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -1,5 +1,7 @@ env('BROADCAST_DRIVER', 'null'), @@ -26,21 +28,21 @@ return [ | to broadcast events to other systems or over websockets. Samples of | each available type of connection are provided inside this array. | - */ + */ 'connections' => [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + 'driver' => 'pusher', + 'key' => env('PUSHER_APP_KEY'), + 'secret' => env('PUSHER_APP_SECRET'), + 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', - 'port' => env('PUSHER_PORT', 443), - 'scheme' => env('PUSHER_SCHEME', 'https'), + 'host' => env('PUSHER_HOST') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', + 'port' => env('PUSHER_PORT', 443), + 'scheme' => env('PUSHER_SCHEME', 'https'), 'encrypted' => true, - 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', + 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', ], 'client_options' => [ // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html . @@ -49,11 +51,11 @@ return [ 'ably' => [ 'driver' => 'ably', - 'key' => env('ABLY_KEY'), + 'key' => env('ABLY_KEY'), ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index 8e0f9c7..5723916 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,5 +1,7 @@ env('CACHE_DRIVER', 'file'), @@ -29,7 +31,7 @@ return [ | Supported drivers: "apc", "array", "database", "file", | "memcached", "redis", "dynamodb", "octane", "null" | - */ + */ 'stores' => [ @@ -38,26 +40,26 @@ return [ ], 'array' => [ - 'driver' => 'array', + 'driver' => 'array', 'serialize' => false, ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, + 'driver' => 'database', + 'table' => 'cache', + 'connection' => null, 'lock_connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], @@ -66,25 +68,25 @@ return [ ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'cache', + 'driver' => 'redis', + 'connection' => 'cache', 'lock_connection' => 'default', ], 'dynamodb' => [ - 'driver' => 'dynamodb', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], @@ -103,7 +105,7 @@ return [ | stores there might be other applications using the same cache. For | that reason, you may prefix every cache key to avoid collisions. | - */ + */ 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), diff --git a/config/codes.php b/config/codes.php index 25bf7c7..909f657 100644 --- a/config/codes.php +++ b/config/codes.php @@ -1,5 +1,7 @@ env('CODE_PAGINATE', 65530), @@ -7,5 +9,5 @@ return [ // Dictionnary of chars to use fo generating unique codes. 'codeCharList' => env('CODE_CHAR_LIST', 'ABCDEFGHJKMNPQRSTUWXYZ123456789'), // Code length. - 'codeLength' => env('CODE_CHAR_LENGTH', 9) + 'codeLength' => env('CODE_CHAR_LENGTH', 9), ]; diff --git a/config/cors.php b/config/cors.php index caccf68..26e9ef7 100644 --- a/config/cors.php +++ b/config/cors.php @@ -1,5 +1,7 @@ ['api/*'], diff --git a/config/crm.php b/config/crm.php index ff4932f..b1cbff1 100644 --- a/config/crm.php +++ b/config/crm.php @@ -1,7 +1,9 @@ env('CRM_ENDPOINT'), - 'token' => env('CRM_TOKEN'), - 'password' => env('CRM_PASSWORD') + 'token' => env('CRM_TOKEN'), + 'password' => env('CRM_PASSWORD'), ]; diff --git a/config/database.php b/config/database.php index 9dfe93d..cd5813e 100644 --- a/config/database.php +++ b/config/database.php @@ -1,6 +1,9 @@ env('DB_CONNECTION', 'mysql'), @@ -31,63 +34,63 @@ return [ | so make sure you have the driver for your particular database of | choice installed on your machine before you begin development. | - */ + */ 'connections' => [ 'sqlite' => [ - 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), - 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', + 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ - 'driver' => 'mysql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ - 'driver' => 'pgsql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'driver' => 'pgsql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, - 'search_path' => 'public', - 'sslmode' => 'prefer', + 'search_path' => 'public', + 'sslmode' => 'prefer', ], 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, ], @@ -102,7 +105,7 @@ return [ | your application. Using this information, we can determine which of | the migrations on disk haven't actually been run in the database. | - */ + */ 'migrations' => 'migrations', @@ -115,7 +118,7 @@ return [ | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | - */ + */ 'redis' => [ @@ -123,24 +126,24 @@ 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' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), + 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), ], 'cache' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), + 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], diff --git a/config/filesystems.php b/config/filesystems.php index 89920a5..1715e15 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -1,5 +1,7 @@ env('FILESYSTEM_DISK', 'local'), @@ -26,41 +28,41 @@ return [ | | Supported Drivers: "local", "ftp", "sftp", "s3" | - */ + */ 'disks' => [ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), - 'throw' => false, + 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL') . '/storage', + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', - 'throw' => false, + 'throw' => false, ], 'private' => [ - 'driver' => 'local', - 'root' => storage_path('app/private'), + 'driver' => 'local', + 'root' => storage_path('app/private'), 'visibility' => 'private', - 'throw' => false, + 'throw' => false, ], 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), - 'throw' => false, + 'throw' => false, ], ], @@ -74,7 +76,7 @@ return [ | `storage:link` Artisan command is executed. The array keys should be | the locations of the links and the values should be their targets. | - */ + */ 'links' => [ public_path('storage') => storage_path('app/public'), diff --git a/config/hashing.php b/config/hashing.php index be29b34..a50883f 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -1,5 +1,7 @@ 'bcrypt', @@ -26,7 +28,7 @@ return [ | passwords are hashed using the Bcrypt algorithm. This will allow you | to control the amount of time it takes to hash the given password. | - */ + */ 'bcrypt' => [ 'rounds' => env('BCRYPT_ROUNDS', 12), @@ -41,12 +43,12 @@ return [ | passwords are hashed using the Argon algorithm. These will allow you | to control the amount of time it takes to hash the given password. | - */ + */ 'argon' => [ - 'memory' => 65536, + 'memory' => 65536, 'threads' => 1, - 'time' => 4, + 'time' => 4, ], ]; diff --git a/config/image-resizer.php b/config/image-resizer.php index 19740b3..f390084 100644 --- a/config/image-resizer.php +++ b/config/image-resizer.php @@ -1,5 +1,7 @@ array_replace_recursive( [], - (file_exists(resource_path('theme/mounted/theme.config.php')) ? - require(resource_path('theme/mounted/theme.config.php')) : [])['resizes'] ?? [], - ) + ( + file_exists(resource_path('theme/mounted/theme.config.php')) + ? require resource_path('theme/mounted/theme.config.php') + : [] + )['resizes'] ?? [], + ), ]; diff --git a/config/logging.php b/config/logging.php index 5906e47..b81ced4 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,5 +1,7 @@ env('LOG_CHANNEL', 'stack'), @@ -29,11 +31,11 @@ return [ | regarding deprecated PHP and library features. This allows you to get | your application ready for upcoming major versions of dependencies. | - */ + */ 'deprecations' => [ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => false, + 'trace' => false, ], /* @@ -49,77 +51,77 @@ return [ | "errorlog", "monolog", | "custom", "stack" | - */ + */ 'channels' => [ 'stack' => [ - 'driver' => 'stack', - 'channels' => ['single'], + 'driver' => 'stack', + 'channels' => ['single'], 'ignore_exceptions' => false, ], 'single' => [ - 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), + 'driver' => 'single', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), 'replace_placeholders' => true, ], 'daily' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - 'days' => 14, + 'driver' => 'daily', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), + 'days' => 14, 'replace_placeholders' => true, ], 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => 'Laravel Log', + 'emoji' => ':boom:', + 'level' => env('LOG_LEVEL', 'critical'), 'replace_placeholders' => true, ], 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), ], 'processors' => [PsrLogMessageProcessor::class], ], 'stderr' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => StreamHandler::class, + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ + 'with' => [ 'stream' => 'php://stderr', ], 'processors' => [PsrLogMessageProcessor::class], ], 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), - 'facility' => LOG_USER, + 'driver' => 'syslog', + 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => LOG_USER, 'replace_placeholders' => true, ], 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), + 'driver' => 'errorlog', + 'level' => env('LOG_LEVEL', 'debug'), 'replace_placeholders' => true, ], 'null' => [ - 'driver' => 'monolog', + 'driver' => 'monolog', 'handler' => NullHandler::class, ], @@ -128,18 +130,18 @@ return [ ], 'stdout' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => StreamHandler::class, + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDOUT_FORMATTER'), - 'with' => [ + 'with' => [ 'stream' => 'php://stdout', ], ], 'k8s' => [ - 'driver' => 'stack', - 'channels' => ['daily', 'stdout'], + 'driver' => 'stack', + 'channels' => ['daily', 'stdout'], 'ignore_exceptions' => false, ], diff --git a/config/mail.php b/config/mail.php index 31caa75..49ce4b6 100644 --- a/config/mail.php +++ b/config/mail.php @@ -1,5 +1,7 @@ env('MAIL_MAILER', 'smtp'), @@ -31,17 +33,17 @@ return [ | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", | "postmark", "log", "array", "failover" | - */ + */ 'mailers' => [ 'smtp' => [ - 'transport' => 'smtp', - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), - 'port' => env('MAIL_PORT', 587), - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - 'username' => env('MAIL_USERNAME'), - 'password' => env('MAIL_PASSWORD'), - 'timeout' => null, + 'transport' => 'smtp', + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, 'local_domain' => env('MAIL_EHLO_DOMAIN'), ], @@ -50,21 +52,21 @@ return [ ], 'mailgun' => [ - 'transport' => 'mailgun' + 'transport' => 'mailgun', ], 'postmark' => [ - 'transport' => 'postmark' + 'transport' => 'postmark', ], 'sendmail' => [ 'transport' => 'sendmail', - 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), + 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), ], 'log' => [ 'transport' => 'log', - 'channel' => env('MAIL_LOG_CHANNEL'), + 'channel' => env('MAIL_LOG_CHANNEL'), ], 'array' => [ @@ -73,7 +75,7 @@ return [ 'failover' => [ 'transport' => 'failover', - 'mailers' => [ + 'mailers' => [ 'smtp', 'log', ], @@ -89,11 +91,11 @@ return [ | the same address. Here, you may specify a name and address that is | used globally for all e-mails that are sent by your application. | - */ + */ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* @@ -105,7 +107,7 @@ return [ | theme and component paths here, allowing you to customize the design | of the emails. Or, you may simply stick with the Laravel defaults! | - */ + */ 'markdown' => [ 'theme' => 'default', @@ -116,10 +118,10 @@ return [ // * For generic customized blade (theme seulement) resource_path('theme/mounted/views/vendor/mail'), // * For generic customized blade (moteur seulement) - resource_path('views/vendor/mail') + resource_path('views/vendor/mail'), ], ], - 'admin' => env('MAIL_ADMIN') + 'admin' => env('MAIL_ADMIN'), ]; diff --git a/config/mesbr.php b/config/mesbr.php index efcde39..87e4934 100644 --- a/config/mesbr.php +++ b/config/mesbr.php @@ -1,5 +1,7 @@ env('MESBR_ENDPOINT') + 'endpoint' => env('MESBR_ENDPOINT'), ]; diff --git a/config/proofs.php b/config/proofs.php index b8a49d5..26482c9 100644 --- a/config/proofs.php +++ b/config/proofs.php @@ -1,5 +1,7 @@ filter_var(env('PROOF_STICKER', true), FILTER_VALIDATE_BOOLEAN), 'ticket' => filter_var(env('PROOF_TICKET', true), FILTER_VALIDATE_BOOLEAN), diff --git a/config/queue.php b/config/queue.php index f5a66b9..952b19d 100644 --- a/config/queue.php +++ b/config/queue.php @@ -1,5 +1,7 @@ env('QUEUE_CONNECTION', 'sync'), @@ -26,7 +28,7 @@ return [ | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" | - */ + */ 'connections' => [ @@ -35,39 +37,39 @@ return [ ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', - 'retry_after' => 90, + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, 'after_commit' => false, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'retry_after' => 90, - 'block_for' => 0, + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, + 'block_for' => 0, 'after_commit' => false, ], 'sqs' => [ - 'driver' => 'sqs', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), - 'queue' => env('SQS_QUEUE', 'default'), - 'suffix' => env('SQS_SUFFIX'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'driver' => 'sqs', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'default'), + 'suffix' => env('SQS_SUFFIX'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 'after_commit' => false, ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 90, - 'block_for' => null, + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => 90, + 'block_for' => null, 'after_commit' => false, ], @@ -82,11 +84,11 @@ return [ | batching information. These options can be updated to any database | connection and table which has been defined by your application. | - */ + */ 'batching' => [ 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'job_batches', + 'table' => 'job_batches', ], /* @@ -98,12 +100,12 @@ return [ | can control which database and table are used to store the jobs that | have failed. You may change them to any database / table you wish. | - */ + */ 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/sentry.php b/config/sentry.php index 2e47564..b8503b9 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -1,5 +1,9 @@ env('SENTRY_LARAVEL_DSN', env('SENTRY_DSN')), @@ -57,5 +61,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' => ExceptionsHelper::sentryEventHandler(...), ]; diff --git a/config/services.php b/config/services.php index a4ceede..6c71a0b 100644 --- a/config/services.php +++ b/config/services.php @@ -1,5 +1,7 @@ [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), - 'scheme' => 'https', + 'scheme' => 'https', ], 'postmark' => [ @@ -26,13 +28,13 @@ return [ ], 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), + 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'matomo' => [ - 'site_id' => env('MATOMO_SITE_ID') - ] + 'site_id' => env('MATOMO_SITE_ID'), + ], ]; diff --git a/config/session.php b/config/session.php index d2e3239..9b90c97 100644 --- a/config/session.php +++ b/config/session.php @@ -1,5 +1,7 @@ env('SESSION_DRIVER', 'file'), @@ -29,7 +31,7 @@ return [ | to be allowed to remain idle before it expires. If you want them | to immediately expire on the browser closing, set that option. | - */ + */ 'lifetime' => env('SESSION_LIFETIME', 120), @@ -44,7 +46,7 @@ return [ | should be encrypted before it is stored. All encryption will be run | automatically by Laravel and you can use the Session like normal. | - */ + */ 'encrypt' => false, @@ -57,7 +59,7 @@ return [ | files may be stored. A default has been set for you but a different | location may be specified. This is only needed for file sessions. | - */ + */ 'files' => storage_path('framework/sessions'), @@ -70,7 +72,7 @@ return [ | connection that should be used to manage these sessions. This should | correspond to a connection in your database configuration options. | - */ + */ 'connection' => env('SESSION_CONNECTION'), @@ -83,7 +85,7 @@ return [ | should use to manage the sessions. Of course, a sensible default is | provided for you; however, you are free to change this as needed. | - */ + */ 'table' => 'sessions', @@ -98,7 +100,7 @@ return [ | | Affects: "apc", "dynamodb", "memcached", "redis" | - */ + */ 'store' => env('SESSION_STORE'), @@ -111,7 +113,7 @@ return [ | rid of old sessions from storage. Here are the chances that it will | happen on a given request. By default, the odds are 2 out of 100. | - */ + */ 'lottery' => [2, 100], @@ -124,7 +126,7 @@ return [ | instance by ID. The name specified here will get used every time a | new session cookie is created by the framework for every driver. | - */ + */ 'cookie' => env( 'SESSION_COOKIE', @@ -140,7 +142,7 @@ return [ | be regarded as available. Typically, this will be the root path of | your application but you are free to change this when necessary. | - */ + */ 'path' => '/', @@ -153,7 +155,7 @@ return [ | in your application. This will determine which domains the cookie is | available to in your application. A sensible default has been set. | - */ + */ 'domain' => env('SESSION_DOMAIN'), @@ -166,7 +168,7 @@ return [ | to the server if the browser has a HTTPS connection. This will keep | the cookie from being sent to you when it can't be done securely. | - */ + */ 'secure' => env('SESSION_SECURE_COOKIE'), @@ -179,7 +181,7 @@ return [ | value of the cookie and the cookie will only be accessible through | the HTTP protocol. You are free to modify this option if needed. | - */ + */ 'http_only' => true, @@ -194,7 +196,7 @@ return [ | | Supported: "lax", "strict", "none", null | - */ + */ 'same_site' => 'lax', diff --git a/config/sitemap-generator.php b/config/sitemap-generator.php index 27c2cd5..9e4614c 100644 --- a/config/sitemap-generator.php +++ b/config/sitemap-generator.php @@ -1,5 +1,7 @@ array_keys(config('laravellocalization.supportedLocales', ['fr' => "Fr"])) */ - 'supported_locales' => ['fr' => "Fr"] + 'supported_locales' => ['fr' => 'Fr'], ]; diff --git a/config/theme.php b/config/theme.php index f74a9c6..af7ccb0 100644 --- a/config/theme.php +++ b/config/theme.php @@ -1,5 +1,7 @@ [ 'prizes' => [ - 'picture_max_width' => 560, + 'picture_max_width' => 560, 'picture_max_height' => 700, ], 'products' => [ - 'picture_max_width' => 550, + 'picture_max_width' => 550, 'picture_max_height' => 550, ], 'ranges' => [ - 'picture_max_width' => 476, + 'picture_max_width' => 476, 'picture_max_height' => 355, ], ], @@ -53,8 +55,9 @@ return array_replace_recursive( * 'format' => 'webp' * ] */ - 'resizes' => [] + 'resizes' => [], ], - file_exists(resource_path('theme/mounted/theme.config.php')) ? - require(resource_path('theme/mounted/theme.config.php')) : [], + file_exists(resource_path('theme/mounted/theme.config.php')) + ? require resource_path('theme/mounted/theme.config.php') + : [], ); diff --git a/config/view.php b/config/view.php index bb1def5..539fc99 100644 --- a/config/view.php +++ b/config/view.php @@ -1,5 +1,7 @@ [ resource_path('views'), @@ -30,7 +32,7 @@ return [ | stored for your application. Typically, this is within the storage | directory. However, as usual, you are free to change this value. | - */ + */ 'compiled' => env( 'VIEW_COMPILED_PATH', diff --git a/database/factories/BannedIpFactory.php b/database/factories/BannedIpFactory.php index 06d80c0..7660251 100644 --- a/database/factories/BannedIpFactory.php +++ b/database/factories/BannedIpFactory.php @@ -1,11 +1,14 @@ + * @extends Factory */ class BannedIpFactory extends Factory { @@ -17,7 +20,7 @@ class BannedIpFactory extends Factory public function definition(): array { return [ - 'ip' => \IPLib\Factory::parseAddressString(fake()->boolean() ? fake()->ipv6() : fake()->ipv4()) + 'ip' => \IPLib\Factory::parseAddressString(fake()->boolean() ? fake()->ipv6() : fake()->ipv4()), ]; } } diff --git a/database/factories/FaqQuestionFactory.php b/database/factories/FaqQuestionFactory.php index 6f66bf8..3d5ebdb 100644 --- a/database/factories/FaqQuestionFactory.php +++ b/database/factories/FaqQuestionFactory.php @@ -1,11 +1,14 @@ + * @extends Factory */ class FaqQuestionFactory extends Factory { @@ -18,7 +21,7 @@ class FaqQuestionFactory extends Factory { return [ 'question' => 'Question ' . fake()->safeColorName() . ' ?', - 'answer' => fake()->randomHtml() + 'answer' => fake()->randomHtml(), ]; } } diff --git a/database/factories/FaqThemeFactory.php b/database/factories/FaqThemeFactory.php index 53646bb..dc896ad 100644 --- a/database/factories/FaqThemeFactory.php +++ b/database/factories/FaqThemeFactory.php @@ -1,11 +1,14 @@ + * @extends Factory */ class FaqThemeFactory extends Factory { @@ -17,7 +20,7 @@ class FaqThemeFactory extends Factory public function definition(): array { return [ - 'name' => 'theme ' . fake()->streetName() + 'name' => 'theme ' . fake()->streetName(), ]; } } diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index c46ae31..b36b39b 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -1,11 +1,14 @@ + * @extends Factory */ class ProductFactory extends Factory { @@ -19,7 +22,7 @@ class ProductFactory extends Factory return [ 'name' => 'product ' . \fake()->jobTitle(), // * EAN 13 generate - 'ean_code' => fake()->randomNumber(8, true) . fake()->randomNumber(5, true), + 'ean_code' => fake()->randomNumber(8, true) . fake()->randomNumber(5, true), 'picture_alt' => fake()->sentence(), 'picture_title' => fake()->sentence(), ]; diff --git a/database/factories/RangeFactory.php b/database/factories/RangeFactory.php index 6343e04..60c6742 100644 --- a/database/factories/RangeFactory.php +++ b/database/factories/RangeFactory.php @@ -1,11 +1,14 @@ + * @extends Factory */ class RangeFactory extends Factory { @@ -17,7 +20,7 @@ class RangeFactory extends Factory public function definition(): array { return [ - 'name' => 'range ' . \fake()->jobTitle(), + 'name' => 'range ' . \fake()->jobTitle(), 'picture_alt' => fake()->sentence(), 'picture_title' => fake()->sentence(), ]; diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 8a8bc99..9a9f132 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -1,5 +1,7 @@ faker->boolean(75); + $published = fake()->boolean(75); + return [ - 'first_name' => fake()->firstname(), - 'last_name' => fake()->lastname(), - 'email' => fake()->unique()->safeEmail(), - 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', - 'remember_token' => Str::random(10), - 'role' => \collect(RoleEnum::toArray())->random()->value, - 'published' => $published, - 'published_at' => ($published) ? now() : null, + 'first_name' => fake()->firstName(), + 'last_name' => fake()->lastName(), + 'email' => fake()->unique()->safeEmail(), + 'email_verified_at' => now(), + 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', + 'remember_token' => Str::random(10), + 'role' => \collect(RoleEnum::toArray())->random()->value, + 'published' => $published, + 'published_at' => ($published) ? now() : null, ]; } /** * Indicate that the model's email address should be unverified. - * - * @return static */ public function unverified(): static { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClass - return $this->state(fn (array $attributes) => [ + return $this->state(fn (array $attributes): array => [ 'email_verified_at' => null, ]); } diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 612e0a9..22d2fb8 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -1,19 +1,19 @@ id(); $table->string('first_name')->comment('First name of the user.'); $table->string('last_name')->comment('Last name of the user.'); @@ -30,10 +30,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index fcacb80..d5ecfc4 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -1,19 +1,19 @@ string('email')->index(); $table->string('token'); $table->timestamp('created_at')->nullable(); @@ -22,10 +22,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('password_resets'); } diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 1719198..81c1dab 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -1,19 +1,19 @@ id(); $table->string('uuid')->unique(); $table->text('connection'); @@ -26,10 +26,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/database/migrations/2020_10_12_123129_create_settings.php b/database/migrations/2020_10_12_123129_create_settings.php index 9063c2b..cf4f5b4 100644 --- a/database/migrations/2020_10_12_123129_create_settings.php +++ b/database/migrations/2020_10_12_123129_create_settings.php @@ -1,19 +1,19 @@ id(); $table->string('name')->comment('Nom du jeu'); $table->string('company')->comment('Nom de la société qui organise le jeu'); @@ -58,10 +58,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('settings'); } diff --git a/database/migrations/2020_10_20_165858_create_codes.php b/database/migrations/2020_10_20_165858_create_codes.php index dfd96d1..7245691 100644 --- a/database/migrations/2020_10_20_165858_create_codes.php +++ b/database/migrations/2020_10_20_165858_create_codes.php @@ -1,19 +1,19 @@ unsignedBigInteger('id')->primary(); $table->boolean('code_exported')->default(0)->comment('Has the code been exported ?'); $table->date('date_creation')->comment('Code creation date'); @@ -22,10 +22,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('codes'); } diff --git a/database/migrations/2020_10_23_094235_create_banned_ips.php b/database/migrations/2020_10_23_094235_create_banned_ips.php index bbdcc9e..281527b 100644 --- a/database/migrations/2020_10_23_094235_create_banned_ips.php +++ b/database/migrations/2020_10_23_094235_create_banned_ips.php @@ -1,19 +1,19 @@ id(); $table->string('ip', 50)->unique()->comment('IPv4 ou IPv6 Bannie (textual representation)'); $table->string('raison')->nullable()->comment('Raison du ban ?'); @@ -22,10 +22,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('banned_ips'); } diff --git a/database/migrations/2020_10_26_093014_create_faq_themes.php b/database/migrations/2020_10_26_093014_create_faq_themes.php index 5153231..79821b0 100644 --- a/database/migrations/2020_10_26_093014_create_faq_themes.php +++ b/database/migrations/2020_10_26_093014_create_faq_themes.php @@ -1,19 +1,19 @@ id(); $table->string('name'); $table->timestamps(); @@ -22,10 +22,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('faq_themes'); } diff --git a/database/migrations/2020_10_26_093746_create_faq_questions.php b/database/migrations/2020_10_26_093746_create_faq_questions.php index 1d7ce00..0ad5e9c 100644 --- a/database/migrations/2020_10_26_093746_create_faq_questions.php +++ b/database/migrations/2020_10_26_093746_create_faq_questions.php @@ -1,19 +1,19 @@ id(); $table->string('question'); $table->text('answer'); @@ -24,10 +24,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('faq_questions'); } diff --git a/database/migrations/2020_10_27_160038_create_discounts.php b/database/migrations/2020_10_27_160038_create_discounts.php index 9fa8434..b84ce9d 100644 --- a/database/migrations/2020_10_27_160038_create_discounts.php +++ b/database/migrations/2020_10_27_160038_create_discounts.php @@ -1,19 +1,19 @@ id(); $table->string('link')->comment('Lien généré par le client MesBr pour accéder au Coupon'); $table->string('basket_id')->comment('Identifiant du panier MesBr (spécifique au client)'); @@ -24,10 +24,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('discounts'); } diff --git a/database/migrations/2020_10_29_091811_create_prizes.php b/database/migrations/2020_10_29_091811_create_prizes.php index 56ece3f..d57dfe5 100644 --- a/database/migrations/2020_10_29_091811_create_prizes.php +++ b/database/migrations/2020_10_29_091811_create_prizes.php @@ -1,19 +1,19 @@ id(); $table->string('label')->comment('Libellé'); @@ -33,10 +33,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('prizes'); } diff --git a/database/migrations/2020_11_02_120718_create_jobs_table.php b/database/migrations/2020_11_02_120718_create_jobs_table.php index a786a89..2d2b211 100644 --- a/database/migrations/2020_11_02_120718_create_jobs_table.php +++ b/database/migrations/2020_11_02_120718_create_jobs_table.php @@ -1,19 +1,19 @@ bigIncrements('id'); $table->string('queue')->index(); $table->longText('payload'); @@ -26,10 +26,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('jobs'); } diff --git a/database/migrations/2021_08_18_154119_create_model_ranges_table.php b/database/migrations/2021_08_18_154119_create_model_ranges_table.php index fc0f3d8..f584f54 100644 --- a/database/migrations/2021_08_18_154119_create_model_ranges_table.php +++ b/database/migrations/2021_08_18_154119_create_model_ranges_table.php @@ -1,19 +1,19 @@ id(); $table->timestamps(); }); @@ -21,10 +21,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('model_ranges'); } diff --git a/database/migrations/2021_08_18_154140_create_ranges_table.php b/database/migrations/2021_08_18_154140_create_ranges_table.php index f127b01..48d4cbd 100644 --- a/database/migrations/2021_08_18_154140_create_ranges_table.php +++ b/database/migrations/2021_08_18_154140_create_ranges_table.php @@ -1,19 +1,19 @@ id(); $table->string('name')->comment('Nom de la gamme'); @@ -27,10 +27,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('ranges'); } diff --git a/database/migrations/2021_08_18_162010_create_products_table.php b/database/migrations/2021_08_18_162010_create_products_table.php index d853002..f8aa1d3 100644 --- a/database/migrations/2021_08_18_162010_create_products_table.php +++ b/database/migrations/2021_08_18_162010_create_products_table.php @@ -1,19 +1,19 @@ id(); $table->string('name')->comment('Nom du produit'); $table->string('picture')->nullable()->comment('Image du produit'); @@ -22,7 +22,7 @@ return new class extends Migration $table->string('ean_code')->comment('Code EAN du produit pour la participation au jeu'); - $table->foreignId('range_id')->before('created_at')->references('id') + $table->foreignId('range_id')->references('id') ->on('ranges')->onDelete('cascade'); $table->timestamps(); }); @@ -30,10 +30,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('products'); } diff --git a/database/migrations/2023_08_16_092101_create_customers_table.php b/database/migrations/2023_08_16_092101_create_customers_table.php index 7787d28..7552df6 100644 --- a/database/migrations/2023_08_16_092101_create_customers_table.php +++ b/database/migrations/2023_08_16_092101_create_customers_table.php @@ -1,19 +1,19 @@ id(); $table->string('email')->unique()->comment('Email du client'); @@ -32,10 +32,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('customers'); } diff --git a/database/migrations/2023_08_22_091935_create_participations.php b/database/migrations/2023_08_22_091935_create_participations.php index 8cc5a7c..cbc8ab6 100644 --- a/database/migrations/2023_08_22_091935_create_participations.php +++ b/database/migrations/2023_08_22_091935_create_participations.php @@ -1,19 +1,19 @@ id(); $table->string('ip')->comment('Adresse ip de la participation'); @@ -44,10 +44,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('participations'); } diff --git a/database/migrations/2023_08_22_120243_create_instant_wins.php b/database/migrations/2023_08_22_120243_create_instant_wins.php index 3d0f349..ab098a5 100644 --- a/database/migrations/2023_08_22_120243_create_instant_wins.php +++ b/database/migrations/2023_08_22_120243_create_instant_wins.php @@ -1,19 +1,19 @@ id(); $table->timestamp('available_at') ->comment('La date-heure à laquelle l\'instant gagnant pourras être gagné'); @@ -21,16 +21,14 @@ return new class extends Migration $table->foreignId('prize_id')->comment('Le lot qui à été gagné')->constrained('prizes'); $table->foreignId('participation_id') ->comment('Le customer participant qui à gagné avec les informations sur sa participation') - ->nullable()->constrained('participations')->unique(); + ->unique()->nullable()->constrained('participations'); }); } /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('instant_wins'); } diff --git a/database/migrations/2023_09_08_102717_create_actitivy_logs_table.php b/database/migrations/2023_09_08_102717_create_actitivy_logs_table.php index 9ecab6a..d7999c9 100644 --- a/database/migrations/2023_09_08_102717_create_actitivy_logs_table.php +++ b/database/migrations/2023_09_08_102717_create_actitivy_logs_table.php @@ -1,24 +1,26 @@ id(); - $table->foreignId('user_id')->nullable()->constrained('users') + $table->foreignId('user_id') + ->comment('Id of the user associated, or nullable for a deleted user.') + ->nullable() + ->constrained('users') ->cascadeOnUpdate() - ->nullOnDelete() - ->comment('Id of the user associated, or nullable for a deleted user.'); + ->nullOnDelete(); $table->boolean('is_anonymous')->comment('If there is no user connected when action was realised.'); $table->boolean('is_console')->comment('If the action was realised in console.'); $table->string('model_class')->comment('Target model.'); @@ -31,8 +33,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2023_10_19_094711_create_static_pages.php b/database/migrations/2023_10_19_094711_create_static_pages.php index 9ce6b75..003336e 100644 --- a/database/migrations/2023_10_19_094711_create_static_pages.php +++ b/database/migrations/2023_10_19_094711_create_static_pages.php @@ -1,19 +1,19 @@ id(); $table->unsignedTinyInteger('type')->unique()->comment('Page type (StaticPageEnum)'); @@ -32,8 +32,6 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/migrations/2025_05_27_100925_delete_model_ranges_table.php b/database/migrations/2025_05_27_100925_delete_model_ranges_table.php index 2bdbe00..aace00f 100644 --- a/database/migrations/2025_05_27_100925_delete_model_ranges_table.php +++ b/database/migrations/2025_05_27_100925_delete_model_ranges_table.php @@ -1,30 +1,27 @@ id(); $table->timestamps(); }); diff --git a/database/migrations/2025_07_23_100002_add_codes_types_settings_table.php b/database/migrations/2025_07_23_100002_add_codes_types_settings_table.php index 519781c..7d7dea0 100644 --- a/database/migrations/2025_07_23_100002_add_codes_types_settings_table.php +++ b/database/migrations/2025_07_23_100002_add_codes_types_settings_table.php @@ -1,19 +1,19 @@ dropColumn('use_ean_codes'); $table->unsignedTinyInteger('code_type')->comment('Type of codes used (CodeType Enum)') ->after('nb_unique_code_use'); @@ -22,12 +22,10 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { - Schema::table('settings', function (Blueprint $table) { + Schema::table('settings', function (Blueprint $table): void { $table->dropColumn('code_type'); $table->boolean('use_ean_codes')->comment('Le joueur doivent entrer le code EAN du produit porteur') ->after('nb_unique_code_use'); diff --git a/database/migrations/2025_07_25_120419_set_code_unique_id_nullable_participations_table.php b/database/migrations/2025_07_25_120419_set_code_unique_id_nullable_participations_table.php index a362bb5..1914fe1 100644 --- a/database/migrations/2025_07_25_120419_set_code_unique_id_nullable_participations_table.php +++ b/database/migrations/2025_07_25_120419_set_code_unique_id_nullable_participations_table.php @@ -1,23 +1,23 @@ dropForeign('participations_code_unique_id_foreign'); $table->dropColumn('code_unique_id'); }); - Schema::table('participations', function (Blueprint $table) { + Schema::table('participations', function (Blueprint $table): void { $table->foreignId('code_unique_id')->nullable()->comment('Code unique utilisé') ->after('customer_id')->constrained('codes'); }); @@ -25,16 +25,14 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { - Schema::table('participations', function (Blueprint $table) { + Schema::table('participations', function (Blueprint $table): void { $table->dropForeign('participations_code_unique_id_foreign'); $table->dropColumn('code_unique_id'); }); - Schema::table('participations', function (Blueprint $table) { + Schema::table('participations', function (Blueprint $table): void { $table->foreignId('code_unique_id')->nullable(false)->comment('Code unique utilisé') ->after('customer_id')->constrained('codes'); }); diff --git a/database/migrations/2025_08_05_163038_add_authorized_countries_in_settings_table.php b/database/migrations/2025_08_05_163038_add_authorized_countries_in_settings_table.php index 069e67a..c03bfb1 100644 --- a/database/migrations/2025_08_05_163038_add_authorized_countries_in_settings_table.php +++ b/database/migrations/2025_08_05_163038_add_authorized_countries_in_settings_table.php @@ -1,19 +1,19 @@ json('authorized_countries')->after('discounts_campaign') ->comment('All countries eligible to participate.'); }); @@ -21,12 +21,10 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ public function down(): void { - Schema::table('settings', function (Blueprint $table) { + Schema::table('settings', function (Blueprint $table): void { $table->dropColumn('authorized_countries'); }); } diff --git a/database/migrations/2025_09_05_145148_remove_all_discounts_datas.php b/database/migrations/2025_09_05_145148_remove_all_discounts_datas.php index f018c32..9440a4a 100644 --- a/database/migrations/2025_09_05_145148_remove_all_discounts_datas.php +++ b/database/migrations/2025_09_05_145148_remove_all_discounts_datas.php @@ -1,17 +1,19 @@ dropConstrainedForeignId('discount_id'); $table->string('discount_code', 50)->nullable()->after('barcode')->comment('Code de traitement du BR'); }); @@ -23,14 +25,14 @@ return new class extends Migration */ public function down(): void { - Schema::create('discounts', function (Blueprint $table) { + Schema::create('discounts', function (Blueprint $table): void { $table->id(); $table->string('link')->comment('Lien généré par le client MesBr pour accéder au Coupon'); $table->string('basket_id')->comment('Identifiant du panier MesBr (spécifique au client)'); $table->string('verification')->comment('Lien généré par le client MesBr pour ??'); $table->timestamps(); }); - Schema::table('participations', function (Blueprint $table) { + Schema::table('participations', function (Blueprint $table): void { $table->foreignId('discount_id')->nullable() ->comment('Bon de réduction gagné')->constrained('discounts'); $table->dropColumn('discount_code'); diff --git a/database/migrations/2030_01_01_000001_mandatory_seeds.php b/database/migrations/2030_01_01_000001_mandatory_seeds.php index 9d718ce..debeb7d 100644 --- a/database/migrations/2030_01_01_000001_mandatory_seeds.php +++ b/database/migrations/2030_01_01_000001_mandatory_seeds.php @@ -1,27 +1,25 @@ MandatorySeeder::class + 'class' => MandatorySeeder::class, ]); } /** * Reverse the migrations. - * - * @return void */ public function down(): void { diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 7e8541e..e521d97 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -1,5 +1,7 @@ call([ MandatorySeeder::class, DevelopmentSeeder::class, - UserSeeder::class + UserSeeder::class, ]); } } diff --git a/database/seeders/Development/BannedIpSeeder.php b/database/seeders/Development/BannedIpSeeder.php index b9ada1c..aa1b987 100644 --- a/database/seeders/Development/BannedIpSeeder.php +++ b/database/seeders/Development/BannedIpSeeder.php @@ -1,5 +1,7 @@ truncate(); @@ -31,11 +32,12 @@ class PrizeSeeder extends Seeder $prize->label = 'Wonderbox Sportives et aventurières'; $prize->arg_title = 'Wonderbox Sportives et aventurières'; $prize->arg_subtitle = '1 activité pour 2 à 6 personnes'; - // phpcs:ignore Generic.Files.LineLength.TooLong + // @phpcs:disable Generic.Files.LineLength.MaxExceeded $prize->arg_content = '1640 activités en famille : cinéma, visite d’un zoo ou d’un château, spectacle au théâtre, cirque, balade en bateau, randonnée équestre, atelier culinaire… Les petits et les grands vont se régaler : sortie à l’aquarium de Paris pour faire connaissance avec ses 10 000 pensionnaires, atelier culinaire pour savourer une bonne dose de bonheur, découverte du bassin de la Villette en bateau électrique, rencontre avec le nouveau monde de Mini World Lyon…'; + // @phpcs:enable $prize->picture = FileStorageHelper::storeFile( new Prize(), - new \SplFileInfo( + new SplFileInfo( \resource_path('../database/factories/assets/prizes/lot-1.png') ) ); @@ -48,11 +50,12 @@ class PrizeSeeder extends Seeder $prize->label = 'Wonderbox Happy Day'; $prize->arg_title = 'Wonderbox Happy Day'; $prize->arg_subtitle = '1 activité pour 1 à 2 personnes'; - // phpcs:ignore Generic.Files.LineLength.TooLong + // phpcs:ignore Generic.Files.LineLength.MaxExceeded $prize->arg_content = 'Plus de 2500 activités : laser game, bowling, balade en canoë, cinéma, repas, dégustation de macarons… Besoin d’une super activité pour déconnecter ? Soyez prêts, vous allez adorer cette journée : parties de bowling endiablées à Châlons-en-Champagne, séance de Taï Chi ou de Wing Chung à Bordeaux ou pizza à déguster face à Notre-Dame de Paris… Voici tout ce dont vous avez besoin pour apprécier un Happy Day !'; + // @phpcs:enable $prize->picture = FileStorageHelper::storeFile( new Prize(), - new \SplFileInfo( + new SplFileInfo( \resource_path('../database/factories/assets/prizes/lot-2.png') ) ); diff --git a/database/seeders/Development/ProductSeeder.php b/database/seeders/Development/ProductSeeder.php index 067bdb0..2835e5c 100644 --- a/database/seeders/Development/ProductSeeder.php +++ b/database/seeders/Development/ProductSeeder.php @@ -1,5 +1,7 @@ call(RangeSeeder::class); - Range::all()->each(function (Range $range) { - Product::factory(6)->make()->each(function (Product $product) use ($range) { + Range::all()->each(function (Range $range): void { + Product::factory(6)->make()->each(function (Product $product) use ($range): void { $product->picture = FileStorageHelper::storeFile( new Range(), - new \SplFileInfo( + new SplFileInfo( \resource_path('../database/factories/assets/products/default-picture-550x550.jpg') ) ); diff --git a/database/seeders/Development/QuestionSeeder.php b/database/seeders/Development/QuestionSeeder.php index a72472e..526b7dd 100644 --- a/database/seeders/Development/QuestionSeeder.php +++ b/database/seeders/Development/QuestionSeeder.php @@ -1,5 +1,7 @@ truncate(); Schema::enableForeignKeyConstraints(); - FaqTheme::factory(4)->create()->each(function (FaqTheme $question_theme) { + FaqTheme::factory(4)->create()->each(function (FaqTheme $question_theme): void { FaqQuestion::factory(fake()->numberBetween(2, 6))->make() - ->each(function (FaqQuestion $faq_question) use ($question_theme) { + ->each(function (FaqQuestion $faq_question) use ($question_theme): void { $faq_question->theme()->associate($question_theme); $faq_question->save(); }); diff --git a/database/seeders/Development/RangeSeeder.php b/database/seeders/Development/RangeSeeder.php index 2fecd96..34d4182 100644 --- a/database/seeders/Development/RangeSeeder.php +++ b/database/seeders/Development/RangeSeeder.php @@ -1,24 +1,25 @@ make()->each(function (Range $range) { + Range::factory(6)->make()->each(function (Range $range): void { $range->picture = FileStorageHelper::storeFile( new Range(), - new \SplFileInfo( + new SplFileInfo( \resource_path('../database/factories/assets/ranges/default-picture-476x355.jpg') ) ); diff --git a/database/seeders/DevelopmentSeeder.php b/database/seeders/DevelopmentSeeder.php index faaf20e..09bd82b 100644 --- a/database/seeders/DevelopmentSeeder.php +++ b/database/seeders/DevelopmentSeeder.php @@ -1,5 +1,7 @@ activated_teaser = false; $settings->activated_close_page = false; $settings->notify_prize_sent = false; - $settings->redirect_close = "https://example.test"; + $settings->redirect_close = 'https://example.test'; $settings->discounts_activated = false; $settings->authorized_countries = []; $settings->notification_emails = []; $settings->web_coupons = []; - $settings->winning_proof = 0; + $settings->winning_proof = false; $settings->save(); } } diff --git a/database/seeders/Mandatory/StaticPageSeeder.php b/database/seeders/Mandatory/StaticPageSeeder.php index 434cd2a..1b7c0fe 100644 --- a/database/seeders/Mandatory/StaticPageSeeder.php +++ b/database/seeders/Mandatory/StaticPageSeeder.php @@ -1,5 +1,7 @@ truncate(); StaticPage::query()->updateOrCreate( diff --git a/database/seeders/MandatorySeeder.php b/database/seeders/MandatorySeeder.php index 1d86c5d..b92d8a6 100644 --- a/database/seeders/MandatorySeeder.php +++ b/database/seeders/MandatorySeeder.php @@ -1,5 +1,7 @@ call([ SettingsSeeder::class, - StaticPageSeeder::class + StaticPageSeeder::class, ]); } } diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index d46aee1..1bed8b9 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -1,5 +1,7 @@ create(); } diff --git a/package-lock.json b/package-lock.json index 695db21..7636974 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "@vue/tsconfig": "^0.9.1", "autoprefixer": "^10.5.0", "eslint": "^10.4.1", + "eslint-formatter-junit": "^9.0.1", "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-vue": "^10.9.2", @@ -4638,6 +4639,16 @@ } } }, + "node_modules/eslint-formatter-junit": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/eslint-formatter-junit/-/eslint-formatter-junit-9.0.1.tgz", + "integrity": "sha512-0MrNGXg2C46M/ImjWuClHSGKHBR0eSBPfYHqPgYmB0utq7Jog3YyLBmbshNvo/Ba/Al3zClPWdd6/jnxk2F+9Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, "node_modules/eslint-import-context": { "version": "0.1.9", "resolved": "https://registry.npmjs.org/eslint-import-context/-/eslint-import-context-0.1.9.tgz", diff --git a/package.json b/package.json index faa5931..7583222 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,12 @@ "prod": "vite build --mode production", "dev": "NODE_ENV=development vite build -d --mode development", "watch": "NODE_ENV=development vite build --mode development --watch", - "eslint": "eslint --max-warnings 0 ./resources/ts ./resources/theme/mounted/ts", + "eslint": "eslint --max-warnings 0 --no-error-on-unmatched-pattern ./resources/ts ./resources/theme/mounted/ts", "eslint-fix": "eslint --fix --max-warnings 0 ./resources/ts ./resources/theme/mounted/ts", - "stylelint": "stylelint --config './.stylelintrc.json' --max-warnings 0 'resources/sass/**/*.scss' 'resources/theme/mounted/**/*.scss'", - "stylelint-fix": "stylelint --config './.stylelintrc.json' --fix --max-warnings 0 'resources/sass/**/*.scss' 'resources/theme/mounted/**/*.scss'" + "eslint-ci": "eslint --max-warnings 0 --no-error-on-unmatched-pattern ./resources/ts ./resources/theme/mounted/ts -f junit", + "stylelint": "stylelint --config './.stylelintrc.json' --max-warnings 0 --allow-empty-input 'resources/sass/**/*.scss' 'resources/theme/mounted/**/*.scss'", + "stylelint-fix": "stylelint --config './.stylelintrc.json' --fix --max-warnings 0 'resources/sass/**/*.scss' 'resources/theme/mounted/**/*.scss'", + "stylelint-ci": "stylelint --config './.stylelintrc.json' --max-warnings 0 --allow-empty-input 'resources/sass/**/*.scss' 'resources/theme/mounted/**/*.scss' -f json" }, "devDependencies": { "@fortawesome/fontawesome-svg-core": "^7.3.1", @@ -29,6 +31,7 @@ "@vue/tsconfig": "^0.9.1", "autoprefixer": "^10.5.0", "eslint": "^10.4.1", + "eslint-formatter-junit": "^9.0.1", "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-import-x": "^4.17.1", "eslint-plugin-vue": "^10.9.2", diff --git a/phpcs.xml b/phpcs.xml index a5cae59..93ad217 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,67 +1,58 @@ - + - Standard optimisé : Analyse statique complémentaire à Pint. + Standard optimisé: Analyse statique complémentaire à Pint. - - - - app/ - config/ - database/ - routes/ - tests/ + + + + app/ + bootstrap/ + config/ + database/ + routes/ - */vendor/* - */storage/* - _ide_helper.php - */tests/* + bootstrap/cache/* + */vendor/* + */storage/* + _ide_helper.php + */tests/* + *.blade.php - + - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + - - + + - - - - - - + + + + + + - - - - - - - - - - - - - */database/migrations/* - + + */database/migrations/* + diff --git a/phpstan.neon b/phpstan.neon index b10f8f8..7b7e1a6 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,13 +1,20 @@ includes: - vendor/larastan/larastan/extension.neon + - vendor/nesbot/carbon/extension.neon + - vendor/pestphp/pest/extension.neon + - vendor/phpstan/phpstan-webmozart-assert/extension.neon parameters: - paths: - app/ + - bootstrap/ + - config/ + - database/ + - resources/lang/ + - routes/ + - tests/ - excludePaths: - - app/Lib/vendor/ - - # Level 9 is the highest level level: 5 + + # Enforce strict types analysis + treatPhpDocTypesAsCertain: false diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..ff0586c --- /dev/null +++ b/pint.json @@ -0,0 +1,78 @@ +{ + "preset": "psr12", + "version": "1.0.0", + "rules": { + "indentation_type": true, + "single_line_empty_body": false, + "types_spaces": { + "space": "single", + "space_multiple_catch": "single" + }, + "control_structure_braces": true, + "new_with_parentheses": { + "anonymous_class": true, + "named_class": true + }, + "class_definition": { + "single_item_single_line": false, + "single_line": false, + "space_before_parenthesis": true + }, + "curly_braces_position": { + "allow_single_line_empty_anonymous_classes": false, + "classes_opening_brace": "next_line_unless_newline_at_signature_end", + "anonymous_classes_opening_brace": "next_line_unless_newline_at_signature_end", + "control_structures_opening_brace": "same_line", + "functions_opening_brace": "next_line_unless_newline_at_signature_end", + "anonymous_functions_opening_brace": "same_line" + }, + "binary_operator_spaces": { + "default": "align_single_space_minimal", + "operators": { + "=": "align_single_space", + "|": "single_space", + "=>": "align_single_space", + ".=": "align_single_space" + } + }, + "concat_space": { + "spacing": "one" + }, + "align_multiline_comment": { + "comment_type": "all_multiline" + }, + "array_indentation": true, + "method_chaining_indentation": true, + "statement_indentation": { + "stick_comment_to_next_continuous_control_statement": true + }, + "no_unused_imports": true, + "fully_qualified_strict_types": { + "import_symbols": true, + "leading_backslash_in_global_namespace": true, + "phpdoc_tags": [] + }, + "visibility_required": { + "elements": [ + "const", + "method", + "property" + ] + }, + "no_useless_else": true, + "function_declaration": { + "closure_function_spacing": "one", + "closure_fn_spacing": "one", + "trailing_comma_single_line": false + }, + "single_line_after_imports": true, + "combine_consecutive_issets": true, + "array_syntax": { + "syntax": "short" + }, + "single_quote": true, + "blank_line_after_namespace": true, + "blank_line_after_opening_tag": true, + "declare_strict_types": true + } +} diff --git a/public/index.php b/public/index.php index 70f7a93..fd96756 100644 --- a/public/index.php +++ b/public/index.php @@ -1,12 +1,15 @@ */ - define('LARAVEL_START', microtime(true)); if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) { @@ -23,9 +26,9 @@ if (file_exists(__DIR__ . '/../storage/framework/maintenance.php')) { | into the script here so that we don't have to worry about manual | loading any of our classes later on. It feels great to relax. | -*/ + */ -require __DIR__.'/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- @@ -37,9 +40,9 @@ require __DIR__.'/../vendor/autoload.php'; | will load up this application so that we can run it and send | the responses back to the browser and delight our users. | -*/ + */ -$app = require_once __DIR__.'/../bootstrap/app.php'; +$app = require_once __DIR__ . '/../bootstrap/app.php'; /* |-------------------------------------------------------------------------- @@ -51,12 +54,12 @@ $app = require_once __DIR__.'/../bootstrap/app.php'; | the client's browser allowing them to enjoy the creative | and wonderful application we have prepared for them. | -*/ + */ -$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); +$kernel = $app->make(Kernel::class); $response = $kernel->handle( - $request = Illuminate\Http\Request::capture() + $request = Request::capture() ); $response->send(); diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..b5ec038 --- /dev/null +++ b/rector.php @@ -0,0 +1,35 @@ +withPaths([ + __DIR__ . '/app', + __DIR__ . '/bootstrap/app.php', + __DIR__ . '/config', + __DIR__ . '/database', + __DIR__ . '/resources/lang', + __DIR__ . '/routes', + __DIR__ . '/tests', + ]) + ->withPhpSets() + ->withSets([ + SetList::PHP_POLYFILLS, + SetList::CODE_QUALITY, + SetList::DEAD_CODE, + SetList::PRIVATIZATION, + SetList::TYPE_DECLARATION, + SetList::EARLY_RETURN, + SetList::INSTANCEOF, + SetList::IF, + ]) + ->withSkip([ + RemoveUnusedPrivateClassConstantRector::class => [ + __DIR__ . '/app/Enums', + ], + ]); +; diff --git a/resources/lang/de.json b/resources/lang/de.json index b80b473..8aaf8a6 100644 --- a/resources/lang/de.json +++ b/resources/lang/de.json @@ -1,54 +1,245 @@ { "(and :count more error)": "(und :count weiterer Fehler)", - "(and :count more errors)": "(und :count weitere Fehler)", + "(and :count more errors)": "(und :count weiterer Fehler)|(und :count weitere Fehler)|(und :count weitere Fehler)", + "A decryption key is required.": "Ein Entschlüsselungsschlüssel ist nötig.", "A fresh verification link has been sent to your email address.": "Ein neuer Bestätigungslink wurde an Ihre E-Mail-Adresse gesendet.", + "A Timeout Occurred": "Eine Zeitüberschreitung ist aufgetreten", + "Accept": "Akzeptieren", + "Accepted": "Akzeptiert", + "Action": "Aktion", + "Actions": "Aktionen", + "Add": "Hinzufügen", + "Add :name": ":name hinzufügen", + "Admin": "Administrator", + "Agree": "Zustimmen", "All rights reserved.": "Alle Rechte vorbehalten.", + "Already Reported": "Bereits gemeldet", + "Archive": "Archiv", + "Assign": "Zuordnen", + "Associate": "Assoziieren", + "Attach": "Anhängen", + "Bad Gateway": "Fehlerhaftes Gateway", + "Bad Request": "Ungültige Anfrage", + "Bandwidth Limit Exceeded": "Bandbreitenlimit überschritten", "Before proceeding, please check your email for a verification link.": "Bevor Sie fortfahren, überprüfen Sie bitte Ihre E-Mail auf einen Bestätigungslink.", - "click here to request another": "hier klicken, um einen neuen anzufordern", + "Browse": "Durchsuchen", + "Cancel": "Abbrechen", + "Choose": "Wählen Sie", + "Choose :name": "Wählen Sie :name", + "Choose File": "Datei wählen", + "Choose Image": "Bild wählen", + "click here to request another": "Klicken Sie hier, um eine weitere Anfrage zu starten", + "Click to copy": "Klicken Sie zum Kopieren", + "Client Closed Request": "Client hat die Anfrage geschlossen", + "Close": "Schließen", + "Collapse": "Zusammenklappen", + "Collapse All": "Alle zusammenklappen", + "Comment": "Kommentar", + "Confirm": "Bestätigen", "Confirm Password": "Passwort bestätigen", + "Conflict": "Konflikt", + "Connect": "Verbinden", + "Connection Closed Without Response": "Verbindung ohne Antwort getrennt", + "Connection Timed Out": "Verbindungszeit überschritten", + "Continue": "Weiter", + "Create": "Erstellen", + "Create :name": ":name erstellen", + "Created": "Erstellt", "Dashboard": "Dashboard", + "Delete": "Löschen", + "Delete :name": ":name löschen", + "Detach": "Trennen", + "Details": "Details", + "Disable": "Deaktivieren", + "Discard": "Verwerfen", + "Done": "Erledigt", + "Down": "Runter", + "Duplicate": "Duplizieren", + "Duplicate :name": ":name duplizieren", + "Edit": "Bearbeiten", + "Edit :name": ":name bearbeiten", "Email Address": "E-Mail-Adresse", + "Enable": "Aktivieren", + "Encrypted environment file already exists.": "Verschlüsselte Umgebungsdatei ist bereits vorhanden.", + "Encrypted environment file not found.": "Verschlüsselte Umgebungsdatei nicht gefunden.", + "Environment file already exists.": "Umgebungsdatei ist bereits vorhanden.", + "Environment file not found.": "Umgebungsdatei nicht gefunden.", + "errors": "Fehler", + "Expand": "Erweitern", + "Expand All": "Alle erweitern", + "Expectation Failed": "Erwartung gescheitert", + "Explanation": "Erläuterung", + "Export": "Exportieren", + "Export :name": ":name exportieren", + "Failed Dependency": "Fehlgeschlagene Abhängigkeit", + "File": "Datei", + "Files": "Dateien", "Forbidden": "Verboten", "Forgot Your Password?": "Passwort vergessen?", - "Go to page :page": "Zur Seite :page gehen", + "Found": "Gefunden", + "Gateway Timeout": "Gateway-Zeitüberschreitung", + "Go Home": "Zur Startseite", + "Go to page :page": "Gehe zur Seite :page", + "Gone": "Nicht mehr verfügbar", "Hello!": "Hallo!", - "If you did not create an account, no further action is required.": "Wenn Sie kein Konto erstellt haben, ist keine weitere Aktion erforderlich.", + "Hide": "Verstecken", + "Hide :name": ":name ausblenden", + "Home": "Startseite", + "HTTP Version Not Supported": "HTTP Version nicht unterstützt", + "I'm a teapot": "Ich bin eine Teekanne", + "If you did not create an account, no further action is required.": "Wenn Sie kein Konto erstellt haben, sind keine weiteren Handlungen nötig.", "If you did not receive the email": "Wenn Sie die E-Mail nicht erhalten haben", - "If you did not request a password reset, no further action is required.": "Wenn Sie keine Passwortzurücksetzung angefordert haben, ist keine weitere Aktion erforderlich.", - "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Wenn Sie Probleme haben, auf die Schaltfläche \":actionText\" zu klicken, kopieren Sie die folgende URL\nund fügen Sie sie in Ihren Webbrowser ein:", - "Invalid JSON was returned from the route.": "Von der Route wurde ein ungültiges JSON zurückgegeben.", + "If you did not request a password reset, no further action is required.": "Wenn Sie kein Zurücksetzen des Passworts beantragt haben, sind keine weiteren Handlungen nötig.", + "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Sollten Sie Schwierigkeiten haben, die Schaltfläche \":actionText\" zu klicken, kopieren Sie den nachfolgenden Link\n in Ihre Adresszeile des Browsers.", + "IM Used": "IM verwendet", + "Image": "Bild", + "Impersonate": "Imitieren", + "Impersonation": "Identitätswechsel", + "Import": "Importieren", + "Import :name": "Importieren Sie :name", + "Insufficient Storage": "Nicht genügend Speicherplatz", + "Internal Server Error": "Interner Serverfehler", + "Introduction": "Einführung", + "Invalid filename.": "Ungültiger Dateiname.", + "Invalid JSON was returned from the route.": "Von der Route wurde ein ungültiger JSON-Code zurückgegeben.", + "Invalid SSL Certificate": "Ungültiges SSL-Zertifikat", + "length": "Länge", + "Length Required": "Längenangabe erforderlich", + "Like": "Wie", + "Load": "Belastung", + "Localize": "Lokalisieren", + "Location": "Standort", + "Locked": "Gesperrt", + "Log In": "Einloggen", + "Log Out": "Abmelden", "Login": "Anmelden", "Logout": "Abmelden", + "Loop Detected": "Endlosschleife erkannt", + "Maintenance Mode": "Wartungsmodus", + "Method Not Allowed": "Methode nicht erlaubt", + "Misdirected Request": "Fehlgeleitete Anfrage", + "Moved Permanently": "Permanent verschoben", + "Multi-Status": "Multistatus", + "Multiple Choices": "Mehrere Auswahlmöglichkeiten", "Name": "Name", + "Network Authentication Required": "Netzwerkauthentifizierung erforderlich", + "Network Connect Timeout Error": "Zeitüberschreitungsfehler bei Netzwerkverbindung", + "Network Read Timeout Error": "Zeitüberschreitungsfehler beim Lesen des Netzwerks", + "New": "Neu", + "New :name": "Neu :name", + "No": "Nein", + "No Content": "Kein Inhalt", + "Non-Authoritative Information": "Nicht maßgebende Informationen", + "Not Acceptable": "Nicht akzeptierbar", + "Not Extended": "Nicht erweitert", "Not Found": "Nicht gefunden", + "Not Implemented": "Nicht implementiert", + "Not Modified": "Nicht modifiziert", "of": "von", + "OK": "OK", + "Open": "Offen", + "Open in a current window": "In einem aktuellen Fenster öffnen", + "Open in a new window": "In einem neuen Fenster öffnen", + "Open in a parent frame": "In einem übergeordneten Frame öffnen", + "Open in the topmost frame": "Im obersten Rahmen öffnen", + "Open on the website": "Auf der Website öffnen", + "Origin Is Unreachable": "Quelle ist nicht erreichbar", "Page Expired": "Seite abgelaufen", - "Pagination Navigation": "Seitennavigation", + "Pagination Navigation": "Seiten-Navigation", + "Partial Content": "Teilinhalt", "Password": "Passwort", + "Payload Too Large": "Nutzlast zu groß", "Payment Required": "Zahlung erforderlich", - "Please click the button below to verify your email address.": "Bitte klicken Sie auf die Schaltfläche unten, um Ihre E-Mail-Adresse zu bestätigen.", + "Permanent Redirect": "Permanente Weiterleitung", + "Please click the button below to verify your email address.": "Bitte klicken Sie auf die Schaltfläche, um Ihre E-Mail-Adresse zu bestätigen.", "Please confirm your password before continuing.": "Bitte bestätigen Sie Ihr Passwort, bevor Sie fortfahren.", + "Precondition Failed": "Vorbedingung fehlgeschlagen", + "Precondition Required": "Voraussetzung erforderlich", + "Preview": "Vorschau", + "Price": "Preis", + "Processing": "In Bearbeitung", + "Proxy Authentication Required": "Proxy-Authentifizierung erforderlich", + "Railgun Error": "Railgun-Fehler", + "Range Not Satisfiable": "Bereich nicht erfüllbar", + "Record": "Aufzeichnen", "Regards": "Mit freundlichen Grüßen", + "Regards,": "Mit freundlichen Grüßen,", "Register": "Registrieren", "Remember Me": "Angemeldet bleiben", + "Request Header Fields Too Large": "Anfrage-Header-Felder zu groß", + "Request Timeout": "Zeitüberschreitung der Anfrage", + "Reset Content": "Inhalt zurücksetzen", "Reset Password": "Passwort zurücksetzen", - "Reset Password Notification": "Benachrichtigung zur Passwortzurücksetzung", - "results": "Ergebnisse", - "Send Password Reset Link": "Link zur Passwortzurücksetzung senden", - "Server Error": "Serverfehler", - "Service Unavailable": "Dienst nicht verfügbar", - "Showing": "Anzeige", - "The given data was invalid.": "Die angegebenen Daten waren ungültig.", + "Reset Password Notification": "Benachrichtigung zum Zurücksetzen des Passworts", + "Restore": "Wiederherstellen", + "Restore :name": ":name wiederherstellen", + "results": "Ergebnissen", + "Retry With": "Wiederhole mit", + "Save": "Speichern", + "Save & Close": "Speichern und schließen", + "Save & Return": "Speichern und zurückgeben", + "Save :name": "Sparen Sie :name", + "Search": "Suchen", + "Search :name": "Suche :name", + "See Other": "Siehe andere Seite", + "Select": "Wählen Sie", + "Select All": "Wählen Sie Alle", + "Send": "Schicken", + "Send Password Reset Link": "Link zum Zurücksetzen des Passworts senden", + "Server Error": "Interner Fehler", + "Service Unavailable": "Service nicht verfügbar", + "Session Has Expired": "Sitzung ist abgelaufen", + "Settings": "Einstellungen", + "Show": "Zeigen", + "Show :name": ":name anzeigen", + "Show All": "Zeige alles", + "Showing": "Zeige", + "Sign In": "Anmelden", + "Solve": "Lösen", + "SSL Handshake Failed": "SSL Handshake fehlgeschlagen", + "Start": "Starten", + "Stop": "Stoppen", + "Submit": "Einreichen", + "Subscribe": "Abonnieren", + "Switch": "Wechseln", + "Switch To Role": "Zur Rolle wechseln", + "Switching Protocols": "Protokollwechsel", + "Tag": "Stichwort", + "Tags": "Stichworte", + "Temporary Redirect": "Temporäre Weiterleitung", + "The given data was invalid.": "Die gegebenen Daten waren ungültig.", "The response is not a streamed response.": "Die Antwort ist keine gestreamte Antwort.", "The response is not a view.": "Die Antwort ist keine Ansicht.", - "This password reset link will expire in :count minutes.": "Dieser Link zur Passwortzurücksetzung läuft in :count Minuten ab.", + "This action is unauthorized.": "Diese Aktion ist nicht autorisiert.", + "This password reset link will expire in :count minutes.": "Dieser Link zum Zurücksetzen des Passworts läuft in :count Minuten ab.", "to": "bis", "Toggle navigation": "Navigation umschalten", + "Too Early": "Zu früh", "Too Many Requests": "Zu viele Anfragen", + "Translate": "Übersetzen", + "Translate It": "Übersetze es", "Unauthorized": "Nicht autorisiert", + "Unavailable For Legal Reasons": "Aus rechtlichen Gründen nicht verfügbar", + "Unknown Error": "Unbekannter Fehler", + "Unpack": "Auspacken", + "Unprocessable Entity": "Unverarbeitbare Entität", + "Unsubscribe": "Abbestellen", + "Unsupported Media Type": "Nicht unterstützter Medientyp", + "Up": "Hoch", + "Update": "Aktualisieren", + "Update :name": ":name aktualisieren", + "Upgrade Required": "Upgrade erforderlich", + "URI Too Long": "URI ist zu lang", + "Use Proxy": "Proxy verwenden", + "User": "Benutzer", + "Variant Also Negotiates": "Variante verhandelt ebenfalls", "Verify Email Address": "E-Mail-Adresse bestätigen", "Verify Your Email Address": "Bestätigen Sie Ihre E-Mail-Adresse", - "Whoops!": "Hoppla!", - "You are logged in!": "Sie sind angemeldet!", - "You are receiving this email because we received a password reset request for your account.": "Sie erhalten diese E-Mail, weil wir eine Anfrage zur Passwortzurücksetzung für Ihr Konto erhalten haben." -} + "View": "Ansicht", + "View :name": "Ansicht :name", + "Web Server is Down": "Webserver ist ausgefallen", + "Whoops!": "Ups!", + "Yes": "Ja", + "You are logged in!": "Sie sind eingeloggt!", + "You are receiving this email because we received a password reset request for your account.": "Sie erhalten diese E-Mail, weil wir einen Antrag auf eine Zurücksetzung Ihres Passworts bekommen haben." +} \ No newline at end of file diff --git a/resources/lang/de/cookie-notice.php b/resources/lang/de/cookie-notice.php index ce7e2af..7914ea8 100644 --- a/resources/lang/de/cookie-notice.php +++ b/resources/lang/de/cookie-notice.php @@ -1,5 +1,7 @@ 'Inhalt des Cookie-Verwaltungspanels', 'picture_cookie_title' => 'Bild eines schönen großen Kekses', 'navigation_title' => 'Navigation im Cookie-Panel', - 'custom' => [ + 'custom' => [ 'analytics' => [ 'title' => 'Google Analytics', 'description' => 'Dienste zur Zielgruppenmessung ermöglichen die Erstellung von Besucherstatistiken, die zur Verbesserung der Website nützlich sind.', @@ -41,6 +43,6 @@ return [ 'description' => 'Der Zweck der über das Recaptcha auf Formularen platzierten Cookies besteht darin, zu verhindern, dass diese von Robotern übermittelt werden.', 'labelLink' => 'Erfahren Sie mehr', 'warning' => 'Sie müssen reCAPTCHA Cookies akzeptieren, um das Formular senden zu können', - ] - ] + ], + ], ]; diff --git a/resources/lang/de/crud.php b/resources/lang/de/crud.php index cce9582..c8e6a1a 100644 --- a/resources/lang/de/crud.php +++ b/resources/lang/de/crud.php @@ -1,10 +1,11 @@ [ 'list' => 'Aufführen', 'view' => 'Sicht', - 'create' => 'Erstellen', 'update' => 'Aktualisieren', 'delete' => 'Löschen', 'create' => 'Erstellen', @@ -34,8 +35,8 @@ return [ 'toolbox' => [ 'assertFieldIsUnique' => 'Der :value für das :attribute wird bereits verwendet', 'assertNoInternalBoUrls' => ':attribute : Es ist verboten, Backoffice-URLs in dieses Feld einzufügen', - 'assertNoInternalUrls' => ':attribute : Es ist verboten, eine URL von „:appname“ in dieses Feld einzufügen' - ] + 'assertNoInternalUrls' => ':attribute : Es ist verboten, eine URL von „:appname“ in dieses Feld einzufügen', + ], ], 'messages' => [ @@ -89,5 +90,5 @@ return [ 'sort_delete' => 'Sortierung löschen', 'sort_arrow' => 'Hier werden die Pfeile zum Sortieren und nicht zum Filtern verwendet', 'right' => 'Sie haben keine Berechtigung', - ] + ], ]; diff --git a/resources/lang/de/front.php b/resources/lang/de/front.php index bc782e0..ce12128 100644 --- a/resources/lang/de/front.php +++ b/resources/lang/de/front.php @@ -1,4 +1,7 @@ [ 'password_reset_email_sent' => 'Falls Ihr Konto existiert, sollten Sie eine Nachricht mit einem Link zum Zurücksetzen Ihres Passworts erhalten.', diff --git a/resources/lang/de/http-statuses.php b/resources/lang/de/http-statuses.php index b35bf7d..58a68cf 100644 --- a/resources/lang/de/http-statuses.php +++ b/resources/lang/de/http-statuses.php @@ -5,37 +5,37 @@ declare(strict_types=1); return [ '0' => 'Unbekannter Fehler', '100' => 'Weiter', - '101' => 'Schaltprotokolle', - '102' => 'Verarbeitung', + '101' => 'Protokollwechsel', + '102' => 'In Bearbeitung', '200' => 'OK', '201' => 'Erstellt', '202' => 'Akzeptiert', - '203' => 'Nicht maßgebende Informationen', + '203' => 'Nicht verifizierte Information', '204' => 'Kein Inhalt', '205' => 'Inhalt zurücksetzen', '206' => 'Teilinhalt', - '207' => 'Multi-Status', + '207' => 'Multistatus', '208' => 'Bereits gemeldet', '226' => 'IM verwendet', - '300' => 'Mehrfachauswahl', + '300' => 'Mehrere Auswahlmöglichkeiten', '301' => 'Permanent verschoben', '302' => 'Gefunden', - '303' => 'Andere sehen', + '303' => 'Siehe andere Seite', '304' => 'Nicht modifiziert', '305' => 'Proxy verwenden', '307' => 'Temporäre Weiterleitung', '308' => 'Permanente Weiterleitung', - '400' => 'Schlechte Anfrage', + '400' => 'Ungültige Anfrage', '401' => 'Nicht autorisiert', '402' => 'Zahlung erforderlich', '403' => 'Verboten', - '404' => 'Seite nicht gefunden', + '404' => 'Nicht gefunden', '405' => 'Methode nicht erlaubt', '406' => 'Nicht annehmbar', '407' => 'Proxy-Authentifizierung erforderlich', - '408' => 'Zeitüberschreitung anfordern', + '408' => 'Zeitüberschreitung der Anfrage', '409' => 'Konflikt', - '410' => 'Gegangen', + '410' => 'Nicht mehr verfügbar', '411' => 'Länge erforderlich', '412' => 'Vorbedingung fehlgeschlagen', '413' => 'Nutzlast zu groß', @@ -46,35 +46,35 @@ return [ '418' => 'Ich bin eine Teekanne', '419' => 'Sitzung ist abgelaufen', '421' => 'Fehlgeleitete Anfrage', - '422' => 'Unverfügbare Entität', + '422' => 'Unverarbeitbare Entität', '423' => 'Gesperrt', '424' => 'Fehlgeschlagene Abhängigkeit', '425' => 'Zu früh', '426' => 'Upgrade erforderlich', '428' => 'Voraussetzung erforderlich', '429' => 'Zu viele Anfragen', - '431' => 'Kopfzeilenfelder zu groß anfordern', + '431' => 'Anfrage-Header-Felder zu groß', '444' => 'Verbindung ohne Antwort geschlossen', '449' => 'Wiederhole mit', '451' => 'Aus rechtlichen Gründen nicht verfügbar', '499' => 'Client-Closed-Request', '500' => 'Interner Serverfehler', '501' => 'Nicht implementiert', - '502' => 'Schlechtes Tor', + '502' => 'Fehlerhaftes Gateway', '503' => 'Wartungsmodus', '504' => 'Gateway-Zeitüberschreitung', '505' => 'HTTP Version nicht unterstützt', '506' => 'Variante verhandelt auch', - '507' => 'Ungenügende Speicherung', - '508' => 'Schleife erkannt', - '509' => 'Bandbreitengrenze überschritten', + '507' => 'Nicht genügend Speicherplatz', + '508' => 'Endlosschleife erkannt', + '509' => 'Bandbreitenlimit überschritten', '510' => 'Nicht erweitert', '511' => 'Netzwerkauthentifizierung erforderlich', '520' => 'Unbekannter Fehler', '521' => 'Webserver ist ausgefallen', '522' => 'Verbindung abgelaufen', - '523' => 'Ursprung ist nicht erreichbar', - '524' => 'Ein Timeout ist aufgetreten', + '523' => 'Quelle ist nicht erreichbar', + '524' => 'Eine Zeitüberschreitung ist aufgetreten', '525' => 'SSL Handshake fehlgeschlagen', '526' => 'Ungültiges SSL-Zertifikat', '527' => 'Railgun-Fehler', diff --git a/resources/lang/de/models.php b/resources/lang/de/models.php index f848b6c..fd59a0a 100644 --- a/resources/lang/de/models.php +++ b/resources/lang/de/models.php @@ -1,5 +1,7 @@ [ 'user' => 'benutzer', @@ -14,5 +16,5 @@ return [ 'settings' => 'einstellungen', 'product' => 'produkt', 'participation' => 'teilnahme', - ] + ], ]; diff --git a/resources/lang/de/pagination.php b/resources/lang/de/pagination.php index bfc3556..76c19d0 100644 --- a/resources/lang/de/pagination.php +++ b/resources/lang/de/pagination.php @@ -4,9 +4,9 @@ declare(strict_types=1); return [ 'next' => 'Weiter »', + 'next_page' => 'Nächste Seite', + 'paginate_list' => 'Anzahl der Elemente pro Seite', 'previous' => '« Zurück', 'previous_page' => 'Vorherige Seite', - 'next_page' => 'Nächste Seite', 'specific_page' => 'Zur Seite Nr. :id gehen', - 'paginate_list' => 'Anzahl der Elemente pro Seite', ]; diff --git a/resources/lang/de/passwords.php b/resources/lang/de/passwords.php index 649e99a..9634bdd 100644 --- a/resources/lang/de/passwords.php +++ b/resources/lang/de/passwords.php @@ -4,8 +4,8 @@ declare(strict_types=1); return [ 'reset' => 'Das Passwort wurde zurückgesetzt!', - 'sent' => 'Passworterinnerung wurde gesendet!', + 'sent' => 'E-Mail zum Zurücksetzen des Passworts wurde gesendet!', 'throttled' => 'Bitte warten Sie, bevor Sie es erneut versuchen.', - 'token' => 'Der Passwort-Wiederherstellungs-Schlüssel ist ungültig oder abgelaufen.', - 'user' => 'Es konnte leider kein Nutzer mit dieser E-Mail Adresse gefunden werden.', + 'token' => 'Der Passwort-Wiederherstellungsschlüssel ist ungültig oder abgelaufen.', + 'user' => 'Es konnte leider kein Nutzer mit dieser E-Mail-Adresse gefunden werden.', ]; diff --git a/resources/lang/de/recaptcha.php b/resources/lang/de/recaptcha.php index db914af..bcfb3cd 100644 --- a/resources/lang/de/recaptcha.php +++ b/resources/lang/de/recaptcha.php @@ -1,6 +1,8 @@ 'Bei der Formularvalidierung ist ein Fehler aufgetreten, bitte versuchen Sie es erneut', - 'not_enough_score' => 'Sie haben bei der reCAPTCHA-Validierung keine ausreichend hohe Punktzahl erreicht' + 'not_enough_score' => 'Sie haben bei der reCAPTCHA-Validierung keine ausreichend hohe Punktzahl erreicht', ]; diff --git a/resources/lang/de/validation.php b/resources/lang/de/validation.php index 994b1dc..4bfc691 100644 --- a/resources/lang/de/validation.php +++ b/resources/lang/de/validation.php @@ -3,177 +3,222 @@ declare(strict_types=1); return [ - 'accepted' => ':Attribute muss akzeptiert werden.', - 'accepted_if' => ':Attribute muss akzeptiert werden, wenn :other :value ist.', - 'active_url' => ':Attribute ist keine gültige Internet-Adresse.', - 'after' => ':Attribute muss ein Datum nach :date sein.', - 'after_or_equal' => ':Attribute muss ein Datum nach :date oder gleich :date sein.', - 'alpha' => ':Attribute darf nur aus Buchstaben bestehen.', - 'alpha_dash' => ':Attribute darf nur aus Buchstaben, Zahlen, Binde- und Unterstrichen bestehen.', - 'alpha_num' => ':Attribute darf nur aus Buchstaben und Zahlen bestehen.', - 'array' => ':Attribute muss ein Array sein.', - 'ascii' => 'Die :attribute darf nur alphanumerische Single-Byte-Zeichen und -Symbole enthalten.', - 'before' => ':Attribute muss ein Datum vor :date sein.', - 'before_or_equal' => ':Attribute muss ein Datum vor :date oder gleich :date sein.', - 'between' => [ + 'accepted' => ':Attribute muss akzeptiert werden.', + 'accepted_if' => ':Attribute muss akzeptiert werden, wenn :other :value ist.', + 'active_url' => ':Attribute ist keine gültige Internet-Adresse.', + 'after' => ':Attribute muss ein Datum nach :date sein.', + 'after_or_equal' => ':Attribute muss ein Datum nach :date oder gleich :date sein.', + 'alpha' => ':Attribute darf nur aus Buchstaben bestehen.', + 'alpha_dash' => ':Attribute darf nur aus Buchstaben, Zahlen, Binde- und Unterstrichen bestehen.', + 'alpha_num' => ':Attribute darf nur aus Buchstaben und Zahlen bestehen.', + 'array' => ':Attribute muss ein Array sein.', + 'ascii' => 'Die :attribute darf nur alphanumerische Single-Byte-Zeichen und -Symbole enthalten.', + 'before' => ':Attribute muss ein Datum vor :date sein.', + 'before_or_equal' => ':Attribute muss ein Datum vor :date oder gleich :date sein.', + 'between' => [ 'array' => ':Attribute muss zwischen :min & :max Elemente haben.', 'file' => ':Attribute muss zwischen :min & :max Kilobytes groß sein.', 'numeric' => ':Attribute muss zwischen :min & :max liegen.', 'string' => ':Attribute muss zwischen :min & :max Zeichen lang sein.', ], - 'boolean' => ':Attribute muss entweder \'true\' oder \'false\' sein.', - 'can' => 'Le champ :attribute contient une valeur non autorisée.', - 'confirmed' => ':Attribute stimmt nicht mit der Bestätigung überein.', - 'current_password' => 'Das Passwort ist falsch.', - 'date' => ':Attribute muss ein gültiges Datum sein.', - 'date_equals' => ':Attribute muss ein Datum gleich :date sein.', - 'date_format' => ':Attribute entspricht nicht dem gültigen Format für :format.', - 'decimal' => 'Die :attribute muss :decimal Dezimalstellen haben.', - 'declined' => ':Attribute muss abgelehnt werden.', - 'declined_if' => ':Attribute muss abgelehnt werden wenn :other :value ist.', - 'different' => ':Attribute und :other müssen sich unterscheiden.', - 'digits' => ':Attribute muss :digits Stellen haben.', - 'digits_between' => ':Attribute muss zwischen :min und :max Stellen haben.', - 'dimensions' => ':Attribute hat ungültige Bildabmessungen.', - 'distinct' => ':Attribute beinhaltet einen bereits vorhandenen Wert.', - 'doesnt_end_with' => ':Attribute darf nicht mit einem der folgenden enden: :values.', - 'doesnt_start_with' => ':Attribute darf nicht mit einem der folgenden beginnen: :values.', - 'email' => ':Attribute muss eine gültige E-Mail-Adresse sein.', - 'ends_with' => ':Attribute muss eine der folgenden Endungen aufweisen: :values', - 'enum' => 'Der ausgewählte Wert ist ungültig.', - 'exists' => 'Der gewählte Wert für :attribute ist ungültig.', - 'file' => ':Attribute muss eine Datei sein.', - 'filled' => ':Attribute muss ausgefüllt sein.', - 'gt' => [ + 'boolean' => ':Attribute muss entweder \'true\' oder \'false\' sein.', + 'can' => 'Das Feld :attribute enthält einen nicht autorisierten Wert.', + 'confirmed' => ':Attribute stimmt nicht mit der Bestätigung überein.', + 'contains' => 'Dem Feld :attribute fehlt ein erforderlicher Wert.', + 'current_password' => 'Das Passwort ist falsch.', + 'date' => ':Attribute muss ein gültiges Datum sein.', + 'date_equals' => ':Attribute muss ein Datum gleich :date sein.', + 'date_format' => ':Attribute entspricht nicht dem gültigen Format für :format.', + 'decimal' => 'Die :attribute muss :decimal Dezimalstellen haben.', + 'declined' => ':Attribute muss abgelehnt werden.', + 'declined_if' => ':Attribute muss abgelehnt werden wenn :other :value ist.', + 'different' => ':Attribute und :other müssen sich unterscheiden.', + 'digits' => ':Attribute muss :digits Stellen haben.', + 'digits_between' => ':Attribute muss zwischen :min und :max Stellen haben.', + 'dimensions' => ':Attribute hat ungültige Bildabmessungen.', + 'distinct' => ':Attribute beinhaltet einen bereits vorhandenen Wert.', + 'doesnt_end_with' => ':Attribute darf nicht mit einem der folgenden enden: :values.', + 'doesnt_start_with' => ':Attribute darf nicht mit einem der folgenden beginnen: :values.', + 'ean' => 'Das Feld :attribute muss ein gültiger EAN-Code sein (7, 8 oder 13 Ziffern)', + 'email' => ':Attribute muss eine gültige E-Mail-Adresse sein.', + 'ends_with' => ':Attribute muss eine der folgenden Endungen aufweisen: :values', + 'enum' => 'Der ausgewählte Wert ist ungültig.', + 'exists' => 'Der gewählte Wert für :attribute ist ungültig.', + 'extensions' => 'Das Feld :attribute muss eine der folgenden Erweiterungen haben: :values.', + 'file' => ':Attribute muss eine Datei sein.', + 'filled' => ':Attribute muss ausgefüllt sein.', + 'gt' => [ 'array' => ':Attribute muss mehr als :value Elemente haben.', 'file' => ':Attribute muss größer als :value Kilobytes sein.', 'numeric' => ':Attribute muss größer als :value sein.', 'string' => ':Attribute muss länger als :value Zeichen sein.', ], - 'gte' => [ + 'gte' => [ 'array' => ':Attribute muss mindestens :value Elemente haben.', 'file' => ':Attribute muss größer oder gleich :value Kilobytes sein.', 'numeric' => ':Attribute muss größer oder gleich :value sein.', 'string' => ':Attribute muss mindestens :value Zeichen lang sein.', ], - 'image' => ':Attribute muss ein Bild sein.', - 'in' => 'Der gewählte Wert für :attribute ist ungültig.', - 'in_array' => 'Der gewählte Wert für :attribute kommt nicht in :other vor.', - 'integer' => ':Attribute muss eine ganze Zahl sein.', - 'ip' => ':Attribute muss eine gültige IP-Adresse sein.', - 'ipv4' => ':Attribute muss eine gültige IPv4-Adresse sein.', - 'ipv6' => ':Attribute muss eine gültige IPv6-Adresse sein.', - 'json' => ':Attribute muss ein gültiger JSON-String sein.', - 'lowercase' => ':Attribute muss in Kleinbuchstaben sein.', - 'lt' => [ + 'hex_color' => 'Das Feld :attribute muss eine gültige Hexadezimalfarbe sein.', + 'image' => ':Attribute muss ein Bild sein.', + 'in' => 'Der gewählte Wert für :attribute ist ungültig.', + 'in_array' => 'Der gewählte Wert für :attribute kommt nicht in :other vor.', + 'integer' => ':Attribute muss eine ganze Zahl sein.', + 'ip' => ':Attribute muss eine gültige IP-Adresse sein.', + 'ipv4' => ':Attribute muss eine gültige IPv4-Adresse sein.', + 'ipv6' => ':Attribute muss eine gültige IPv6-Adresse sein.', + 'json' => ':Attribute muss ein gültiger JSON-String sein.', + 'list' => ':Attribute muss eine Liste sein.', + 'lowercase' => ':Attribute muss in Kleinbuchstaben sein.', + 'lt' => [ 'array' => ':Attribute muss weniger als :value Elemente haben.', 'file' => ':Attribute muss kleiner als :value Kilobytes sein.', 'numeric' => ':Attribute muss kleiner als :value sein.', 'string' => ':Attribute muss kürzer als :value Zeichen sein.', ], - 'lte' => [ + 'lte' => [ 'array' => ':Attribute darf maximal :value Elemente haben.', 'file' => ':Attribute muss kleiner oder gleich :value Kilobytes sein.', 'numeric' => ':Attribute muss kleiner oder gleich :value sein.', 'string' => ':Attribute darf maximal :value Zeichen lang sein.', ], - 'mac_address' => 'Der Wert muss eine gültige MAC-Adresse sein.', - 'max' => [ + 'mac_address' => 'Der Wert muss eine gültige MAC-Adresse sein.', + 'max' => [ 'array' => ':Attribute darf maximal :max Elemente haben.', 'file' => ':Attribute darf maximal :max Kilobytes groß sein.', 'numeric' => ':Attribute darf maximal :max sein.', 'string' => ':Attribute darf maximal :max Zeichen haben.', ], - 'max_digits' => ':Attribute darf maximal :max Ziffern lang sein.', - 'mimes' => ':Attribute muss den Dateityp :values haben.', - 'mimetypes' => ':Attribute muss den Dateityp :values haben.', - 'min' => [ + 'max_digits' => ':Attribute darf maximal :max Ziffern lang sein.', + 'mimes' => ':Attribute muss den Dateityp :values haben.', + 'mimetypes' => ':Attribute muss den Dateityp :values haben.', + 'min' => [ 'array' => ':Attribute muss mindestens :min Elemente haben.', 'file' => ':Attribute muss mindestens :min Kilobytes groß sein.', 'numeric' => ':Attribute muss mindestens :min sein.', 'string' => ':Attribute muss mindestens :min Zeichen lang sein.', ], - 'min_digits' => ':Attribute muss mindestens :min Ziffern lang sein.', - 'missing' => 'Das Feld :attribute muss fehlen.', - 'missing_if' => 'Das Feld :attribute muss fehlen, wenn :other gleich :value ist.', - 'missing_unless' => 'Das Feld :attribute muss fehlen, es sei denn, :other ist :value.', - 'missing_with' => 'Das Feld :attribute muss fehlen, wenn :values vorhanden ist.', - 'missing_with_all' => 'Das Feld :attribute muss fehlen, wenn :values vorhanden sind.', - 'multiple_of' => ':Attribute muss ein Vielfaches von :value sein.', - 'not_in' => 'Der gewählte Wert für :attribute ist ungültig.', - 'not_regex' => ':Attribute hat ein ungültiges Format.', - 'numeric' => ':Attribute muss eine Zahl sein.', - 'password' => [ + 'min_digits' => ':Attribute muss mindestens :min Ziffern lang sein.', + 'missing' => 'Das Feld :attribute muss fehlen.', + 'missing_if' => 'Das Feld :attribute muss fehlen, wenn :other gleich :value ist.', + 'missing_unless' => 'Das Feld :attribute muss fehlen, es sei denn, :other ist :value.', + 'missing_with' => 'Das Feld :attribute muss fehlen, wenn :values vorhanden ist.', + 'missing_with_all' => 'Das Feld :attribute muss fehlen, wenn :values vorhanden sind.', + 'multiple_of' => ':Attribute muss ein Vielfaches von :value sein.', + 'not_in' => 'Der gewählte Wert für :attribute ist ungültig.', + 'not_regex' => ':Attribute hat ein ungültiges Format.', + 'numeric' => ':Attribute muss eine Zahl sein.', + 'password' => [ 'letters' => ':Attribute muss mindestens einen Buchstaben beinhalten.', 'mixed' => ':Attribute muss mindestens einen Großbuchstaben und einen Kleinbuchstaben beinhalten.', 'numbers' => ':Attribute muss mindestens eine Zahl beinhalten.', 'symbols' => ':Attribute muss mindestens ein Sonderzeichen beinhalten.', 'uncompromised' => ':Attribute wurde in einem Datenleck gefunden. Bitte wählen Sie ein anderes :attribute.', ], - 'present' => ':Attribute muss vorhanden sein.', - 'prohibited' => ':Attribute ist unzulässig.', - 'prohibited_if' => ':Attribute ist unzulässig, wenn :other :value ist.', - 'prohibited_unless' => ':Attribute ist unzulässig, wenn :other nicht :values ist.', - 'prohibits' => ':Attribute verbietet die Angabe von :other.', - 'regex' => ':Attribute Format ist ungültig.', - 'required' => ':Attribute muss ausgefüllt werden.', - 'required_array_keys' => 'Dieses Feld muss Einträge enthalten für: :values.', - 'required_if' => ':Attribute muss ausgefüllt werden, wenn :other den Wert :value hat.', - 'required_if_accepted' => ':Attribute muss ausgefüllt werden, wenn :other gewählt ist.', - 'required_unless' => ':Attribute muss ausgefüllt werden, wenn :other nicht den Wert :values hat.', - 'required_with' => ':Attribute muss ausgefüllt werden, wenn :values ausgefüllt wurde.', - 'required_with_all' => ':Attribute muss ausgefüllt werden, wenn :values ausgefüllt wurde.', - 'required_without' => ':Attribute muss ausgefüllt werden, wenn :values nicht ausgefüllt wurde.', - 'required_without_all' => ':Attribute muss ausgefüllt werden, wenn keines der Felder :values ausgefüllt wurde.', - 'same' => ':Attribute und :other müssen übereinstimmen.', - 'size' => [ + 'phone' => 'Das Feld :attribute ist keine gültige Telefonnummer, es akzeptiert + Nummern der folgenden Länder :countries.', + 'postal_code' => 'Das Feld :attribute akzeptiert Postleitzahlen der folgenden Länder + :countries, zum Beispiel :examples', + 'present' => ':Attribute muss vorhanden sein.', + 'present_if' => 'Das Feld :attribute muss vorhanden sein, wenn :other gleich :value ist.', + 'present_unless' => 'Das Feld :attribute muss vorhanden sein, es sei denn, :other ist :value.', + 'present_with' => 'Das Feld :attribute muss vorhanden sein, wenn :values vorhanden ist.', + 'present_with_all' => 'Das Feld :attribute muss vorhanden sein, wenn :values vorhanden sind.', + 'prohibited' => ':Attribute ist unzulässig.', + 'prohibited_if' => ':Attribute ist unzulässig, wenn :other :value ist.', + 'prohibited_if_accepted' => 'Das Feld :attribute ist unzulässig, wenn :other gewählt ist.', + 'prohibited_if_declined' => 'Das Feld :attribute ist unzulässig, wenn :other abgelehnt ist.', + 'prohibited_unless' => ':Attribute ist unzulässig, wenn :other nicht :values ist.', + 'prohibits' => ':Attribute verbietet die Angabe von :other.', + 'regex' => ':Attribute Format ist ungültig.', + 'required' => ':Attribute muss ausgefüllt werden.', + 'required_array_keys' => 'Dieses Feld muss Einträge enthalten für: :values.', + 'required_if' => ':Attribute muss ausgefüllt werden, wenn :other den Wert :value hat.', + 'required_if_accepted' => ':Attribute muss ausgefüllt werden, wenn :other gewählt ist.', + 'required_if_declined' => 'Das Feld :attribute ist erforderlich, wenn :other abgelehnt wird.', + 'required_unless' => ':Attribute muss ausgefüllt werden, wenn :other nicht den Wert :values hat.', + 'required_with' => ':Attribute muss ausgefüllt werden, wenn :values ausgefüllt wurde.', + 'required_with_all' => ':Attribute muss ausgefüllt werden, wenn :values ausgefüllt wurde.', + 'required_without' => ':Attribute muss ausgefüllt werden, wenn :values nicht ausgefüllt wurde.', + 'required_without_all' => ':Attribute muss ausgefüllt werden, wenn keines der Felder :values ausgefüllt wurde.', + 'same' => ':Attribute und :other müssen übereinstimmen.', + 'size' => [ 'array' => ':Attribute muss genau :size Elemente haben.', 'file' => ':Attribute muss :size Kilobyte groß sein.', 'numeric' => ':Attribute muss gleich :size sein.', 'string' => ':Attribute muss :size Zeichen lang sein.', ], - 'starts_with' => ':Attribute muss mit einem der folgenden Anfänge aufweisen: :values', - 'string' => ':Attribute muss ein String sein.', - 'timezone' => ':Attribute muss eine gültige Zeitzone sein.', - 'ulid' => 'Die :attribute muss eine gültige ULID sein.', - 'unique' => ':Attribute ist bereits vergeben.', - 'uploaded' => ':Attribute konnte nicht hochgeladen werden.', - 'uppercase' => ':Attribute muss in Großbuchstaben sein.', - 'url' => ':Attribute muss eine URL sein.', - 'uuid' => ':Attribute muss ein UUID sein.', - 'attributes' => [ + 'starts_with' => ':Attribute muss mit einem der folgenden Anfänge aufweisen: :values', + 'string' => ':Attribute muss ein String sein.', + 'timezone' => ':Attribute muss eine gültige Zeitzone sein.', + 'ulid' => 'Die :attribute muss eine gültige ULID sein.', + 'unique' => ':Attribute ist bereits vergeben.', + 'uploaded' => ':Attribute konnte nicht hochgeladen werden.', + 'uppercase' => ':Attribute muss in Großbuchstaben sein.', + 'url' => ':Attribute muss eine URL sein.', + 'uuid' => ':Attribute muss ein UUID sein.', + 'attributes' => [ 'address' => 'Adresse', + 'affiliate_url' => 'Affiliate-URL', 'age' => 'Alter', 'amount' => 'Höhe', + 'announcement' => 'Bekanntmachung', 'area' => 'Gebiet', + 'audience_prize' => 'Publikumspreis', + 'audience_winner' => 'Publikumsgewinner', 'available' => 'Verfügbar', 'birthday' => 'Geburtstag', 'body' => 'Körper', 'city' => 'Stadt', + 'color' => 'Farbe', + 'company' => 'Unternehmen', + 'compilation' => 'Zusammenstellung', + 'concept' => 'Konzept', + 'conditions' => 'Bedingungen', 'content' => 'Inhalt', + 'contest' => 'Wettbewerb', 'country' => 'Land', + 'cover' => 'Abdeckung', 'created_at' => 'Erstellt am', 'creator' => 'Ersteller', + 'currency' => 'Währung', 'current_password' => 'Derzeitiges Passwort', + 'customer' => 'Kunde', 'date' => 'Datum', 'date_of_birth' => 'Geburtsdatum', + 'dates' => 'Termine', 'day' => 'Tag', 'deleted_at' => 'Gelöscht am', 'description' => 'Beschreibung', + 'display_type' => 'Anzeigetyp', 'district' => 'Bezirk', 'duration' => 'Dauer', - 'email' => 'E-Mail Adresse', + 'email' => 'E-Mail-Adresse', 'excerpt' => 'Auszug', 'filter' => 'Filter', + 'finished_at' => 'fertig um', 'first_name' => 'Vorname', 'gender' => 'Geschlecht', + 'grand_prize' => 'Hauptpreis', 'group' => 'Gruppe', 'hour' => 'Stunde', 'image' => 'Bild', + 'image_desktop' => 'Desktop-Bild', + 'image_main' => 'Hauptbild', + 'image_mobile' => 'mobiles Bild', + 'images' => 'Bilder', + 'is_audience_winner' => 'ist Publikumssieger', + 'is_hidden' => 'ist versteckt', + 'is_subscribed' => 'ist abonniert', + 'is_visible' => 'ist sichtbar', + 'is_winner' => 'ist Gewinner', + 'items' => 'Artikel', + 'key' => 'Schlüssel', 'last_name' => 'Nachname', 'lesson' => 'Lektion', - 'line_address_1' => 'Adresse', - 'line_address_2' => 'Adresszusatz', + 'line_address_1' => 'Adresszeile 1', + 'line_address_2' => 'Adresszeile 2', + 'login' => 'Anmeldung', 'message' => 'Nachricht', 'middle_name' => 'Zweitname', 'minute' => 'Minute', @@ -183,25 +228,47 @@ return [ 'national_code' => 'Länderkennung', 'number' => 'Nummer', 'password' => 'Passwort', - 'password_confirmation' => 'Passwort bestätigen', + 'password_confirmation' => 'Passwortbestätigung', 'phone' => 'Telefonnummer', 'photo' => 'Foto', + 'portfolio' => 'Portfolio', 'postal_code' => 'Postleitzahl', + 'preview' => 'Vorschau', 'price' => 'Preis', + 'product_id' => 'Produkt ID', + 'product_uid' => 'Produkt-UID', + 'product_uuid' => 'Produkt-UUID', + 'promo_code' => 'Aktionscode', 'province' => 'Provinz', + 'quantity' => 'Menge', + 'reason' => 'Grund', 'recaptcha_response_field' => 'Captcha-Feld', + 'referee' => 'Schiedsrichter', + 'referees' => 'Schiedsrichter', + 'region' => 'Region', + 'reject_reason' => 'Ablehnungsgrund', 'remember' => 'Erinnern', 'restored_at' => 'Wiederhergestellt am', 'result_text_under_image' => 'Ergebnistext unter Bild', 'role' => 'Rolle', + 'rule' => 'Regel', + 'rules' => 'Regeln', 'second' => 'Sekunde', 'sex' => 'Geschlecht', + 'shipment' => 'Sendung', 'short_text' => 'Kurzer Text', 'size' => 'Größe', + 'skills' => 'Fähigkeiten', + 'slug' => 'Schnecke', + 'specialization' => 'Spezialisierung', + 'started_at' => 'fing an bei', 'state' => 'Bundesland', + 'status' => 'Status', 'street' => 'Straße', 'student' => 'Schüler/Student', 'subject' => 'Gegenstand', + 'tag' => 'Etikett', + 'tags' => 'Stichworte', 'teacher' => 'Lehrer', 'terms' => 'Bedingungen', 'test_description' => 'Test Beschreibung', @@ -210,72 +277,72 @@ return [ 'text' => 'Text', 'time' => 'Uhrzeit', 'title' => 'Titel', + 'type' => 'Typ', 'updated_at' => 'Aktualisiert am', + 'user' => 'Benutzer', 'username' => 'Benutzername', + 'value' => 'Wert', + 'winner' => 'Gewinner', + 'work' => 'Arbeit', 'year' => 'Jahr', ], - 'ean' => 'Das Feld :attribute muss ein gültiger EAN-Code sein (7, 8 oder 13 Ziffern)', - 'postal_code' => 'Das Feld :attribute akzeptiert Postleitzahlen der folgenden Länder - :countries, zum Beispiel :examples', - 'phone' => 'Das Feld :attribute ist keine gültige Telefonnummer, es akzeptiert - Nummern der folgenden Länder :countries.', - 'custom' => [ - 'of_the' => [ - 'male' => 'des ', - 'female' => 'der ', - 'vowel' => 'des ' - ], + 'custom' => [ + 'activated' => 'aktiviert', + 'activated_close_page' => 'Aktivierung der Abschlussseite', + 'activated_teaser' => 'Teaser-Aktivierung', + 'analytics' => 'Analytics', + 'answer' => 'Antwort', + 'arg' => 'Argumentation', 'attribute_alt' => 'Alt-Attribut', 'attribute_title' => 'Title-Attribut', - 'event' => 'Ereignis', - 'model' => 'Zielelement', - 'order' => 'Reihenfolge', - 'publication' => 'Veröffentlichung', - 'activated' => 'aktiviert', - 'target' => 'Ziel', - 'static_page_type' => 'Seitentyp', - 'seo_title' => 'SEO-Titel', - 'seo_description' => 'SEO-Beschreibung', - 'ip' => 'IP', - 'code' => 'Code', - 'unique_code' => 'eindeutiger Code', - 'product' => 'Produkt', - 'value' => 'Wert', - 'question' => 'Frage', - 'answer' => 'Antwort', - 'theme' => 'Thema', - 'file_name' => 'Dateiname', - 'label' => 'Bezeichnung', - 'arg' => 'Argumentation', - 'subtitle' => 'Untertitel', - 'quantity' => 'Menge', - 'pdf_winning_proof' => 'PDF Gewinnnachweis', - 'picture' => 'Abbildung', - 'ean_code' => 'EAN-Code', - 'start_date' => 'Startdatum', - 'end_date' => 'Enddatum', - 'nb_participation_player' => 'Anzahl der Teilnahmen pro Spieler', - 'nb_participation_ip' => 'Anzahl der Teilnahmen pro IP-Adresse', - 'nb_unique_code_use' => 'Anzahl der Verwendungen des eindeutigen Codes', - 'code_length' => 'Länge der eindeutigen Codes', - 'code_type' => 'Code-Typ', - 'activated_teaser' => 'Teaser-Aktivierung', - 'activated_close_page' => 'Aktivierung der Abschlussseite', - 'close_page_active_date' => 'Seite aktiv bis', - 'redirect_close' => 'Weiterleitungs-URL nach Ablauf des Spiels', - 'winning_proof' => 'Gewinnnachweise aktivieren', - 'company' => 'Unternehmen', - 'discounts_activated' => 'Rabattgutscheine aktivieren', - 'discounts_site' => 'Website-Referenz', - 'discounts_campaign' => 'Kampagnen-Referenz', - 'analytics' => 'Analytics', - 'game_rules' => 'Spielregeln', - 'notify_prize_sent' => 'Benachrichtigung über versandten Preis an den Teilnehmer', - 'comment' => 'Kommentar', 'authorized_countries' => 'am Spiel teilnahmeberechtigte Länder', 'barcode' => 'Produktbarcode', - 'ticket' => 'Kassenbon mit Datum', + 'close_page_active_date' => 'Seite aktiv bis', + 'code' => 'Code', + 'code_length' => 'Länge der eindeutigen Codes', + 'code_type' => 'Code-Typ', + 'comment' => 'Kommentar', + 'company' => 'Unternehmen', + 'discounts_activated' => 'Rabattgutscheine aktivieren', + 'discounts_campaign' => 'Kampagnen-Referenz', + 'discounts_site' => 'Website-Referenz', + 'ean_code' => 'EAN-Code', + 'end_date' => 'Enddatum', + 'error_list' => 'Fehlerliste:', + 'event' => 'Ereignis', + 'file_name' => 'Dateiname', + 'game_rules' => 'Spielregeln', + 'ip' => 'IP', + 'label' => 'Bezeichnung', + 'model' => 'Zielelement', + 'nb_participation_ip' => 'Anzahl der Teilnahmen pro IP-Adresse', + 'nb_participation_player' => 'Anzahl der Teilnahmen pro Spieler', + 'nb_unique_code_use' => 'Anzahl der Verwendungen des eindeutigen Codes', + 'notify_prize_sent' => 'Benachrichtigung über versandten Preis an den Teilnehmer', + 'of_the' => [ + 'female' => 'der ', + 'male' => 'des ', + 'vowel' => 'des ', + ], + 'order' => 'Reihenfolge', + 'pdf_winning_proof' => 'PDF Gewinnnachweis', + 'picture' => 'Abbildung', + 'product' => 'Produkt', + 'publication' => 'Veröffentlichung', + 'quantity' => 'Menge', + 'question' => 'Frage', + 'redirect_close' => 'Weiterleitungs-URL nach Ablauf des Spiels', + 'seo_description' => 'SEO-Beschreibung', + 'seo_title' => 'SEO-Titel', + 'start_date' => 'Startdatum', + 'static_page_type' => 'Seitentyp', 'sticker' => 'Produktaufkleber', - 'error_list' => 'Fehlerliste:' + 'subtitle' => 'Untertitel', + 'target' => 'Ziel', + 'theme' => 'Thema', + 'ticket' => 'Kassenbon mit Datum', + 'unique_code' => 'eindeutiger Code', + 'value' => 'Wert', + 'winning_proof' => 'Gewinnnachweise aktivieren', ], ]; diff --git a/resources/lang/de/vue.php b/resources/lang/de/vue.php index 13187b6..86af1d1 100644 --- a/resources/lang/de/vue.php +++ b/resources/lang/de/vue.php @@ -1,5 +1,7 @@ [ 'choose_a_file' => 'Wählen Sie eine Datei', @@ -30,10 +32,10 @@ return [ ], 'WordCounterComponent' => [ 'words' => 'Wörter', - 'characters' => 'Zeichen' + 'characters' => 'Zeichen', ], 'PasswordVisibility' => [ 'hide' => 'Passwort verbergen', 'show' => 'Passwort anzeigen', - ] + ], ]; diff --git a/resources/lang/en.json b/resources/lang/en.json index d208ff2..0e6c094 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1,54 +1,245 @@ { "(and :count more error)": "(and :count more error)", - "(and :count more errors)": "(and :count more errors)", + "(and :count more errors)": "(and :count more error)|(and :count more errors)|(and :count more errors)", + "A decryption key is required.": "A decryption key is required.", "A fresh verification link has been sent to your email address.": "A fresh verification link has been sent to your email address.", + "A Timeout Occurred": "A Timeout Occurred", + "Accept": "Accept", + "Accepted": "Accepted", + "Action": "Action", + "Actions": "Actions", + "Add": "Add", + "Add :name": "Add :name", + "Admin": "Admin", + "Agree": "Agree", "All rights reserved.": "All rights reserved.", + "Already Reported": "Already Reported", + "Archive": "Archive", + "Assign": "Assign", + "Associate": "Associate", + "Attach": "Attach", + "Bad Gateway": "Bad Gateway", + "Bad Request": "Bad Request", + "Bandwidth Limit Exceeded": "Bandwidth Limit Exceeded", "Before proceeding, please check your email for a verification link.": "Before proceeding, please check your email for a verification link.", + "Browse": "Browse", + "Cancel": "Cancel", + "Choose": "Choose", + "Choose :name": "Choose :name", + "Choose File": "Choose File", + "Choose Image": "Choose Image", "click here to request another": "click here to request another", + "Click to copy": "Click to copy", + "Client Closed Request": "Client Closed Request", + "Close": "Close", + "Collapse": "Collapse", + "Collapse All": "Collapse All", + "Comment": "Comment", + "Confirm": "Confirm", "Confirm Password": "Confirm Password", + "Conflict": "Conflict", + "Connect": "Connect", + "Connection Closed Without Response": "Connection Closed Without Response", + "Connection Timed Out": "Connection Timed Out", + "Continue": "Continue", + "Create": "Create", + "Create :name": "Create :name", + "Created": "Created", "Dashboard": "Dashboard", + "Delete": "Delete", + "Delete :name": "Delete :name", + "Detach": "Detach", + "Details": "Details", + "Disable": "Disable", + "Discard": "Discard", + "Done": "Done", + "Down": "Down", + "Duplicate": "Duplicate", + "Duplicate :name": "Duplicate :name", + "Edit": "Edit", + "Edit :name": "Edit :name", "Email Address": "Email Address", + "Enable": "Enable", + "Encrypted environment file already exists.": "Encrypted environment file already exists.", + "Encrypted environment file not found.": "Encrypted environment file not found.", + "Environment file already exists.": "Environment file already exists.", + "Environment file not found.": "Environment file not found.", + "errors": "errors", + "Expand": "Expand", + "Expand All": "Expand All", + "Expectation Failed": "Expectation Failed", + "Explanation": "Explanation", + "Export": "Export", + "Export :name": "Export :name", + "Failed Dependency": "Failed Dependency", + "File": "File", + "Files": "Files", "Forbidden": "Forbidden", "Forgot Your Password?": "Forgot Your Password?", + "Found": "Found", + "Gateway Timeout": "Gateway Timeout", + "Go Home": "Go Home", "Go to page :page": "Go to page :page", + "Gone": "Gone", "Hello!": "Hello!", + "Hide": "Hide", + "Hide :name": "Hide :name", + "Home": "Home", + "HTTP Version Not Supported": "HTTP Version Not Supported", + "I'm a teapot": "I'm a teapot", "If you did not create an account, no further action is required.": "If you did not create an account, no further action is required.", "If you did not receive the email": "If you did not receive the email", "If you did not request a password reset, no further action is required.": "If you did not request a password reset, no further action is required.", "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:", + "IM Used": "IM Used", + "Image": "Image", + "Impersonate": "Impersonate", + "Impersonation": "Impersonation", + "Import": "Import", + "Import :name": "Import :name", + "Insufficient Storage": "Insufficient Storage", + "Internal Server Error": "Internal Server Error", + "Introduction": "Introduction", + "Invalid filename.": "Invalid filename.", "Invalid JSON was returned from the route.": "Invalid JSON was returned from the route.", + "Invalid SSL Certificate": "Invalid SSL Certificate", + "length": "length", + "Length Required": "Length Required", + "Like": "Like", + "Load": "Load", + "Localize": "Localize", + "Location": "Location", + "Locked": "Locked", + "Log In": "Log In", + "Log Out": "Log Out", "Login": "Login", "Logout": "Logout", + "Loop Detected": "Loop Detected", + "Maintenance Mode": "Maintenance Mode", + "Method Not Allowed": "Method Not Allowed", + "Misdirected Request": "Misdirected Request", + "Moved Permanently": "Moved Permanently", + "Multi-Status": "Multi-Status", + "Multiple Choices": "Multiple Choices", "Name": "Name", + "Network Authentication Required": "Network Authentication Required", + "Network Connect Timeout Error": "Network Connect Timeout Error", + "Network Read Timeout Error": "Network Read Timeout Error", + "New": "New", + "New :name": "New :name", + "No": "No", + "No Content": "No Content", + "Non-Authoritative Information": "Non-Authoritative Information", + "Not Acceptable": "Not Acceptable", + "Not Extended": "Not Extended", "Not Found": "Not Found", + "Not Implemented": "Not Implemented", + "Not Modified": "Not Modified", "of": "of", + "OK": "OK", + "Open": "Open", + "Open in a current window": "Open in a current window", + "Open in a new window": "Open in a new window", + "Open in a parent frame": "Open in a parent frame", + "Open in the topmost frame": "Open in the topmost frame", + "Open on the website": "Open on the website", + "Origin Is Unreachable": "Origin Is Unreachable", "Page Expired": "Page Expired", "Pagination Navigation": "Pagination Navigation", + "Partial Content": "Partial Content", "Password": "Password", + "Payload Too Large": "Payload Too Large", "Payment Required": "Payment Required", + "Permanent Redirect": "Permanent Redirect", "Please click the button below to verify your email address.": "Please click the button below to verify your email address.", "Please confirm your password before continuing.": "Please confirm your password before continuing.", + "Precondition Failed": "Precondition Failed", + "Precondition Required": "Precondition Required", + "Preview": "Preview", + "Price": "Price", + "Processing": "Processing", + "Proxy Authentication Required": "Proxy Authentication Required", + "Railgun Error": "Railgun Error", + "Range Not Satisfiable": "Range Not Satisfiable", + "Record": "Record", "Regards": "Regards", + "Regards,": "Regards,", "Register": "Register", "Remember Me": "Remember Me", + "Request Header Fields Too Large": "Request Header Fields Too Large", + "Request Timeout": "Request Timeout", + "Reset Content": "Reset Content", "Reset Password": "Reset Password", "Reset Password Notification": "Reset Password Notification", + "Restore": "Restore", + "Restore :name": "Restore :name", "results": "results", + "Retry With": "Retry With", + "Save": "Save", + "Save & Close": "Save & Close", + "Save & Return": "Save & Return", + "Save :name": "Save :name", + "Search": "Search", + "Search :name": "Search :name", + "See Other": "See Other", + "Select": "Select", + "Select All": "Select All", + "Send": "Send", "Send Password Reset Link": "Send Password Reset Link", "Server Error": "Server Error", "Service Unavailable": "Service Unavailable", + "Session Has Expired": "Session Has Expired", + "Settings": "Settings", + "Show": "Show", + "Show :name": "Show :name", + "Show All": "Show All", "Showing": "Showing", + "Sign In": "Sign In", + "Solve": "Solve", + "SSL Handshake Failed": "SSL Handshake Failed", + "Start": "Start", + "Stop": "Stop", + "Submit": "Submit", + "Subscribe": "Subscribe", + "Switch": "Switch", + "Switch To Role": "Switch To Role", + "Switching Protocols": "Switching Protocols", + "Tag": "Tag", + "Tags": "Tags", + "Temporary Redirect": "Temporary Redirect", "The given data was invalid.": "The given data was invalid.", "The response is not a streamed response.": "The response is not a streamed response.", "The response is not a view.": "The response is not a view.", + "This action is unauthorized.": "This action is unauthorized.", "This password reset link will expire in :count minutes.": "This password reset link will expire in :count minutes.", "to": "to", "Toggle navigation": "Toggle navigation", + "Too Early": "Too Early", "Too Many Requests": "Too Many Requests", + "Translate": "Translate", + "Translate It": "Translate It", "Unauthorized": "Unauthorized", + "Unavailable For Legal Reasons": "Unavailable For Legal Reasons", + "Unknown Error": "Unknown Error", + "Unpack": "Unpack", + "Unprocessable Entity": "Unprocessable Entity", + "Unsubscribe": "Unsubscribe", + "Unsupported Media Type": "Unsupported Media Type", + "Up": "Up", + "Update": "Update", + "Update :name": "Update :name", + "Upgrade Required": "Upgrade Required", + "URI Too Long": "URI Too Long", + "Use Proxy": "Use Proxy", + "User": "User", + "Variant Also Negotiates": "Variant Also Negotiates", "Verify Email Address": "Verify Email Address", "Verify Your Email Address": "Verify Your Email Address", + "View": "View", + "View :name": "View :name", + "Web Server is Down": "Web Server is Down", "Whoops!": "Whoops!", + "Yes": "Yes", "You are logged in!": "You are logged in!", "You are receiving this email because we received a password reset request for your account.": "You are receiving this email because we received a password reset request for your account." } \ No newline at end of file diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 6db4982..ad725d8 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -4,6 +4,6 @@ declare(strict_types=1); return [ 'failed' => 'These credentials do not match our records.', - 'password' => 'The password is incorrect.', + 'password' => 'The provided password is incorrect.', 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', ]; diff --git a/resources/lang/en/cookie-notice.php b/resources/lang/en/cookie-notice.php index 73f5098..9158823 100644 --- a/resources/lang/en/cookie-notice.php +++ b/resources/lang/en/cookie-notice.php @@ -1,5 +1,7 @@ 'Customize cookies', @@ -20,16 +22,16 @@ return [ 'panel_content' => 'Cookie management panel content', 'picture_cookie_title' => 'Image of a nice big cookie', 'navigation_title' => 'Cookies panel navigation', - 'custom' => [ + 'custom' => [ 'analytics' => [ - 'title' => 'Google Analytics', + 'title' => 'Google Analytics', 'description' => 'Audience measurement services make it possible to generate attendance statistics useful for improving the site.', ], 'youtube' => [ 'title' => 'Youtube', - 'description' => 'Cookies placed via video sharing services are intended to allow the user to view multimedia content directly on the site.', - 'labelLink' => 'Learn more', - 'warning' => 'You must accept cookies to view this video', + 'description' => 'Cookies placed via video sharing services are intended to allow the user to view multimedia content directly on the site.', + 'labelLink' => 'Learn more', + 'warning' => 'You must accept cookies to view this video', ], 'matomo' => [ 'title' => 'Matomo', @@ -41,6 +43,6 @@ return [ 'description' => 'The purpose of the cookies placed on forms via the recaptcha is to prevent them from being submitted by robots.', 'labelLink' => 'Learn more', 'warning' => 'You must accept reCAPTCHA cookies to send the form', - ] - ] + ], + ], ]; diff --git a/resources/lang/en/crud.php b/resources/lang/en/crud.php index b04af04..ce4020a 100644 --- a/resources/lang/en/crud.php +++ b/resources/lang/en/crud.php @@ -1,5 +1,7 @@ [ 'list' => 'list', @@ -35,7 +37,7 @@ return [ 'assertFieldIsUnique' => 'The :value for the :attribute field is already in use', 'assertNoInternalBoUrls' => ':attribute : It is forbidden to paste back-office uri into this field', 'assertNoInternalUrls' => ':attribute : It is forbidden to paste a url of :appname into this field', - ] + ], ], 'messages' => [ @@ -79,5 +81,5 @@ return [ 'sort_delete' => 'Delete sorting', 'sort_arrow' => 'Here, the arrows are used to sort, not filter.', 'right' => 'You don\'t have the rights', - ] + ], ]; diff --git a/resources/lang/en/enums.php b/resources/lang/en/enums.php index 0b67a5f..0dae23d 100644 --- a/resources/lang/en/enums.php +++ b/resources/lang/en/enums.php @@ -1,3 +1,5 @@ [ 'password_reset_email_sent' => 'If your account exists, you should receive a message with a link to reset your password.', @@ -33,29 +35,29 @@ return [ 'update_email' => 'Email address updated - :site_name', 'update_password' => 'Password updated - :site_name', 'verify_email' => 'Registration - :site_name', - ], - 'greetings' => [ - 'with_name' => 'Hello :first_name,', - 'without_name' => 'Hello,', - ], - 'contents' => [ - 'destroy_customer' => 'Your :site_name account has been marked for deletion, + ], + 'greetings' => [ + 'with_name' => 'Hello :first_name,', + 'without_name' => 'Hello,', + ], + 'contents' => [ + 'destroy_customer' => 'Your :site_name account has been marked for deletion, it will be permanently deleted after 1 week. You can reactivate it during this period if you wish by logging back in.', - 'destroyed_customer' => 'Your :site_name account has been permanently deleted along with all associated data. + 'destroyed_customer' => 'Your :site_name account has been permanently deleted along with all associated data. If you had placed an order, it will of course still be fulfilled. Orders associated with your account will continue to exist, but your account data has been permanently deleted.', - 'reset_password' => 'To reset your password and log in to :site_name, click the following link:', - 'update_email' => 'The email address associated with your :site_name account has just been updated.', - 'update_password' => 'The password associated with your :site_name account has just been updated.', - 'verify_email_1' => 'You are just one click away from completing your registration...', - 'verify_email_2' => 'To finalise your registration, please click the link below:', - 'verify_email_3' => 'If you have any questions, feel free to contact us via our contact form.', - ], - 'actions' => [ - 'reset_password' => 'Reset your password', - 'verify_email' => 'Confirm my email address', - ], - ] + 'reset_password' => 'To reset your password and log in to :site_name, click the following link:', + 'update_email' => 'The email address associated with your :site_name account has just been updated.', + 'update_password' => 'The password associated with your :site_name account has just been updated.', + 'verify_email_1' => 'You are just one click away from completing your registration...', + 'verify_email_2' => 'To finalise your registration, please click the link below:', + 'verify_email_3' => 'If you have any questions, feel free to contact us via our contact form.', + ], + 'actions' => [ + 'reset_password' => 'Reset your password', + 'verify_email' => 'Confirm my email address', + ], + ], ]; diff --git a/resources/lang/en/models.php b/resources/lang/en/models.php index a709346..e8dac38 100644 --- a/resources/lang/en/models.php +++ b/resources/lang/en/models.php @@ -1,9 +1,11 @@ [ - 'user' => 'user', + 'user' => 'user', 'activity_log' => 'activity log|activity logs', - 'static_page' => 'static page|static pages', - ] + 'static_page' => 'static page|static pages', + ], ]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php index ead9596..1597a36 100644 --- a/resources/lang/en/pagination.php +++ b/resources/lang/en/pagination.php @@ -4,9 +4,9 @@ declare(strict_types=1); return [ 'next' => 'Next »', + 'next_page' => 'Next page', + 'paginate_list' => 'Number of elements per page', 'previous' => '« Previous', 'previous_page' => 'Previous page', - 'next_page' => 'Next page', 'specific_page' => 'Go to page n°:id', - 'paginate_list' => 'Number of elements per page', ]; diff --git a/resources/lang/en/recaptcha.php b/resources/lang/en/recaptcha.php index 8a95f21..0371ca2 100644 --- a/resources/lang/en/recaptcha.php +++ b/resources/lang/en/recaptcha.php @@ -1,6 +1,8 @@ 'An error occurred when validating the form, please try again', - 'not_enough_score' => 'You have not obtained a fairly high score when validation of the reCAPTCHA' + 'error' => 'An error occurred when validating the form, please try again', + 'not_enough_score' => 'You have not obtained a fairly high score when validation of the reCAPTCHA', ]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 3b06268..7e71add 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -3,178 +3,222 @@ declare(strict_types=1); return [ - 'accepted' => 'The :attribute must be accepted.', - 'accepted_if' => 'The :attribute must be accepted when :other is :value.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'array' => 'The :attribute must have between :min and :max items.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'numeric' => 'The :attribute must be between :min and :max.', - 'string' => 'The :attribute must be between :min and :max characters.', + 'accepted' => 'The :attribute field must be accepted.', + 'accepted_if' => 'The :attribute field must be accepted when :other is :value.', + 'active_url' => 'The :attribute field must be a valid URL.', + 'after' => 'The :attribute field must be a date after :date.', + 'after_or_equal' => 'The :attribute field must be a date after or equal to :date.', + 'alpha' => 'The :attribute field must only contain letters.', + 'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.', + 'alpha_num' => 'The :attribute field must only contain letters and numbers.', + 'array' => 'The :attribute field must be an array.', + 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', + 'before' => 'The :attribute field must be a date before :date.', + 'before_or_equal' => 'The :attribute field must be a date before or equal to :date.', + 'between' => [ + 'array' => 'The :attribute field must have between :min and :max items.', + 'file' => 'The :attribute field must be between :min and :max kilobytes.', + 'numeric' => 'The :attribute field must be between :min and :max.', + 'string' => 'The :attribute field must be between :min and :max characters.', ], - 'boolean' => 'The :attribute field must be true or false.', - 'can' => 'The :attribute field contains an unauthorized value.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'current_password' => 'The password is incorrect.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'decimal' => 'The :attribute field must have :decimal decimal places.', - 'declined' => 'The :attribute must be declined.', - 'declined_if' => 'The :attribute must be declined when :other is :value.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', - 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', - 'enum' => 'The selected :attribute is invalid.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field is required.', - 'gt' => [ - 'array' => 'The :attribute must have more than :value items.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'numeric' => 'The :attribute must be greater than :value.', - 'string' => 'The :attribute must be greater than :value characters.', + 'boolean' => 'The :attribute field must be true or false.', + 'can' => 'The :attribute field contains an unauthorized value.', + 'confirmed' => 'The :attribute field confirmation does not match.', + 'contains' => 'The :attribute field is missing a required value.', + 'current_password' => 'The password is incorrect.', + 'date' => 'The :attribute field must be a valid date.', + 'date_equals' => 'The :attribute field must be a date equal to :date.', + 'date_format' => 'The :attribute field must match the format :format.', + 'decimal' => 'The :attribute field must have :decimal decimal places.', + 'declined' => 'The :attribute field must be declined.', + 'declined_if' => 'The :attribute field must be declined when :other is :value.', + 'different' => 'The :attribute field and :other must be different.', + 'digits' => 'The :attribute field must be :digits digits.', + 'digits_between' => 'The :attribute field must be between :min and :max digits.', + 'dimensions' => 'The :attribute field has invalid image dimensions.', + 'distinct' => 'The :attribute field has a duplicate value.', + 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', + 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', + 'ean' => 'The :attribute field must be a valid EAN code (7, 8 or 13 digits).', + 'email' => 'The :attribute field must be a valid email address.', + 'ends_with' => 'The :attribute field must end with one of the following: :values.', + 'enum' => 'The selected :attribute is invalid.', + 'exists' => 'The selected :attribute is invalid.', + 'extensions' => 'The :attribute field must have one of the following extensions: :values.', + 'file' => 'The :attribute field must be a file.', + 'filled' => 'The :attribute field must have a value.', + 'gt' => [ + 'array' => 'The :attribute field must have more than :value items.', + 'file' => 'The :attribute field must be greater than :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than :value.', + 'string' => 'The :attribute field must be greater than :value characters.', ], - 'gte' => [ - 'array' => 'The :attribute must have :value items or more.', - 'file' => 'The :attribute must be greater than or equal :value kilobytes.', - 'numeric' => 'The :attribute must be greater than or equal :value.', - 'string' => 'The :attribute must be greater than or equal :value characters.', + 'gte' => [ + 'array' => 'The :attribute field must have :value items or more.', + 'file' => 'The :attribute field must be greater than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than or equal to :value.', + 'string' => 'The :attribute field must be greater than or equal to :value characters.', ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lowercase' => 'The :attribute field must be lowercase.', - 'lt' => [ - 'array' => 'The :attribute must have less than :value items.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'numeric' => 'The :attribute must be less than :value.', - 'string' => 'The :attribute must be less than :value characters.', + 'hex_color' => 'The :attribute field must be a valid hexadecimal color.', + 'image' => 'The :attribute field must be an image.', + 'in' => 'The selected :attribute is invalid.', + 'in_array' => 'The :attribute field must exist in :other.', + 'integer' => 'The :attribute field must be an integer.', + 'ip' => 'The :attribute field must be a valid IP address.', + 'ipv4' => 'The :attribute field must be a valid IPv4 address.', + 'ipv6' => 'The :attribute field must be a valid IPv6 address.', + 'json' => 'The :attribute field must be a valid JSON string.', + 'list' => 'The :attribute field must be a list.', + 'lowercase' => 'The :attribute field must be lowercase.', + 'lt' => [ + 'array' => 'The :attribute field must have less than :value items.', + 'file' => 'The :attribute field must be less than :value kilobytes.', + 'numeric' => 'The :attribute field must be less than :value.', + 'string' => 'The :attribute field must be less than :value characters.', ], - 'lte' => [ - 'array' => 'The :attribute must not have more than :value items.', - 'file' => 'The :attribute must be less than or equal :value kilobytes.', - 'numeric' => 'The :attribute must be less than or equal :value.', - 'string' => 'The :attribute must be less than or equal :value characters.', + 'lte' => [ + 'array' => 'The :attribute field must not have more than :value items.', + 'file' => 'The :attribute field must be less than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be less than or equal to :value.', + 'string' => 'The :attribute field must be less than or equal to :value characters.', ], - 'mac_address' => 'The :attribute must be a valid MAC address.', - 'max' => [ - 'array' => 'The :attribute may not have more than :max items.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'numeric' => 'The :attribute may not be greater than :max.', - 'string' => 'The :attribute may not be greater than :max characters.', + 'mac_address' => 'The :attribute field must be a valid MAC address.', + 'max' => [ + 'array' => 'The :attribute field must not have more than :max items.', + 'file' => 'The :attribute field must not be greater than :max kilobytes.', + 'numeric' => 'The :attribute field must not be greater than :max.', + 'string' => 'The :attribute field must not be greater than :max characters.', ], - 'max_digits' => 'The :attribute field must not have more than :max digits.', - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'array' => 'The :attribute must have at least :min items.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'numeric' => 'The :attribute must be at least :min.', - 'string' => 'The :attribute must be at least :min characters.', + 'max_digits' => 'The :attribute field must not have more than :max digits.', + 'mimes' => 'The :attribute field must be a file of type: :values.', + 'mimetypes' => 'The :attribute field must be a file of type: :values.', + 'min' => [ + 'array' => 'The :attribute field must have at least :min items.', + 'file' => 'The :attribute field must be at least :min kilobytes.', + 'numeric' => 'The :attribute field must be at least :min.', + 'string' => 'The :attribute field must be at least :min characters.', ], - 'min_digits' => 'The :attribute field must have at least :min digits.', - 'missing' => 'The :attribute field must be missing.', - 'missing_if' => 'The :attribute field must be missing when :other is :value.', - 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', - 'missing_with' => 'The :attribute field must be missing when :values is present.', - 'missing_with_all' => 'The :attribute field must be missing when :values are present.', - 'multiple_of' => 'The :attribute must be a multiple of :value.', - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'password' => [ + 'min_digits' => 'The :attribute field must have at least :min digits.', + 'missing' => 'The :attribute field must be missing.', + 'missing_if' => 'The :attribute field must be missing when :other is :value.', + 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', + 'missing_with' => 'The :attribute field must be missing when :values is present.', + 'missing_with_all' => 'The :attribute field must be missing when :values are present.', + 'multiple_of' => 'The :attribute field must be a multiple of :value.', + 'not_in' => 'The selected :attribute is invalid.', + 'not_regex' => 'The :attribute field format is invalid.', + 'numeric' => 'The :attribute field must be a number.', + 'password' => [ 'letters' => 'The :attribute field must contain at least one letter.', 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.', 'numbers' => 'The :attribute field must contain at least one number.', 'symbols' => 'The :attribute field must contain at least one symbol.', - 'uncompromised' => 'The given :attribute has appeared in a data leak. - Please choose a different :attribute.', + 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', ], - 'present' => 'The :attribute field must be present.', - 'prohibited' => 'The :attribute field is prohibited.', - 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', - 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', - 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_array_keys' => 'The :attribute field must contain entries for: :values.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values is present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'array' => 'The :attribute must contain :size items.', - 'file' => 'The :attribute must be :size kilobytes.', - 'numeric' => 'The :attribute must be :size.', - 'string' => 'The :attribute must be :size characters.', + 'phone' => 'The :attribute field is not a valid phone number, it accepts numbers + from the following countries: :countries.', + 'postal_code' => 'The :attribute field accepts postal codes from the following countries: + :countries, for example :examples.', + 'present' => 'The :attribute field must be present.', + 'present_if' => 'The :attribute field must be present when :other is :value.', + 'present_unless' => 'The :attribute field must be present unless :other is :value.', + 'present_with' => 'The :attribute field must be present when :values is present.', + 'present_with_all' => 'The :attribute field must be present when :values are present.', + 'prohibited' => 'The :attribute field is prohibited.', + 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', + 'prohibited_if_accepted' => 'The :attribute field is prohibited when :other is accepted.', + 'prohibited_if_declined' => 'The :attribute field is prohibited when :other is declined.', + 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', + 'prohibits' => 'The :attribute field prohibits :other from being present.', + 'regex' => 'The :attribute field format is invalid.', + 'required' => 'The :attribute field is required.', + 'required_array_keys' => 'The :attribute field must contain entries for: :values.', + 'required_if' => 'The :attribute field is required when :other is :value.', + 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', + 'required_if_declined' => 'The :attribute field is required when :other is declined.', + 'required_unless' => 'The :attribute field is required unless :other is in :values.', + 'required_with' => 'The :attribute field is required when :values is present.', + 'required_with_all' => 'The :attribute field is required when :values are present.', + 'required_without' => 'The :attribute field is required when :values is not present.', + 'required_without_all' => 'The :attribute field is required when none of :values are present.', + 'same' => 'The :attribute field must match :other.', + 'size' => [ + 'array' => 'The :attribute field must contain :size items.', + 'file' => 'The :attribute field must be :size kilobytes.', + 'numeric' => 'The :attribute field must be :size.', + 'string' => 'The :attribute field must be :size characters.', ], - 'starts_with' => 'The :attribute must start with one of the following: :values', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'ulid' => 'The :attribute field must be a valid ULID.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'uppercase' => 'The :attribute field must be uppercase.', - 'url' => 'The :attribute format is invalid.', - 'uuid' => 'The :attribute must be a valid UUID.', - 'attributes' => [ + 'starts_with' => 'The :attribute field must start with one of the following: :values.', + 'string' => 'The :attribute field must be a string.', + 'timezone' => 'The :attribute field must be a valid timezone.', + 'ulid' => 'The :attribute field must be a valid ULID.', + 'unique' => 'The :attribute has already been taken.', + 'uploaded' => 'The :attribute failed to upload.', + 'uppercase' => 'The :attribute field must be uppercase.', + 'url' => 'The :attribute field must be a valid URL.', + 'uuid' => 'The :attribute field must be a valid UUID.', + 'attributes' => [ 'address' => 'address', + 'affiliate_url' => 'affiliate URL', 'age' => 'age', 'amount' => 'amount', + 'announcement' => 'announcement', 'area' => 'area', + 'audience_prize' => 'audience prize', + 'audience_winner' => 'audience winner', 'available' => 'available', 'birthday' => 'birthday', 'body' => 'body', 'city' => 'city', + 'color' => 'color', + 'company' => 'company', + 'compilation' => 'compilation', + 'concept' => 'concept', + 'conditions' => 'conditions', 'content' => 'content', + 'contest' => 'contest', 'country' => 'country', + 'cover' => 'cover', 'created_at' => 'created at', 'creator' => 'creator', + 'currency' => 'currency', 'current_password' => 'current password', + 'customer' => 'customer', 'date' => 'date', 'date_of_birth' => 'date of birth', + 'dates' => 'dates', 'day' => 'day', 'deleted_at' => 'deleted at', 'description' => 'description', + 'display_type' => 'display type', 'district' => 'district', 'duration' => 'duration', 'email' => 'email', 'excerpt' => 'excerpt', 'filter' => 'filter', + 'finished_at' => 'finished at', 'first_name' => 'first name', 'gender' => 'gender', + 'grand_prize' => 'grand prize', 'group' => 'group', 'hour' => 'hour', 'image' => 'image', + 'image_desktop' => 'desktop image', + 'image_main' => 'main image', + 'image_mobile' => 'mobile image', + 'images' => 'images', + 'is_audience_winner' => 'is audience winner', + 'is_hidden' => 'is hidden', + 'is_subscribed' => 'is subscribed', + 'is_visible' => 'is visible', + 'is_winner' => 'is winner', + 'items' => 'items', + 'key' => 'key', 'last_name' => 'last name', 'lesson' => 'lesson', 'line_address_1' => 'line address 1', 'line_address_2' => 'line address 2', + 'login' => 'login', 'message' => 'message', 'middle_name' => 'middle name', 'minute' => 'minute', @@ -187,22 +231,44 @@ return [ 'password_confirmation' => 'password confirmation', 'phone' => 'phone', 'photo' => 'photo', + 'portfolio' => 'portfolio', 'postal_code' => 'postal code', + 'preview' => 'preview', 'price' => 'price', + 'product_id' => 'product ID', + 'product_uid' => 'product UID', + 'product_uuid' => 'product UUID', + 'promo_code' => 'promo code', 'province' => 'province', + 'quantity' => 'quantity', + 'reason' => 'reason', 'recaptcha_response_field' => 'recaptcha response field', + 'referee' => 'referee', + 'referees' => 'referees', + 'region' => 'region', + 'reject_reason' => 'reject reason', 'remember' => 'remember', 'restored_at' => 'restored at', 'result_text_under_image' => 'result text under image', 'role' => 'role', + 'rule' => 'rule', + 'rules' => 'rules', 'second' => 'second', 'sex' => 'sex', + 'shipment' => 'shipment', 'short_text' => 'short text', 'size' => 'size', + 'skills' => 'skills', + 'slug' => 'slug', + 'specialization' => 'specialization', + 'started_at' => 'started at', 'state' => 'state', + 'status' => 'status', 'street' => 'street', 'student' => 'student', 'subject' => 'subject', + 'tag' => 'tag', + 'tags' => 'tags', 'teacher' => 'teacher', 'terms' => 'terms', 'test_description' => 'test description', @@ -211,72 +277,72 @@ return [ 'text' => 'text', 'time' => 'time', 'title' => 'title', + 'type' => 'type', 'updated_at' => 'updated at', + 'user' => 'user', 'username' => 'username', + 'value' => 'value', + 'winner' => 'winner', + 'work' => 'work', 'year' => 'year', ], - 'ean' => 'The :attribute field must be a valid EAN code (7, 8 or 13 digits).', - 'postal_code' => 'The :attribute field accepts postal codes from the following countries: - :countries, for example :examples.', - 'phone' => 'The :attribute field is not a valid phone number, it accepts numbers - from the following countries: :countries.', - 'custom' => [ - 'of_the' => [ - 'male' => 'of the ', - 'female' => 'of the ', - 'vowel' => 'of the ' - ], + 'custom' => [ + 'activated' => 'activated', + 'activated_close_page' => 'closing page activation', + 'activated_teaser' => 'teaser activation', + 'analytics' => 'analytics', + 'answer' => 'answer', + 'arg' => 'argument', 'attribute_alt' => 'alt attribute', 'attribute_title' => 'title attribute', - 'event' => 'event', - 'model' => 'target element', - 'order' => 'order', - 'publication' => 'publication', - 'activated' => 'activated', - 'target' => 'target', - 'static_page_type' => 'static page type', - 'seo_title' => 'SEO title', - 'seo_description' => 'SEO description', - 'ip' => 'IP', - 'code' => 'code', - 'unique_code' => 'unique code', - 'product' => 'product', - 'value' => 'value', - 'question' => 'question', - 'answer' => 'answer', - 'theme' => 'theme', - 'file_name' => 'file name', - 'label' => 'label', - 'arg' => 'argument', - 'subtitle' => 'subtitle', - 'quantity' => 'quantity', - 'pdf_winning_proof' => 'proof of winnings PDF', - 'picture' => 'illustration', - 'ean_code' => 'EAN code', - 'start_date' => 'start date', - 'end_date' => 'end date', - 'nb_participation_player' => 'number of participations per player', - 'nb_participation_ip' => 'number of participations per IP address', - 'nb_unique_code_use' => 'number of unique code uses', - 'code_length' => 'unique code length', - 'code_type' => 'code type', - 'activated_teaser' => 'teaser activation', - 'activated_close_page' => 'closing page activation', - 'close_page_active_date' => 'page active until', - 'redirect_close' => 'redirect URL after game end date', - 'winning_proof' => 'enable proof of winnings', - 'company' => 'company', - 'discounts_activated' => 'enable discount vouchers', - 'discounts_site' => 'site reference', - 'discounts_campaign' => 'campaign reference', - 'analytics' => 'analytics', - 'game_rules' => 'game rules', - 'notify_prize_sent' => 'prize sent notification to participant', - 'comment' => 'comment', 'authorized_countries' => 'eligible countries at game', 'barcode' => 'product barcode', - 'ticket' => 'receipt with date', - 'sticker' => 'product sticker', + 'close_page_active_date' => 'page active until', + 'code' => 'code', + 'code_length' => 'unique code length', + 'code_type' => 'code type', + 'comment' => 'comment', + 'company' => 'company', + 'discounts_activated' => 'enable discount vouchers', + 'discounts_campaign' => 'campaign reference', + 'discounts_site' => 'site reference', + 'ean_code' => 'EAN code', + 'end_date' => 'end date', 'error_list' => 'Error list:', + 'event' => 'event', + 'file_name' => 'file name', + 'game_rules' => 'game rules', + 'ip' => 'IP', + 'label' => 'label', + 'model' => 'target element', + 'nb_participation_ip' => 'number of participations per IP address', + 'nb_participation_player' => 'number of participations per player', + 'nb_unique_code_use' => 'number of unique code uses', + 'notify_prize_sent' => 'prize sent notification to participant', + 'of_the' => [ + 'female' => 'of the ', + 'male' => 'of the ', + 'vowel' => 'of the ', + ], + 'order' => 'order', + 'pdf_winning_proof' => 'proof of winnings PDF', + 'picture' => 'illustration', + 'product' => 'product', + 'publication' => 'publication', + 'quantity' => 'quantity', + 'question' => 'question', + 'redirect_close' => 'redirect URL after game end date', + 'seo_description' => 'SEO description', + 'seo_title' => 'SEO title', + 'start_date' => 'start date', + 'static_page_type' => 'static page type', + 'sticker' => 'product sticker', + 'subtitle' => 'subtitle', + 'target' => 'target', + 'theme' => 'theme', + 'ticket' => 'receipt with date', + 'unique_code' => 'unique code', + 'value' => 'value', + 'winning_proof' => 'enable proof of winnings', ], ]; diff --git a/resources/lang/en/vue.php b/resources/lang/en/vue.php index b513341..b5f8d50 100644 --- a/resources/lang/en/vue.php +++ b/resources/lang/en/vue.php @@ -1,5 +1,7 @@ [ 'choose_a_file' => 'Choose a file', @@ -29,10 +31,10 @@ return [ ], 'WordCounterComponent' => [ 'words' => 'Words', - 'characters' => 'Characters' + 'characters' => 'Characters', ], 'PasswordVisibility' => [ 'hide' => 'Hide the password', 'show' => 'Show the password', - ] + ], ]; diff --git a/resources/lang/fr.json b/resources/lang/fr.json index 37cb6d6..dae33d8 100644 --- a/resources/lang/fr.json +++ b/resources/lang/fr.json @@ -1,54 +1,245 @@ { "(and :count more error)": "(et :count erreur en plus)", - "(and :count more errors)": "(et :count erreurs en plus)", + "(and :count more errors)": "(et :count erreur en plus)|(et :count erreurs en plus)|(et :count erreurs en plus)", + "A decryption key is required.": "Une clé de déchiffrement est requise.", "A fresh verification link has been sent to your email address.": "Un nouveau lien de vérification a été envoyé à votre adresse e-mail.", + "A Timeout Occurred": "Temps d'attente dépassé", + "Accept": "Accepter", + "Accepted": "Accepté", + "Action": "Action", + "Actions": "Actions", + "Add": "Ajouter", + "Add :name": "Ajouter :name", + "Admin": "Administrateur", + "Agree": "Accepter", "All rights reserved.": "Tous droits réservés.", + "Already Reported": "Déjà rapporté", + "Archive": "Archive", + "Assign": "Attribuer", + "Associate": "Associé", + "Attach": "Attacher", + "Bad Gateway": "Passerelle invalide", + "Bad Request": "Requête erronée", + "Bandwidth Limit Exceeded": "Limite de bande passante dépassée", "Before proceeding, please check your email for a verification link.": "Avant de continuer, merci de vérifier votre e-mail contenant un lien de vérification.", + "Browse": "Parcourir", + "Cancel": "Annuler", + "Choose": "Choisir", + "Choose :name": "Choisir :name", + "Choose File": "Choisir le fichier", + "Choose Image": "Choisir une image", "click here to request another": "cliquez ici pour en demander un autre", + "Click to copy": "Cliquer pour copier", + "Client Closed Request": "Demande fermée par le client", + "Close": "Fermer", + "Collapse": "Réduire", + "Collapse All": "Réduire tout", + "Comment": "Commentaire", + "Confirm": "Confirmer", "Confirm Password": "Confirmer le mot de passe", + "Conflict": "Conflit", + "Connect": "Connecter", + "Connection Closed Without Response": "Connexion fermée sans réponse", + "Connection Timed Out": "La connexion a expiré", + "Continue": "Continuer", + "Create": "Créer", + "Create :name": "Créer :name", + "Created": "Créé", "Dashboard": "Tableau de bord", + "Delete": "Supprimer", + "Delete :name": "Supprimer :name", + "Detach": "Détacher", + "Details": "Détails", + "Disable": "Désactiver", + "Discard": "Jeter", + "Done": "Fait", + "Down": "Descendre", + "Duplicate": "Dupliquer", + "Duplicate :name": "Dupliquer :name", + "Edit": "Éditer", + "Edit :name": "Modifier :name", "Email Address": "Adresse e-mail", + "Enable": "Activer", + "Encrypted environment file already exists.": "Le fichier d'environnement chiffré existe déjà.", + "Encrypted environment file not found.": "Fichier d'environnement chiffré introuvable.", + "Environment file already exists.": "Le fichier d'environnement existe déjà.", + "Environment file not found.": "Fichier d'environnement introuvable.", + "errors": "les erreurs", + "Expand": "Développer", + "Expand All": "Développer tout", + "Expectation Failed": "Comportement attendu insatisfaisant", + "Explanation": "Explication", + "Export": "Exporter", + "Export :name": "Exporter :name", + "Failed Dependency": "Dépendance échouée", + "File": "Déposer", + "Files": "Des dossiers", "Forbidden": "Interdit", "Forgot Your Password?": "Mot de passe oublié ?", + "Found": "Trouvé", + "Gateway Timeout": "Temps d'attente de la passerelle dépassé", + "Go Home": "Aller à l'accueil", "Go to page :page": "Aller à la page :page", + "Gone": "Disparu", "Hello!": "Bonjour !", + "Hide": "Cacher", + "Hide :name": "Cacher :name", + "Home": "Accueil", + "HTTP Version Not Supported": "Version HTTP non prise en charge", + "I'm a teapot": "Je suis une théière", "If you did not create an account, no further action is required.": "Si vous n'avez pas créé de compte, vous pouvez ignorer ce message.", "If you did not receive the email": "Si vous n'avez pas reçu cet e-mail", "If you did not request a password reset, no further action is required.": "Si vous n'avez pas demandé de réinitialisation de mot de passe, vous pouvez ignorer ce message.", "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "Si vous avez des difficultés à cliquer sur le bouton \":actionText\", copiez et collez l'URL ci-dessous\ndans votre navigateur Web :", + "IM Used": "IM utilisé", + "Image": "Image", + "Impersonate": "Utiliser un autre compte", + "Impersonation": "Imitation", + "Import": "Importer", + "Import :name": "Importer :name", + "Insufficient Storage": "Espace insuffisant", + "Internal Server Error": "Erreur interne du serveur", + "Introduction": "Introduction", + "Invalid filename.": "Nom de fichier incorrect.", "Invalid JSON was returned from the route.": "Un JSON non valide a été renvoyé par la route.", + "Invalid SSL Certificate": "Certificat SSL invalide", + "length": "longueur", + "Length Required": "Longueur requise", + "Like": "Aimer", + "Load": "Charger", + "Localize": "Localiser", + "Location": "Emplacement", + "Locked": "Verrouillé", + "Log In": "Se connecter", + "Log Out": "Se déconnecter", "Login": "Connexion", "Logout": "Déconnexion", + "Loop Detected": "Boucle détectée", + "Maintenance Mode": "Mode de maintenance", + "Method Not Allowed": "Méthode non autorisée", + "Misdirected Request": "Demande mal dirigée", + "Moved Permanently": "Déplacé de façon permanente", + "Multi-Status": "Statut multiple", + "Multiple Choices": "Choix multiples", "Name": "Nom", + "Network Authentication Required": "Authentification réseau requise", + "Network Connect Timeout Error": "Temps d'attente de la connexion réseau dépassé", + "Network Read Timeout Error": "Temps d'attente de la lecture réseau dépassé", + "New": "Nouveau", + "New :name": "Nouveau :name", + "No": "Non", + "No Content": "Pas de contenu", + "Non-Authoritative Information": "Informations non certifiées", + "Not Acceptable": "Pas acceptable", + "Not Extended": "Non prolongé", "Not Found": "Non trouvé", + "Not Implemented": "Non implémenté", + "Not Modified": "Non modifié", "of": "de", + "OK": "OK", + "Open": "Ouvrir", + "Open in a current window": "Ouvrir dans une fenêtre actuelle", + "Open in a new window": "Ouvrir dans une nouvelle fenêtre", + "Open in a parent frame": "Ouvrir dans un cadre parent", + "Open in the topmost frame": "Ouvrir dans le cadre le plus haut", + "Open on the website": "Ouvrir sur le site", + "Origin Is Unreachable": "L'origine est inaccessible", "Page Expired": "Page expirée", "Pagination Navigation": "Pagination", + "Partial Content": "Contenu partiel", "Password": "Mot de passe", + "Payload Too Large": "Charge utile trop grande", "Payment Required": "Paiement requis", + "Permanent Redirect": "Redirection permanente", "Please click the button below to verify your email address.": "Veuillez cliquer sur le bouton ci-dessous pour vérifier votre adresse e-mail :", "Please confirm your password before continuing.": "Veuillez confirmer votre mot de passe avant de continuer.", + "Precondition Failed": "La précondition a échoué", + "Precondition Required": "Condition préalable requise", + "Preview": "Aperçu", + "Price": "Prix", + "Processing": "En traitement", + "Proxy Authentication Required": "Authentification proxy requise", + "Railgun Error": "Erreur de Railgun", + "Range Not Satisfiable": "Plage non satisfaisante", + "Record": "Enregistrer", "Regards": "Cordialement", + "Regards,": "Cordialement,", "Register": "Inscription", "Remember Me": "Se souvenir de moi", + "Request Header Fields Too Large": "Champs d'en-tête de requête trop grands", + "Request Timeout": "Temps d'attente de la requête dépassé", + "Reset Content": "Réinitialiser le contenu", "Reset Password": "Réinitialisation du mot de passe", "Reset Password Notification": "Notification de réinitialisation du mot de passe", + "Restore": "Restaurer", + "Restore :name": "Restaurer :name", "results": "résultats", + "Retry With": "Réessayer avec", + "Save": "Sauvegarder", + "Save & Close": "Sauvegarder et fermer", + "Save & Return": "Sauvegarder et retourner", + "Save :name": "Sauvegarder :name", + "Search": "Rechercher", + "Search :name": "Chercher :name", + "See Other": "Voir autre", + "Select": "Sélectionner", + "Select All": "Tout sélectionner", + "Send": "Envoyer", "Send Password Reset Link": "Envoyer le lien de réinitialisation du mot de passe", "Server Error": "Erreur serveur", "Service Unavailable": "Service indisponible", + "Session Has Expired": "La session a expiré", + "Settings": "Paramètres", + "Show": "Afficher", + "Show :name": "Afficher :name", + "Show All": "Afficher tout", "Showing": "Montrant", + "Sign In": "Se connecter", + "Solve": "Résoudre", + "SSL Handshake Failed": "Échec de la prise de contact SSL", + "Start": "Commencer", + "Stop": "Arrêter", + "Submit": "Soumettre", + "Subscribe": "S'abonner", + "Switch": "Changer", + "Switch To Role": "Passer au rôle", + "Switching Protocols": "Protocoles de commutation", + "Tag": "Mot clé", + "Tags": "Mots clés", + "Temporary Redirect": "Redirection temporaire", "The given data was invalid.": "La donnée renseignée est incorrecte.", "The response is not a streamed response.": "La réponse n'est pas une réponse diffusée.", "The response is not a view.": "La réponse n'est pas une vue.", + "This action is unauthorized.": "Cette action n'est pas autorisée.", "This password reset link will expire in :count minutes.": "Ce lien de réinitialisation du mot de passe expirera dans :count minutes.", "to": "à", "Toggle navigation": "Afficher / masquer le menu de navigation", + "Too Early": "Trop tôt", "Too Many Requests": "Trop de requêtes", + "Translate": "Traduire", + "Translate It": "Traduis le", "Unauthorized": "Non autorisé", + "Unavailable For Legal Reasons": "Indisponible pour des raisons légales", + "Unknown Error": "Erreur inconnue", + "Unpack": "Déballer", + "Unprocessable Entity": "Entité non traitable", + "Unsubscribe": "Se désabonner", + "Unsupported Media Type": "Type de média non supporté", + "Up": "Monter", + "Update": "Mettre à jour", + "Update :name": "Mettre à jour :name", + "Upgrade Required": "Mise à niveau requise", + "URI Too Long": "URI trop long", + "Use Proxy": "Utiliser un proxy", + "User": "Utilisateur", + "Variant Also Negotiates": "La variante négocie également", "Verify Email Address": "Vérifier l'adresse e-mail", "Verify Your Email Address": "Vérifiez votre adresse e-mail", + "View": "Vue", + "View :name": "Voir :name", + "Web Server is Down": "Le serveur Web est en panne", "Whoops!": "Oups !", - "You are logged in!": "Vous êtes connecté·e !", + "Yes": "Oui", + "You are logged in!": "Vous êtes connecté !", "You are receiving this email because we received a password reset request for your account.": "Vous recevez cet e-mail car nous avons reçu une demande de réinitialisation de mot de passe pour votre compte." } \ No newline at end of file diff --git a/resources/lang/fr/cookie-notice.php b/resources/lang/fr/cookie-notice.php index d1b9894..be87888 100644 --- a/resources/lang/fr/cookie-notice.php +++ b/resources/lang/fr/cookie-notice.php @@ -1,5 +1,7 @@ 'Personnaliser les cookies', @@ -20,9 +22,9 @@ return [ 'panel_content' => 'Contenu du panneau des cookies', 'picture_cookie_title' => 'Image d’un bon gros cookie', 'navigation_title' => 'Navigation du panneau des cookies', - 'custom' => [ + 'custom' => [ 'analytics' => [ - 'title' => 'Google Analytics', + 'title' => 'Google Analytics', 'description' => 'Les services de mesure d’audience permettent de générer des statistiques de fréquentation utiles à l’amélioration du site.', ], 'youtube' => [ @@ -41,6 +43,6 @@ return [ 'description' => 'Les cookies qui sont déposés via le recaptcha sur les formulaires ont pour finalité d’empêcher que ceux-ci ne soient soumis par des robots.', 'labelLink' => 'En apprendre plus', 'warning' => 'Vous devez accepter les cookies reCAPTCHA pour envoyer le formulaire', - ] - ] + ], + ], ]; diff --git a/resources/lang/fr/crud.php b/resources/lang/fr/crud.php index 75b4dac..5734e06 100644 --- a/resources/lang/fr/crud.php +++ b/resources/lang/fr/crud.php @@ -1,15 +1,17 @@ [ - 'list' => 'liste', - 'view' => 'voir', - 'create' => 'créer', + 'list' => 'liste', + 'view' => 'voir', + 'create' => 'créer', 'duplicate' => 'dupliquer', - 'update' => 'éditer', - 'delete' => 'supprimer', - 'save' => 'sauvegarder', - 'edit' => 'mettre à jour', + 'update' => 'éditer', + 'delete' => 'supprimer', + 'save' => 'sauvegarder', + 'edit' => 'mettre à jour', ], 'helpers' => [ @@ -35,7 +37,7 @@ return [ 'assertFieldIsUnique' => 'La :valeur du champ :attribut est déjà utilisée', 'assertNoInternalBoUrls' => ':attribute : Il est interdit de coller l\'uri de back-office dans ce champ', 'assertNoInternalUrls' => ':attribute : Il est interdit de coller une url de :appname dans ce champ.', - ] + ], ], 'messages' => [ @@ -69,9 +71,9 @@ return [ ], 'pagination' => [ - "previous" => "Page précédente", - "next" => "Page suivante", - "specific_page" => "Accéder à la page n°:id", + 'previous' => 'Page précédente', + 'next' => 'Page suivante', + 'specific_page' => 'Accéder à la page n°:id', 'paginate_list' => 'Nombre d\'éléments par page', ], @@ -89,5 +91,5 @@ return [ 'sort_delete' => 'Supprimer le tri', 'sort_arrow' => 'Ici, les flèches sont utilisées pour trier et non pour filtrer', 'right' => 'Vous n\'avez pas les droits', - ] + ], ]; diff --git a/resources/lang/fr/enums.php b/resources/lang/fr/enums.php index ef2a9fd..22c582d 100644 --- a/resources/lang/fr/enums.php +++ b/resources/lang/fr/enums.php @@ -1,9 +1,11 @@ [ 'France' => 'France', 'Belgium' => 'Belgique', 'Luxembourg' => 'Luxembourg', - ] + ], ]; diff --git a/resources/lang/fr/front.php b/resources/lang/fr/front.php index 2a50d7d..de9b681 100644 --- a/resources/lang/fr/front.php +++ b/resources/lang/fr/front.php @@ -1,5 +1,7 @@ [ 'password_reset_email_sent' => 'Si votre compte existe vous devriez recevoir un message avec un lien pour réinitialiser votre mot de passe', @@ -57,5 +59,5 @@ return [ 'reset_password' => 'Réinitialisez votre mot de passe', 'verify_email' => 'Confirmer mon adresse email', ], - ] + ], ]; diff --git a/resources/lang/fr/http-statuses.php b/resources/lang/fr/http-statuses.php index af44920..f711408 100644 --- a/resources/lang/fr/http-statuses.php +++ b/resources/lang/fr/http-statuses.php @@ -7,16 +7,16 @@ return [ '100' => 'Continuer', '101' => 'Protocoles de commutation', '102' => 'En traitement', - '200' => 'D\'accord', + '200' => 'OK', '201' => 'Créé', '202' => 'Accepté', - '203' => 'Informations non autorisées', - '204' => 'Pas content', + '203' => 'Informations non certifiées', + '204' => 'Pas de contenu', '205' => 'Réinitialiser le contenu', '206' => 'Contenu partiel', - '207' => 'Multi-statut', + '207' => 'Statut multiple', '208' => 'Déjà rapporté', - '226' => 'J\'ai l\'habitude', + '226' => 'IM utilisé', '300' => 'Choix multiples', '301' => 'Déplacé de façon permanente', '302' => 'A trouvé', @@ -25,44 +25,44 @@ return [ '305' => 'Utiliser un proxy', '307' => 'Redirection temporaire', '308' => 'Redirection permanente', - '400' => 'Mauvaise Demande', - '401' => 'Non autorisé', - '402' => 'Paiement Requis', + '400' => 'Requête invalide', + '401' => 'Non authentifié', + '402' => 'Paiement requis', '403' => 'Interdit', '404' => 'Page non trouvée', - '405' => 'Méthode Non Autorisée', - '406' => 'Pas acceptable', + '405' => 'Méthode non autorisée', + '406' => 'Non acceptable', '407' => 'Authentification proxy requise', - '408' => 'Délai d\'expiration de la demande', + '408' => 'Requête expirée', '409' => 'Conflit', '410' => 'Disparu', '411' => 'Longueur requise', '412' => 'La précondition a échoué', '413' => 'Charge utile trop grande', '414' => 'URI trop long', - '415' => 'Type de support non supporté', + '415' => 'Type de média non supporté', '416' => 'Plage non satisfaisante', - '417' => 'Échec de l\'attente', + '417' => 'Comportement attendu insatisfaisant', '418' => 'Je suis une théière', '419' => 'La session a expiré', '421' => 'Demande mal dirigée', - '422' => 'Entité non traitable', - '423' => 'Fermé à clef', + '422' => 'Contenu non traitable', + '423' => 'Verrouillé', '424' => 'Dépendance échouée', '425' => 'Trop tôt', '426' => 'Mise à niveau requise', '428' => 'Condition préalable requise', '429' => 'Trop de demandes', - '431' => 'Demander des champs d\'en-tête trop grands', + '431' => 'Champs d\'en-tête de requête trop grands', '444' => 'Connexion fermée sans réponse', '449' => 'Réessayer avec', '451' => 'Indisponible pour des raisons légales', - '499' => 'Demande fermée du client', - '500' => 'Erreur Interne du Serveur', - '501' => 'Pas mis en œuvre', + '499' => 'Demande fermée par le client', + '500' => 'Erreur interne du serveur', + '501' => 'Non implémenté', '502' => 'Mauvaise passerelle', - '503' => 'Mode de Maintenance', - '504' => 'Délai d\'attente de la passerelle', + '503' => 'Service non disponible', + '504' => 'Temps d\'attente de la passerelle dépassé', '505' => 'Version HTTP non prise en charge', '506' => 'La variante négocie également', '507' => 'Espace insuffisant', @@ -77,8 +77,8 @@ return [ '524' => 'Un dépassement de délai s\'est produit', '525' => 'Échec de la prise de contact SSL', '526' => 'Certificat SSL invalide', - '527' => 'Erreur de canon ferroviaire', - '598' => 'Erreur de délai de lecture réseau', - '599' => 'Erreur de délai de connexion réseau', + '527' => 'Erreur de Railgun', + '598' => 'Temps d\'attente de la lecture réseau dépassé', + '599' => 'Temps d\'attente de la connexion réseau dépassé', 'unknownError' => 'Erreur inconnue', ]; diff --git a/resources/lang/fr/models.php b/resources/lang/fr/models.php index 1c77b83..2639aca 100644 --- a/resources/lang/fr/models.php +++ b/resources/lang/fr/models.php @@ -1,18 +1,20 @@ [ - 'user' => 'utilisateur', - 'activity_log' => 'journal d\'activité|journaux d\'activité', - 'static_page' => 'page statique|pages statiques', + 'user' => 'utilisateur', + 'activity_log' => 'journal d\'activité|journaux d\'activité', + 'static_page' => 'page statique|pages statiques', 'banned_ips' => 'ip bannies', - 'faq-questions' => 'question pour la FAQ|questions pour la FAQ', - 'faq-themes' => 'thème pour la FAQ|thèmes pour la FAQ', - 'prize' => 'lot', - 'range' => 'gamme', - 'winner' => 'gagnant', - 'settings' => 'réglages', - 'product' => 'produit', - 'participation' => 'participation', - ] + 'faq-questions' => 'question pour la FAQ|questions pour la FAQ', + 'faq-themes' => 'thème pour la FAQ|thèmes pour la FAQ', + 'prize' => 'lot', + 'range' => 'gamme', + 'winner' => 'gagnant', + 'settings' => 'réglages', + 'product' => 'produit', + 'participation' => 'participation', + ], ]; diff --git a/resources/lang/fr/pagination.php b/resources/lang/fr/pagination.php index ccd0f82..df01397 100644 --- a/resources/lang/fr/pagination.php +++ b/resources/lang/fr/pagination.php @@ -4,9 +4,9 @@ declare(strict_types=1); return [ 'next' => 'Suivant »', + 'next_page' => 'Page suivante', + 'paginate_list' => 'Nombre d\'élements par page', 'previous' => '« Précédent', 'previous_page' => 'Page précédente', - 'next_page' => 'Page suivante', 'specific_page' => 'Aller à la page n°:id', - 'paginate_list' => 'Nombre d\'élements par page', ]; diff --git a/resources/lang/fr/recaptcha.php b/resources/lang/fr/recaptcha.php index 690105e..edcb8e4 100644 --- a/resources/lang/fr/recaptcha.php +++ b/resources/lang/fr/recaptcha.php @@ -1,6 +1,8 @@ 'Une erreur s\'est produite lors de la validation du formulaire, veuillez réessayer', - 'not_enough_score' => 'Vous n\'avez pas obtenu un score assez élevé lors de la validation du reCAPTCHA' + 'error' => 'Une erreur s\'est produite lors de la validation du formulaire, veuillez réessayer', + 'not_enough_score' => 'Vous n\'avez pas obtenu un score assez élevé lors de la validation du reCAPTCHA', ]; diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index 43bb0e2..4df3715 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -3,178 +3,222 @@ declare(strict_types=1); return [ - 'accepted' => 'Le champ :attribute doit être accepté.', - 'accepted_if' => 'Le champ :attribute doit être accepté quand :other a la valeur :value.', - 'active_url' => 'Le champ :attribute n\'est pas une URL valide.', - 'after' => 'Le champ :attribute doit être une date postérieure au :date.', - 'after_or_equal' => 'Le champ :attribute doit être une date postérieure ou égale au :date.', - 'alpha' => 'Le champ :attribute doit contenir uniquement des lettres.', - 'alpha_dash' => 'Le champ :attribute doit contenir uniquement des lettres, des chiffres et des tirets.', - 'alpha_num' => 'Le champ :attribute doit contenir uniquement des chiffres et des lettres.', - 'array' => 'Le champ :attribute doit être un tableau.', - 'ascii' => 'Le champ :attribute ne doit contenir que des caractères alphanumériques et des symboles codés sur un octet.', - 'before' => 'Le champ :attribute doit être une date antérieure au :date.', - 'before_or_equal' => 'Le champ :attribute doit être une date antérieure ou égale au :date.', - 'between' => [ + 'accepted' => 'Le champ :attribute doit être accepté.', + 'accepted_if' => 'Le champ :attribute doit être accepté quand :other a la valeur :value.', + 'active_url' => 'Le champ :attribute n\'est pas une URL valide.', + 'after' => 'Le champ :attribute doit être une date postérieure au :date.', + 'after_or_equal' => 'Le champ :attribute doit être une date postérieure ou égale au :date.', + 'alpha' => 'Le champ :attribute doit contenir uniquement des lettres.', + 'alpha_dash' => 'Le champ :attribute doit contenir uniquement des lettres, des chiffres et des tirets.', + 'alpha_num' => 'Le champ :attribute doit contenir uniquement des chiffres et des lettres.', + 'array' => 'Le champ :attribute doit être un tableau.', + 'ascii' => 'Le champ :attribute ne doit contenir que des caractères alphanumériques et des symboles codés sur un octet.', + 'before' => 'Le champ :attribute doit être une date antérieure au :date.', + 'before_or_equal' => 'Le champ :attribute doit être une date antérieure ou égale au :date.', + 'between' => [ 'array' => 'Le tableau :attribute doit contenir entre :min et :max éléments.', 'file' => 'La taille du fichier de :attribute doit être comprise entre :min et :max kilo-octets.', 'numeric' => 'La valeur de :attribute doit être comprise entre :min et :max.', 'string' => 'Le texte :attribute doit contenir entre :min et :max caractères.', ], - 'boolean' => 'Le champ :attribute doit être vrai ou faux.', - 'can' => 'Le champ :attribute contient une valeur non autorisée.', - 'confirmed' => 'Le champ de confirmation :attribute ne correspond pas.', - 'current_password' => 'Le mot de passe est incorrect.', - 'date' => 'Le champ :attribute n\'est pas une date valide.', - 'date_equals' => 'Le champ :attribute doit être une date égale à :date.', - 'date_format' => 'Le champ :attribute ne correspond pas au format :format.', - 'decimal' => 'Le champ :attribute doit comporter :decimal décimales.', - 'declined' => 'Le champ :attribute doit être décliné.', - 'declined_if' => 'Le champ :attribute doit être décliné quand :other a la valeur :value.', - 'different' => 'Les champs :attribute et :other doivent être différents.', - 'digits' => 'Le champ :attribute doit contenir :digits chiffres.', - 'digits_between' => 'Le champ :attribute doit contenir entre :min et :max chiffres.', - 'dimensions' => 'La taille de l\'image :attribute n\'est pas conforme.', - 'distinct' => 'Le champ :attribute a une valeur en double.', - 'doesnt_end_with' => 'Le champ :attribute ne doit pas finir avec une des valeurs suivantes : :values.', - 'doesnt_start_with' => 'Le champ :attribute ne doit pas commencer avec une des valeurs suivantes : :values.', - 'email' => 'Le champ :attribute doit être une adresse e-mail valide.', - 'ends_with' => 'Le champ :attribute doit se terminer par une des valeurs suivantes : :values', - 'enum' => 'Le champ :attribute sélectionné est invalide.', - 'exists' => 'Le champ :attribute sélectionné est invalide.', - 'file' => 'Le champ :attribute doit être un fichier.', - 'filled' => 'Le champ :attribute doit avoir une valeur.', - 'gt' => [ + 'boolean' => 'Le champ :attribute doit être vrai ou faux.', + 'can' => 'Le champ :attribute contient une valeur non autorisée.', + 'confirmed' => 'Le champ de confirmation :attribute ne correspond pas.', + 'contains' => 'Le champ :attribute manque une valeur requise.', + 'current_password' => 'Le mot de passe est incorrect.', + 'date' => 'Le champ :attribute n\'est pas une date valide.', + 'date_equals' => 'Le champ :attribute doit être une date égale à :date.', + 'date_format' => 'Le champ :attribute ne correspond pas au format :format.', + 'decimal' => 'Le champ :attribute doit comporter :decimal décimales.', + 'declined' => 'Le champ :attribute doit être décliné.', + 'declined_if' => 'Le champ :attribute doit être décliné quand :other a la valeur :value.', + 'different' => 'Les champs :attribute et :other doivent être différents.', + 'digits' => 'Le champ :attribute doit contenir :digits chiffres.', + 'digits_between' => 'Le champ :attribute doit contenir entre :min et :max chiffres.', + 'dimensions' => 'La taille de l\'image :attribute n\'est pas conforme.', + 'distinct' => 'Le champ :attribute a une valeur en double.', + 'doesnt_end_with' => 'Le champ :attribute ne doit pas finir avec une des valeurs suivantes : :values.', + 'doesnt_start_with' => 'Le champ :attribute ne doit pas commencer avec une des valeurs suivantes : :values.', + 'ean' => 'Le champ :attribute doit être un code EAN valide (7, 8 ou 13 chiffres)', + 'email' => 'Le champ :attribute doit être une adresse e-mail valide.', + 'ends_with' => 'Le champ :attribute doit se terminer par une des valeurs suivantes : :values', + 'enum' => 'Le champ :attribute sélectionné est invalide.', + 'exists' => 'Le champ :attribute sélectionné est invalide.', + 'extensions' => 'Le champ :attribute doit avoir l\'une des extensions suivantes : :values.', + 'file' => 'Le champ :attribute doit être un fichier.', + 'filled' => 'Le champ :attribute doit avoir une valeur.', + 'gt' => [ 'array' => 'Le tableau :attribute doit contenir plus de :value éléments.', 'file' => 'La taille du fichier de :attribute doit être supérieure à :value kilo-octets.', 'numeric' => 'La valeur de :attribute doit être supérieure à :value.', 'string' => 'Le texte :attribute doit contenir plus de :value caractères.', ], - 'gte' => [ + 'gte' => [ 'array' => 'Le tableau :attribute doit contenir au moins :value éléments.', 'file' => 'La taille du fichier de :attribute doit être supérieure ou égale à :value kilo-octets.', 'numeric' => 'La valeur de :attribute doit être supérieure ou égale à :value.', 'string' => 'Le texte :attribute doit contenir au moins :value caractères.', ], - 'image' => 'Le champ :attribute doit être une image.', - 'in' => 'Le champ :attribute est invalide.', - 'in_array' => 'Le champ :attribute n\'existe pas dans :other.', - 'integer' => 'Le champ :attribute doit être un entier.', - 'ip' => 'Le champ :attribute doit être une adresse IP valide.', - 'ipv4' => 'Le champ :attribute doit être une adresse IPv4 valide.', - 'ipv6' => 'Le champ :attribute doit être une adresse IPv6 valide.', - 'json' => 'Le champ :attribute doit être un document JSON valide.', - 'lowercase' => 'Le champ :attribute doit être en minuscules.', - 'lt' => [ + 'hex_color' => 'Le champ :attribute doit être une couleur hexadécimale valide.', + 'image' => 'Le champ :attribute doit être une image.', + 'in' => 'Le champ :attribute est invalide.', + 'in_array' => 'Le champ :attribute n\'existe pas dans :other.', + 'integer' => 'Le champ :attribute doit être un entier.', + 'ip' => 'Le champ :attribute doit être une adresse IP valide.', + 'ipv4' => 'Le champ :attribute doit être une adresse IPv4 valide.', + 'ipv6' => 'Le champ :attribute doit être une adresse IPv6 valide.', + 'json' => 'Le champ :attribute doit être un document JSON valide.', + 'list' => 'Le champ :attribute doit être une liste.', + 'lowercase' => 'Le champ :attribute doit être en minuscules.', + 'lt' => [ 'array' => 'Le tableau :attribute doit contenir moins de :value éléments.', 'file' => 'La taille du fichier de :attribute doit être inférieure à :value kilo-octets.', 'numeric' => 'La valeur de :attribute doit être inférieure à :value.', 'string' => 'Le texte :attribute doit contenir moins de :value caractères.', ], - 'lte' => [ + 'lte' => [ 'array' => 'Le tableau :attribute doit contenir au plus :value éléments.', 'file' => 'La taille du fichier de :attribute doit être inférieure ou égale à :value kilo-octets.', 'numeric' => 'La valeur de :attribute doit être inférieure ou égale à :value.', 'string' => 'Le texte :attribute doit contenir au plus :value caractères.', ], - 'mac_address' => 'Le champ :attribute doit être une adresse MAC valide.', - 'max' => [ + 'mac_address' => 'Le champ :attribute doit être une adresse MAC valide.', + 'max' => [ 'array' => 'Le tableau :attribute ne peut pas contenir plus que :max éléments.', 'file' => 'La taille du fichier de :attribute ne peut pas dépasser :max kilo-octets.', 'numeric' => 'La valeur de :attribute ne peut pas être supérieure à :max.', 'string' => 'Le texte de :attribute ne peut pas contenir plus de :max caractères.', ], - 'max_digits' => 'Le champ :attribute ne doit pas avoir plus de :max chiffres.', - 'mimes' => 'Le champ :attribute doit être un fichier de type : :values.', - 'mimetypes' => 'Le champ :attribute doit être un fichier de type : :values.', - 'min' => [ + 'max_digits' => 'Le champ :attribute ne doit pas avoir plus de :max chiffres.', + 'mimes' => 'Le champ :attribute doit être un fichier de type : :values.', + 'mimetypes' => 'Le champ :attribute doit être un fichier de type : :values.', + 'min' => [ 'array' => 'Le tableau :attribute doit contenir au moins :min éléments.', 'file' => 'La taille du fichier de :attribute doit être supérieure ou égale à :min kilo-octets.', 'numeric' => 'La valeur de :attribute doit être supérieure ou égale à :min.', 'string' => 'Le texte de :attribute doit contenir au moins :min caractères.', ], - 'min_digits' => 'Le champ :attribute doit avoir au moins :min chiffres.', - 'missing' => 'Le champ :attribute doit être manquant.', - 'missing_if' => 'Le champ :attribute doit être manquant quand :other a la valeur :value.', - 'missing_unless' => 'Le champ :attribute doit être manquant sauf si :other a la valeur :value.', - 'missing_with' => 'Le champ :attribute doit être manquant quand :values est présent.', - 'missing_with_all' => 'Le champ :attribute doit être manquant quand :values sont présents.', - 'multiple_of' => 'La valeur de :attribute doit être un multiple de :value', - 'not_in' => 'Le champ :attribute sélectionné n\'est pas valide.', - 'not_regex' => 'Le format du champ :attribute n\'est pas valide.', - 'numeric' => 'Le champ :attribute doit contenir un nombre.', - 'password' => [ + 'min_digits' => 'Le champ :attribute doit avoir au moins :min chiffres.', + 'missing' => 'Le champ :attribute doit être manquant.', + 'missing_if' => 'Le champ :attribute doit être manquant quand :other a la valeur :value.', + 'missing_unless' => 'Le champ :attribute doit être manquant sauf si :other a la valeur :value.', + 'missing_with' => 'Le champ :attribute doit être manquant quand :values est présent.', + 'missing_with_all' => 'Le champ :attribute doit être manquant quand :values sont présents.', + 'multiple_of' => 'La valeur de :attribute doit être un multiple de :value', + 'not_in' => 'Le champ :attribute sélectionné n\'est pas valide.', + 'not_regex' => 'Le format du champ :attribute n\'est pas valide.', + 'numeric' => 'Le champ :attribute doit contenir un nombre.', + 'password' => [ 'letters' => 'Le champ :attribute doit contenir au moins une lettre.', 'mixed' => 'Le champ :attribute doit contenir au moins une majuscule et une minuscule.', 'numbers' => 'Le champ :attribute doit contenir au moins un chiffre.', 'symbols' => 'Le champ :attribute doit contenir au moins un symbole.', - 'uncompromised' => 'La valeur du champ :attribute est apparue dans une fuite de données. - Veuillez choisir une valeur différente.', + 'uncompromised' => 'La valeur du champ :attribute est apparue dans une fuite de données. Veuillez choisir une valeur différente.', ], - 'present' => 'Le champ :attribute doit être présent.', - 'prohibited' => 'Le champ :attribute est interdit.', - 'prohibited_if' => 'Le champ :attribute est interdit quand :other a la valeur :value.', - 'prohibited_unless' => 'Le champ :attribute est interdit à moins que :other est l\'une des valeurs :values.', - 'prohibits' => 'Le champ :attribute interdit :other d\'être présent.', - 'regex' => 'Le format du champ :attribute est invalide.', - 'required' => 'Le champ :attribute est obligatoire.', - 'required_array_keys' => 'Le champ :attribute doit contenir des entrées pour : :values.', - 'required_if' => 'Le champ :attribute est obligatoire quand la valeur de :other est :value.', - 'required_if_accepted' => 'Le champ :attribute est obligatoire quand le champ :other a été accepté.', - 'required_unless' => 'Le champ :attribute est obligatoire sauf si :other est :values.', - 'required_with' => 'Le champ :attribute est obligatoire quand :values est présent.', - 'required_with_all' => 'Le champ :attribute est obligatoire quand :values sont présents.', - 'required_without' => 'Le champ :attribute est obligatoire quand :values n\'est pas présent.', - 'required_without_all' => 'Le champ :attribute est requis quand aucun de :values n\'est présent.', - 'same' => 'Les champs :attribute et :other doivent être identiques.', - 'size' => [ + 'phone' => 'Le champ :attribute n\'est pas un numéro de téléphone valide, il accepte les + numéros des pays suivants :countries.', + 'postal_code' => 'le champ :attribute accepte les codes postaux des pays suivants + :countries comme par exemple :examples', + 'present' => 'Le champ :attribute doit être présent.', + 'present_if' => 'Le champ :attribute doit être présent lorsque :other est :value.', + 'present_unless' => 'Le champ :attribute doit être présent sauf si :other vaut :value.', + 'present_with' => 'Le champ :attribute doit être présent lorsque :values est présent.', + 'present_with_all' => 'Le champ :attribute doit être présent lorsque :values sont présents.', + 'prohibited' => 'Le champ :attribute est interdit.', + 'prohibited_if' => 'Le champ :attribute est interdit quand :other a la valeur :value.', + 'prohibited_if_accepted' => 'Le champ :attribute est interdit quand :other a été accepté.', + 'prohibited_if_declined' => 'Le champ :attribute est interdit quand :other a été refusé.', + 'prohibited_unless' => 'Le champ :attribute est interdit à moins que :other est l\'une des valeurs :values.', + 'prohibits' => 'Le champ :attribute interdit :other d\'être présent.', + 'regex' => 'Le format du champ :attribute est invalide.', + 'required' => 'Le champ :attribute est obligatoire.', + 'required_array_keys' => 'Le champ :attribute doit contenir des entrées pour : :values.', + 'required_if' => 'Le champ :attribute est obligatoire quand la valeur de :other est :value.', + 'required_if_accepted' => 'Le champ :attribute est obligatoire quand le champ :other a été accepté.', + 'required_if_declined' => 'Le champ :attribute est obligatoire quand le champ :other a été refusé.', + 'required_unless' => 'Le champ :attribute est obligatoire sauf si :other est :values.', + 'required_with' => 'Le champ :attribute est obligatoire quand :values est présent.', + 'required_with_all' => 'Le champ :attribute est obligatoire quand :values sont présents.', + 'required_without' => 'Le champ :attribute est obligatoire quand :values n\'est pas présent.', + 'required_without_all' => 'Le champ :attribute est requis quand aucun de :values n\'est présent.', + 'same' => 'Les champs :attribute et :other doivent être identiques.', + 'size' => [ 'array' => 'Le tableau :attribute doit contenir :size éléments.', 'file' => 'La taille du fichier de :attribute doit être de :size kilo-octets.', 'numeric' => 'La valeur de :attribute doit être :size.', 'string' => 'Le texte de :attribute doit contenir :size caractères.', ], - 'starts_with' => 'Le champ :attribute doit commencer avec une des valeurs suivantes : :values', - 'string' => 'Le champ :attribute doit être une chaîne de caractères.', - 'timezone' => 'Le champ :attribute doit être un fuseau horaire valide.', - 'ulid' => 'Le champ :attribute doit être un ULID valide.', - 'unique' => 'La valeur du champ :attribute est déjà utilisée.', - 'uploaded' => 'Le fichier du champ :attribute n\'a pu être téléversé.', - 'uppercase' => 'Le champ :attribute doit être en majuscules.', - 'url' => 'Le format de l\'URL de :attribute n\'est pas valide.', - 'uuid' => 'Le champ :attribute doit être un UUID valide', - 'attributes' => [ + 'starts_with' => 'Le champ :attribute doit commencer avec une des valeurs suivantes : :values', + 'string' => 'Le champ :attribute doit être une chaîne de caractères.', + 'timezone' => 'Le champ :attribute doit être un fuseau horaire valide.', + 'ulid' => 'Le champ :attribute doit être un ULID valide.', + 'unique' => 'La valeur du champ :attribute est déjà utilisée.', + 'uploaded' => 'Le fichier du champ :attribute n\'a pu être téléversé.', + 'uppercase' => 'Le champ :attribute doit être en majuscules.', + 'url' => 'Le format de l\'URL de :attribute n\'est pas valide.', + 'uuid' => 'Le champ :attribute doit être un UUID valide.', + 'attributes' => [ 'address' => 'adresse', + 'affiliate_url' => 'URL d\'affiliation', 'age' => 'âge', 'amount' => 'montant', + 'announcement' => 'annonce', 'area' => 'zone', + 'audience_prize' => 'prix du public', + 'audience_winner' => 'gagnant du public', 'available' => 'disponible', 'birthday' => 'anniversaire', 'body' => 'corps', 'city' => 'ville', + 'color' => 'color', + 'company' => 'entreprise', + 'compilation' => 'compilation', + 'concept' => 'concept', + 'conditions' => 'conditions', 'content' => 'contenu', + 'contest' => 'contest', 'country' => 'pays', - 'created_at' => 'créé à', + 'cover' => 'couverture', + 'created_at' => 'date de création', 'creator' => 'créateur', + 'currency' => 'devise', 'current_password' => 'mot de passe actuel', - 'date' => 'Date', + 'customer' => 'client', + 'date' => 'date', 'date_of_birth' => 'date de naissance', + 'dates' => 'rendez-vous', 'day' => 'jour', - 'deleted_at' => 'supprimé à', - 'description' => 'la description', + 'deleted_at' => 'date de suppression', + 'description' => 'description', + 'display_type' => 'type d\'affichage', 'district' => 'quartier', 'duration' => 'durée', 'email' => 'adresse e-mail', 'excerpt' => 'extrait', 'filter' => 'filtre', + 'finished_at' => 'date de fin', 'first_name' => 'prénom', 'gender' => 'genre', + 'grand_prize' => 'grand prix', 'group' => 'groupe', 'hour' => 'heure', 'image' => 'image', - 'last_name' => 'nom', + 'image_desktop' => 'image de bureau', + 'image_main' => 'image principale', + 'image_mobile' => 'image mobile', + 'images' => 'images', + 'is_audience_winner' => 'est le gagnant du public', + 'is_hidden' => 'est caché', + 'is_subscribed' => 'est abonné', + 'is_visible' => 'est visible', + 'is_winner' => 'est gagnant', + 'items' => 'articles', + 'key' => 'clé', + 'last_name' => 'nom de famille', 'lesson' => 'leçon', 'line_address_1' => 'ligne d\'adresse 1', 'line_address_2' => 'ligne d\'adresse 2', + 'login' => 'identifiant', 'message' => 'message', 'middle_name' => 'deuxième prénom', 'minute' => 'minute', @@ -187,96 +231,118 @@ return [ 'password_confirmation' => 'confirmation du mot de passe', 'phone' => 'téléphone', 'photo' => 'photo', + 'portfolio' => 'portefeuille', 'postal_code' => 'code postal', + 'preview' => 'aperçu', 'price' => 'prix', + 'product_id' => 'identifiant du produit', + 'product_uid' => 'UID du produit', + 'product_uuid' => 'UUID du produit', + 'promo_code' => 'code promo', 'province' => 'région', - 'recaptcha_response_field' => 'champ de réponse recaptcha', + 'quantity' => 'quantité', + 'reason' => 'raison', + 'recaptcha_response_field' => 'champ de réponse reCAPTCHA', + 'referee' => 'arbitre', + 'referees' => 'arbitres', + 'region' => 'region', + 'reject_reason' => 'motif de rejet', 'remember' => 'se souvenir', - 'restored_at' => 'restauré à', + 'restored_at' => 'date de restauration', 'result_text_under_image' => 'texte de résultat sous l\'image', 'role' => 'rôle', + 'rule' => 'règle', + 'rules' => 'règles', 'second' => 'seconde', 'sex' => 'sexe', + 'shipment' => 'expédition', 'short_text' => 'texte court', 'size' => 'taille', + 'skills' => 'compétences', + 'slug' => 'slug', + 'specialization' => 'spécialisation', + 'started_at' => 'date de début', 'state' => 'état', + 'status' => 'statut', 'street' => 'rue', 'student' => 'étudiant', 'subject' => 'sujet', + 'tag' => 'mot clé', + 'tags' => 'mots clés', 'teacher' => 'professeur', 'terms' => 'conditions', - 'test_description' => 'description test', - 'test_locale' => 'localisation test', - 'test_name' => 'nom test', + 'test_description' => 'description du test', + 'test_locale' => 'localisation du test', + 'test_name' => 'nom du test', 'text' => 'texte', 'time' => 'heure', 'title' => 'titre', - 'updated_at' => 'mis à jour à', + 'type' => 'type', + 'updated_at' => 'date de mise à jour', + 'user' => 'utilisateur', 'username' => 'nom d\'utilisateur', + 'value' => 'valeur', + 'winner' => 'gagnant', + 'work' => 'travail', 'year' => 'année', ], - 'ean' => 'Le champ :attribute doit être un code EAN valide (7, 8 ou 13 chiffres)', - 'postal_code' => 'le champ :attribute accepte les codes postaux des pays suivants - :countries comme par exemple :examples', - 'phone' => 'Le champ :attribute n\'est pas un numéro de téléphone valide, il accepte les - numéros des pays suivants :countries.', - 'custom' => [ - 'of_the' => [ - 'male' => 'du ', - 'female' => 'de la ', - 'vowel' => 'de l\'' - ], + 'custom' => [ + 'activated' => 'activé', + 'activated_close_page' => 'activation page de fermeture', + 'activated_teaser' => 'activation du teaser', + 'analytics' => 'analytics', + 'answer' => 'réponse', + 'arg' => 'argumentaire', 'attribute_alt' => 'attribut alt', 'attribute_title' => 'attribut title', - 'event' => 'évènement', - 'model' => 'élément ciblé', - 'order' => 'ordre', - 'publication' => 'publication', - 'activated' => 'activé', - 'target' => 'cible', - 'static_page_type' => 'type de page', - 'seo_title' => 'titre SEO', - 'seo_description' => 'description SEO', - 'ip' => 'IP', - 'code' => 'code', - 'unique_code' => 'code unique', - 'product' => 'produit', - 'value' => 'valeur', - 'question' => 'question', - 'answer' => 'réponse', - 'theme' => 'thème', - 'file_name' => 'nom du fichier', - 'label' => 'libellé', - 'arg' => 'argumentaire', - 'subtitle' => 'sous-titre', - 'quantity' => 'quantité', - 'pdf_winning_proof' => 'pdf preuve de gain', - 'picture' => 'illustration', - 'ean_code' => 'code EAN', - 'start_date' => 'date de début', - 'end_date' => 'date de fin', - 'nb_participation_player' => 'nombre de participation par joueur ', - 'nb_participation_ip' => 'nombre de participation par adresse IP', - 'nb_unique_code_use' => 'nombre d\'utilisation du code unique', - 'code_length' => 'longueur des code uniques', - 'code_type' => 'type de code', - 'activated_teaser' => 'activation du teaser', - 'activated_close_page' => 'activation page de fermeture', - 'close_page_active_date' => 'page active jusqu\'au', - 'redirect_close' => 'url de redirection après la date de fin du jeu', - 'winning_proof' => 'activer les preuves de gain', - 'company' => 'société', - 'discounts_activated' => 'activer les bons de réduction', - 'discounts_site' => 'référence du site', - 'discounts_campaign' => 'référence de la campagne', - 'analytics' => 'analytics', - 'game_rules' => 'règlement du jeu', - 'notify_prize_sent' => 'notification de lot envoyé au participant', - 'comment' => 'commentaire', 'authorized_countries' => 'pays éligibles au jeu', 'barcode' => 'code-barres du produit', - 'ticket' => 'ticket de caisse avec la date', - 'sticker' => 'sticker du produit', + 'close_page_active_date' => 'page active jusqu\'au', + 'code' => 'code', + 'code_length' => 'longueur des code uniques', + 'code_type' => 'type de code', + 'comment' => 'commentaire', + 'company' => 'société', + 'discounts_activated' => 'activer les bons de réduction', + 'discounts_campaign' => 'référence de la campagne', + 'discounts_site' => 'référence du site', + 'ean_code' => 'code EAN', + 'end_date' => 'date de fin', 'error_list' => 'Liste des erreurs :', + 'event' => 'évènement', + 'file_name' => 'nom du fichier', + 'game_rules' => 'règlement du jeu', + 'ip' => 'IP', + 'label' => 'libellé', + 'model' => 'élément ciblé', + 'nb_participation_ip' => 'nombre de participation par adresse IP', + 'nb_participation_player' => 'nombre de participation par joueur ', + 'nb_unique_code_use' => 'nombre d\'utilisation du code unique', + 'notify_prize_sent' => 'notification de lot envoyé au participant', + 'of_the' => [ + 'female' => 'de la ', + 'male' => 'du ', + 'vowel' => 'de l\'', + ], + 'order' => 'ordre', + 'pdf_winning_proof' => 'pdf preuve de gain', + 'picture' => 'illustration', + 'product' => 'produit', + 'publication' => 'publication', + 'quantity' => 'quantité', + 'question' => 'question', + 'redirect_close' => 'url de redirection après la date de fin du jeu', + 'seo_description' => 'description SEO', + 'seo_title' => 'titre SEO', + 'start_date' => 'date de début', + 'static_page_type' => 'type de page', + 'sticker' => 'sticker du produit', + 'subtitle' => 'sous-titre', + 'target' => 'cible', + 'theme' => 'thème', + 'ticket' => 'ticket de caisse avec la date', + 'unique_code' => 'code unique', + 'value' => 'valeur', + 'winning_proof' => 'activer les preuves de gain', ], ]; diff --git a/resources/lang/fr/vue.php b/resources/lang/fr/vue.php index 9491a29..b3b1383 100644 --- a/resources/lang/fr/vue.php +++ b/resources/lang/fr/vue.php @@ -1,5 +1,7 @@ [ 'choose_a_file' => 'Choisir un fichier', @@ -29,10 +31,10 @@ return [ ], 'WordCounterComponent' => [ 'words' => 'Mots', - 'characters' => 'Caractères' + 'characters' => 'Caractères', ], 'PasswordVisibility' => [ 'hide' => 'Cacher le mot de passe', 'show' => 'Dévoiler le mot de passe', - ] + ], ]; diff --git a/routes/api.php b/routes/api.php index b3d9bbc..174d7fd 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1 +1,3 @@ push(trans('models.classes.banned_ips'), route('bo.banned_ips.index')); +Breadcrumbs::for('bo.banned_ips.index', function (Generator $trail): void { + $trail->push( + Str::of(trans('models.classes.banned_ips'))->plural()->ucfirst()->value(), + route('bo.banned_ips.index'), + ); }); -Breadcrumbs::for('bo.banned_ips.create', function (Generator $trail) { +Breadcrumbs::for('bo.banned_ips.create', function (Generator $trail): void { $trail->parent('bo.banned_ips.index'); $trail->push(trans('crud.actions.create'), route('bo.banned_ips.create')); }); -Breadcrumbs::for('bo.banned_ips.edit', function (Generator $trail, BannedIp $bannedip) { +Breadcrumbs::for('bo.banned_ips.edit', function (Generator $trail, BannedIp $bannedip): void { $trail->parent('bo.banned_ips.index'); $trail->push(trans('crud.actions.edit'), route('bo.banned_ips.edit', $bannedip)); }); // * CONTENTS -Breadcrumbs::for('bo.static_pages.index', function (Generator $trail) { - $trail->push(Str::ucfirst(trans_choice('models.classes.static_page', '*')), route('bo.static_pages.index')); +Breadcrumbs::for('bo.static_pages.index', function (Generator $trail): void { + $trail->push(Str::ucfirst(trans_choice('models.classes.static_page', \INF)), route('bo.static_pages.index')); }); -Breadcrumbs::for('bo.static_pages.edit', function (Generator $trail, StaticPage $page) { +Breadcrumbs::for('bo.static_pages.edit', function (Generator $trail, StaticPage $page): void { $trail->parent('bo.static_pages.index'); $trail->push(trans('crud.actions.edit'), route('bo.static_pages.edit', $page)); }); // * FAQ - QUESTIONS -Breadcrumbs::for('bo.faq-questions.index', function (Generator $trail) { - $trail->push(trans_choice('models.classes.faq-questions', 2), route('bo.faq-questions.index')); +Breadcrumbs::for('bo.faq-questions.index', function (Generator $trail): void { + $trail->push( + Str::of(trans_choice('models.classes.faq-questions', 2))->plural()->ucfirst()->value(), + route('bo.faq-questions.index'), + ); }); -Breadcrumbs::for('bo.faq-questions.create', function (Generator $trail) { +Breadcrumbs::for('bo.faq-questions.create', function (Generator $trail): void { $trail->parent('bo.faq-questions.index'); $trail->push(trans('crud.actions.create'), route('bo.faq-questions.create')); }); -Breadcrumbs::for('bo.faq-questions.edit', function (Generator $trail, FaqQuestion $faqQuestion) { +Breadcrumbs::for('bo.faq-questions.edit', function (Generator $trail, FaqQuestion $faqQuestion): void { $trail->parent('bo.faq-questions.index'); $trail->push(trans('crud.actions.edit'), route('bo.faq-questions.edit', $faqQuestion)); }); // * FAQ - THEMES -Breadcrumbs::for('bo.faq-themes.index', function (Generator $trail) { - $trail->push(trans_choice('models.classes.faq-themes', 2), route('bo.faq-themes.index')); +Breadcrumbs::for('bo.faq-themes.index', function (Generator $trail): void { + $trail->push( + Str::of(trans_choice('models.classes.faq-themes', 2))->plural()->ucfirst()->value(), + route('bo.faq-themes.index'), + ); }); -Breadcrumbs::for('bo.faq-themes.create', function (Generator $trail) { +Breadcrumbs::for('bo.faq-themes.create', function (Generator $trail): void { $trail->parent('bo.faq-themes.index'); $trail->push(trans('crud.actions.create'), route('bo.faq-themes.create')); }); -Breadcrumbs::for('bo.faq-themes.edit', function (Generator $trail, FaqTheme $faqTheme) { +Breadcrumbs::for('bo.faq-themes.edit', function (Generator $trail, FaqTheme $faqTheme): void { $trail->parent('bo.faq-themes.index'); $trail->push(trans('crud.actions.edit'), route('bo.faq-themes.edit', $faqTheme)); }); // * PRIZES -Breadcrumbs::for('bo.prizes.index', function (Generator $trail) { - $trail->push(Str::ucfirst(trans_choice('models.classes.prize', 2)), route('bo.prizes.index')); +Breadcrumbs::for('bo.prizes.index', function (Generator $trail): void { + $trail->push( + Str::of(trans_choice('models.classes.prize', 2))->plural()->ucfirst()->value(), + route('bo.prizes.index'), + ); }); -Breadcrumbs::for('bo.prizes.create', function (Generator $trail) { +Breadcrumbs::for('bo.prizes.create', function (Generator $trail): void { $trail->parent('bo.prizes.index'); $trail->push(trans('crud.actions.create'), route('bo.prizes.create')); }); -Breadcrumbs::for('bo.prizes.edit', function (Generator $trail, Prize $prize) { +Breadcrumbs::for('bo.prizes.edit', function (Generator $trail, Prize $prize): void { $trail->parent('bo.prizes.index'); $trail->push(trans('crud.actions.edit'), route('bo.prizes.edit', $prize)); }); -Breadcrumbs::for('bo.prizes.show', function (Generator $trail, Prize $prize) { +Breadcrumbs::for('bo.prizes.show', function (Generator $trail, Prize $prize): void { $trail->parent('bo.prizes.index'); $trail->push(trans('crud.actions.view'), route('bo.prizes.show', $prize)); }); // * RANGES -Breadcrumbs::for('bo.ranges.index', function (Generator $trail) { - $trail->push(Str::plural(trans('models.classes.range')), route('bo.ranges.index')); +Breadcrumbs::for('bo.ranges.index', function (Generator $trail): void { + $trail->push( + Str::of(trans_choice('models.classes.range', 2))->plural()->ucfirst()->value(), + route('bo.ranges.index'), + ); }); -Breadcrumbs::for('bo.ranges.create', function (Generator $trail) { +Breadcrumbs::for('bo.ranges.create', function (Generator $trail): void { $trail->parent('bo.ranges.index'); $trail->push(trans('crud.actions.create'), route('bo.ranges.create')); }); -Breadcrumbs::for('bo.ranges.edit', function (Generator $trail, Range $range) { +Breadcrumbs::for('bo.ranges.edit', function (Generator $trail, Range $range): void { $trail->parent('bo.ranges.index'); $trail->push(trans('crud.actions.edit'), route('bo.ranges.edit', $range)); }); -Breadcrumbs::for('bo.ranges.show', function (Generator $trail, Range $range) { +Breadcrumbs::for('bo.ranges.show', function (Generator $trail, Range $range): void { $trail->parent('bo.ranges.index'); $trail->push(trans('crud.actions.view'), route('bo.ranges.show', $range)); }); // * PRODUCTS -Breadcrumbs::for('bo.products.index', function (Generator $trail) { - $trail->push(Str::plural(trans('models.classes.product')), route('bo.products.index')); +Breadcrumbs::for('bo.products.index', function (Generator $trail): void { + $trail->push( + Str::of(trans_choice('models.classes.product', 2))->plural()->ucfirst()->value(), + route('bo.products.index'), + ); }); -Breadcrumbs::for('bo.products.create', function (Generator $trail) { +Breadcrumbs::for('bo.products.create', function (Generator $trail): void { $trail->parent('bo.products.index'); $trail->push(trans('crud.actions.create'), route('bo.products.create')); }); -Breadcrumbs::for('bo.products.edit', function (Generator $trail, Product $product) { +Breadcrumbs::for('bo.products.edit', function (Generator $trail, Product $product): void { $trail->parent('bo.products.index'); $trail->push(trans('crud.actions.edit'), route('bo.products.edit', $product)); }); -Breadcrumbs::for('bo.products.show', function (Generator $trail, Product $product) { +Breadcrumbs::for('bo.products.show', function (Generator $trail, Product $product): void { $trail->parent('bo.products.index'); $trail->push(trans('crud.actions.view'), route('bo.products.show', $product)); }); // * SETTINGS -Breadcrumbs::for('bo.settings.edit', function (Generator $trail) { - $trail->push(Str::ucfirst(trans('models.classes.settings')), route('bo.products.index')); +Breadcrumbs::for('bo.settings.edit', function (Generator $trail): void { + $trail->push( + Str::of(trans('models.classes.settings'))->plural()->ucfirst()->value(), + route('bo.products.index'), + ); }); // * WINNERS LIST -Breadcrumbs::for('bo.participations.winners-list', function (Generator $trail) { - $trail->push(Str::of(trans('models.classes.winner'))->ucfirst()->plural(), route('bo.participations.winners-list')); +Breadcrumbs::for('bo.participations.winners-list', function (Generator $trail): void { + $trail->push(Str::of(trans('models.classes.winner'))->ucfirst()->plural()->value(), route('bo.participations.winners-list')); }); -Breadcrumbs::for('bo.participations.set-comment', function (Generator $trail, Participation $participation) { +Breadcrumbs::for('bo.participations.set-comment', function (Generator $trail, Participation $participation): void { $trail->parent('bo.participations.winners-list'); $trail->push( Str::ucfirst(trans('validation.custom.comment')), @@ -129,10 +153,31 @@ Breadcrumbs::for('bo.participations.set-comment', function (Generator $trail, Pa }); // * UNIQUES CODES -Breadcrumbs::for('bo.codes.index', function (Generator $trail) { - $trail->push(Str::of(trans('validation.custom.unique_code'))->plural()->ucfirst(), route('bo.codes.index')); +Breadcrumbs::for('bo.codes.index', function (Generator $trail): void { + $trail->push(Str::of(trans('validation.custom.unique_code'))->plural()->ucfirst()->value(), route('bo.codes.index')); }); -Breadcrumbs::for('bo.codes.search', function (Generator $trail) { +Breadcrumbs::for('bo.codes.search', function (Generator $trail): void { $trail->parent('bo.codes.index'); $trail->push(Str::ucfirst(trans('crud.actions.view')), route('bo.codes.search')); }); + +// * USERS +Breadcrumbs::for('bo.users.index', function (Generator $trail): void { + $trail->push(Str::of(trans('models.classes.user'))->plural()->ucfirst()->value(), route('bo.users.index')); +}); +Breadcrumbs::for('bo.users.create', function (Generator $trail): void { + $trail->parent('bo.users.index'); + $trail->push(trans('crud.actions.create'), route('bo.users.create')); +}); +Breadcrumbs::for('bo.users.edit', function (Generator $trail, User $user): void { + $trail->parent('bo.users.index'); + $trail->push(trans('crud.actions.edit'), route('bo.users.edit', $user)); +}); +Breadcrumbs::for('bo.users.show', function (Generator $trail, User $user): void { + $trail->parent('bo.users.index'); + $trail->push(trans('crud.actions.view'), route('bo.users.show', $user)); +}); +Breadcrumbs::for('bo.users.duplicate', function (Generator $trail): void { + $trail->parent('bo.users.index'); + $trail->push(trans('crud.actions.duplicate')); +}); diff --git a/routes/breadcrumbs-fo.php b/routes/breadcrumbs-fo.php index b3d9bbc..174d7fd 100644 --- a/routes/breadcrumbs-fo.php +++ b/routes/breadcrumbs-fo.php @@ -1 +1,3 @@ name('bo.')->group(function () { +Route::prefix('bo')->name('bo.')->group(function (): void { // * Authenticable routes - Route::namespace('\App\Http\Controllers\Bo')->group(function () { + Route::namespace('\App\Http\Controllers\Bo')->group(function (): void { Auth::routes( [ 'confirm' => false, @@ -37,30 +39,30 @@ Route::prefix('bo')->name('bo.')->group(function () { // * Others routes Route::post('theme/set', [Controller::class, 'setTheme'])->name('theme.set'); - Route::middleware('auth:backend')->group(function () { + Route::middleware('auth:backend')->group(function (): void { Route::get('/', [DashboardController::class, 'index'])->name('dashboard'); // * USERS. Route::resource('users', UserController::class)->except('show'); Route::patch('users/{user}/change-published', [ - UserController::class, 'changePublished' + UserController::class, 'changePublished', ])->name('users.change-published'); Route::get('users/{user}/duplicate', [ - UserController::class, 'duplicate' + UserController::class, 'duplicate', ])->name('users.duplicate'); // * StaticPages Route::resource('pages', StaticPageController::class) ->names([ - 'index' => 'static_pages.index', - 'edit' => 'static_pages.edit', + 'index' => 'static_pages.index', + 'edit' => 'static_pages.edit', 'update' => 'static_pages.update', ])->parameters(['pages' => 'static_page']) ->withoutMiddleware('htmlsanitize') ->middleware('htmlsanitize:content') ->only(['index', 'edit', 'update']); - Route::middleware('can:isConceptor')->group(function () { + Route::middleware('can:isConceptor')->group(function (): void { // * ACTIVITY LOGS. Route::resource('activity_logs', ActivityLogController::class)->only(['index', 'show']); }); @@ -90,13 +92,13 @@ Route::prefix('bo')->name('bo.')->group(function () { ->only(['edit', 'update']); // * INSTANT WIN - Route::prefix('instant-win')->name('instant-win.')->group(function () { + Route::prefix('instant-win')->name('instant-win.')->group(function (): void { Route::get('/', [InstantWinController::class, 'index'])->name('index'); Route::get('generate', [InstantWinController::class, 'generate'])->name('generate'); }); // * PARTICIPATIONS - Route::prefix('participations')->name('participations.')->group(function () { + Route::prefix('participations')->name('participations.')->group(function (): void { // * WINNERS LIST Route::get('winners-list', [ParticipationController::class, 'viewWinnerList'])->name('winners-list'); Route::get('{participation}/set-comment', [ParticipationController::class, 'setComment']) @@ -108,7 +110,7 @@ Route::prefix('bo')->name('bo.')->group(function () { }); // * UNIQUES CODES. - Route::prefix('codes')->name('codes.')->group(function () { + Route::prefix('codes')->name('codes.')->group(function (): void { Route::get('/', [CodeController::class, 'index'])->name('index'); Route::post('/', [CodeController::class, 'generate'])->name('generate'); Route::get('search', [CodeController::class, 'search'])->name('search'); diff --git a/routes/web-fo.php b/routes/web-fo.php index 05c6cf5..913b909 100644 --- a/routes/web-fo.php +++ b/routes/web-fo.php @@ -1,20 +1,26 @@ name('fo.')->group(function () { - +Route::middleware(['throttle:credentials'])->name('fo.')->group(function (): void { // * Dev route only - if (app()->environment() === 'local') { - Route::view('/bs-demo', 'back::pages.bs-demo')->name('bs-demo'); - Route::view('/bs-demo-front', 'theme::pages.bs-demo')->name('bs-demo-front'); + if (app()->isLocal()) { + /** @var view-string $viewBo */ + $viewBo = 'back::pages.bs-demo'; + Route::view('/bs-demo', $viewBo)->name('bs-demo'); + + /** @var view-string $viewFo */ + $viewFo = 'theme::pages.bs-demo'; + Route::view('/bs-demo-front', $viewFo)->name('bs-demo-front'); } // * Pages début et fin de jeu @@ -25,9 +31,9 @@ Route::middleware(['throttle:credentials'])->name('fo.')->group(function () { Route::post('/optin', [CustomerController::class, 'addOptIn'])->name('add-single-optin'); // * Routes nécessitant que le jeu soit activé. - Route::middleware('check-game-status')->group(function () { + Route::middleware('check-game-status')->group(function (): void { // * FRONTEND AUTH - Route::namespace('\App\Http\Controllers\Fo')->group(function () { + Route::namespace('\App\Http\Controllers\Fo')->group(function (): void { Auth::routes([ 'confirm' => true, 'login' => true, @@ -39,7 +45,7 @@ Route::middleware(['throttle:credentials'])->name('fo.')->group(function () { }); // * Routes nécessitant d'être connecté. - Route::middleware(['auth:frontend', 'verified:fo.verification.notice'])->group(function () { + Route::middleware(['auth:frontend', 'verified:fo.verification.notice'])->group(function (): void { // * Participation routes Route::get('saisir-code', [ParticipateController::class, 'participate'])->name('participate'); Route::post('saisir-code', [ParticipateController::class, 'participateSubmit'])->name('participate-submit'); @@ -63,7 +69,6 @@ Route::middleware(['throttle:credentials'])->name('fo.')->group(function () { Route::get('reductions/print', [DiscountController::class, 'fetchBrPdf'])->name('discounts.print'); }); - Route::get('/', [HomeController::class, 'home'])->name('homepage'); Route::get('produits-porteurs', [HomeController::class, 'showProducts'])->name('produits-porteurs'); Route::get('faq', [HomeController::class, 'showFaq'])->name('faq'); diff --git a/routes/web-re7.php b/routes/web-re7.php index 89b637a..8d9ea37 100644 --- a/routes/web-re7.php +++ b/routes/web-re7.php @@ -1,9 +1,11 @@ name('re7.')->middleware(['auth:backend'])->group(function () { +Route::prefix('re7')->name('re7.')->middleware(['auth:backend'])->group(function (): void { Route::get('home', [Re7Controller::class, 'home'])->name('home'); Route::get('teaser', [Re7Controller::class, 'teaser'])->name('teaser'); Route::get('end-game', [Re7Controller::class, 'endGame'])->name('end-game'); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index e3ad27e..e89caf6 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -1,5 +1,7 @@ assertTrue(true); - } -}