Merge branch 'php-stan-issues-48-57' into 'develop'

Php stan issues 48 57

See merge request ldc-web/projets/agis!26
This commit is contained in:
Vincent BRIDIER 2024-01-29 08:40:19 +00:00
commit e2d3d7ec28
62 changed files with 1706 additions and 839 deletions

View file

@ -28,35 +28,35 @@ class UserCreate extends Command
/**
* The first name of the new user.
*
* @var string
* @var string|null
*/
protected $first_name;
/**
* The last name of the new user.
*
* @var string
* @var string|null
*/
protected $last_name;
/**
* The email of the new user.
*
* @var string
* @var string|null
*/
protected $email;
/**
* The password of the new user.
*
* @var string
* @var string|null
*/
protected $password;
/**
* The role of the new user.
*
* @var string
* @var string|null
*/
protected $role;
@ -219,7 +219,7 @@ class UserCreate extends Command
$this->role = $tmp;
} catch (ValidationException $e) {
$this->error(sprintf(
'Please choose from the selection',
'Please choose from the selection %s',
\implode(',', collect($e->errors())->flatten()->all())
));
continue;

View file

@ -15,6 +15,8 @@ enum ActivityLogsEventEnum: int
/**
* Optionnal labels definition
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::created->name => 'Création',

View file

@ -13,6 +13,8 @@ enum CivilityEnum: int
/**
* Optionnal labels definition
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::man->name => 'Monsieur',

View file

@ -15,6 +15,8 @@ enum ObjectEnum: int
/**
* Optionnal labels definition
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::customerService->name => 'Service consommateurs',

View file

@ -260,6 +260,8 @@ enum Country: int
/**
* Optionnal labels definition
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::afghanistan->name => 'Afghanistan',

View file

@ -16,6 +16,8 @@ enum CategoryEnum: int
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::enterprise->name => 'La vie d\'Entreprise',

View file

@ -16,6 +16,8 @@ enum CookingModeEnum: int
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::microwave->name => 'Micro-ondes',

View file

@ -14,6 +14,8 @@ enum BackgroundEnum: int
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::candlemas->name => 'Chandeleur',

View file

@ -21,6 +21,8 @@ enum StaticPageType: int
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::contact->name => 'Contact',

View file

@ -13,6 +13,8 @@ enum BootstrapThemeEnum: int
/**
* Optionnal labels definition
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::light->name => 'Light',

View file

@ -14,6 +14,8 @@ enum RoleEnum: int
/**
* Optionnal labels definition.
*
* @phpstan-ignore-next-line
*/
private const LABELS = [
self::conceptor->name => 'Concepteur',

View file

@ -51,7 +51,7 @@ class ActivityLogsController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\ActivityLog $activity_log
* @param \App\Models\ActivityLog $activity_log
* @return \Illuminate\Contracts\View\View
*/
public function show(ActivityLog $activity_log): \Illuminate\Contracts\View\View

View file

@ -98,7 +98,7 @@ class CommitmentController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\Commitment $commitment
* @param \App\Models\Commitment $commitment
* @return \Illuminate\Contracts\View\View
*/
public function edit(Commitment $commitment): \Illuminate\Contracts\View\View

View file

@ -28,7 +28,7 @@ class JoinuspageController extends Controller
/**
* Update the specified resource in storage.
*
* @param \App\Http\Requests\Bo\Joinuspages\UpdateJoinuspageRequest $request
* @param \App\Http\Requests\Bo\Joinuspage\UpdateJoinuspageRequest $request
* @return \Illuminate\Http\RedirectResponse
*/
public function update(UpdateJoinuspageRequest $request): \Illuminate\Http\RedirectResponse

View file

@ -104,7 +104,7 @@ class NewsController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\News $news
* @param \App\Models\News $news
* @return \Illuminate\Contracts\View\View
*/
public function edit(News $news): \Illuminate\Contracts\View\View

View file

@ -115,7 +115,7 @@ class ProductController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\Product $product
* @param \App\Models\Product $product
* @return \Illuminate\Contracts\View\View
*/
public function edit(Product $product): \Illuminate\Contracts\View\View

View file

@ -104,7 +104,7 @@ class RangeController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\Range $range
* @param \App\Models\Range $range
* @return \Illuminate\Contracts\View\View
*/
public function edit(Range $range): \Illuminate\Contracts\View\View
@ -143,7 +143,9 @@ class RangeController extends Controller
*/
public function destroy(Range $range): \Illuminate\Http\RedirectResponse
{
if (!$range->products->isEmpty()) {
/** @var \Illuminate\Database\Eloquent\Collection $products*/
$products = $range->products;
if (!$products->isEmpty()) {
return redirect()->back()
->with('error', __('crud.messages.cannot_be_deleted_relation', [
'model' => Str::ucfirst(__('models.classes.range')),

View file

@ -98,7 +98,7 @@ class SeasonalSectionController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\SeasonalSection $seasonalSection
* @param \App\Models\SeasonalSection $seasonalSection
* @return \Illuminate\Contracts\View\View
*/
public function edit(SeasonalSection $seasonalSection): \Illuminate\Contracts\View\View

View file

@ -98,7 +98,7 @@ class StampController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\Stamp $stamp
* @param \App\Models\Stamp $stamp
* @return \Illuminate\Contracts\View\View
*/
public function edit(Stamp $stamp): \Illuminate\Contracts\View\View

View file

@ -56,7 +56,7 @@ class StaticPageController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\StaticPage $static_page
* @param \App\Models\StaticPage $static_page
* @return \Illuminate\Contracts\View\View
*/
public function edit(StaticPage $static_page): \Illuminate\Contracts\View\View

View file

@ -100,7 +100,7 @@ class TestimonialController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\Testimonial $testimonial
* @param \App\Models\Testimonial $testimonial
* @return \Illuminate\Contracts\View\View
*/
public function edit(Testimonial $testimonial): \Illuminate\Contracts\View\View

View file

@ -102,7 +102,7 @@ class UsersController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param App\Models\User $user
* @param \App\Models\User $user
* @return \Illuminate\Contracts\View\View
*/
public function edit(User $user): \Illuminate\Contracts\View\View

View file

@ -94,7 +94,7 @@ class Controller extends BaseController
return $query;
}
// Get models with relation's name/label.
if (Str::endsWith($field, '_id') && $query->getModel()->has(Str::remove('_id', $field))) {
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 . '%');
@ -122,12 +122,15 @@ class Controller extends BaseController
*/
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.
isset($query->getModel()->getCasts()[$field]) and // Check if there is cast about specific field.
enum_exists($query->getModel()->getCasts()[$field]) // Check if the cast is an enum.
$cast and // Check if there is cast about specific field.
enum_exists($cast) // Check if the cast is an enum.
) {
$cases = collect($query->getModel()->getCasts()[$field]::toArray());
/** @var \App\Traits\Enums $cast */
// @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));
});
@ -148,12 +151,12 @@ class Controller extends BaseController
{
$rName = request()->route()->getName();
$table = $query->getModel()->getTable();
if (request()->sort_col) {
Session::put("$rName.sort_col", request()->sort_col);
if (request()->input('sort_col')) {
Session::put("$rName.sort_col", request()->input('sort_col'));
Session::put("$rName.sorted", true);
}
if (request()->sort_way) {
Session::put("$rName.sort_way", request()->sort_way);
if (request()->input('sort_way')) {
Session::put("$rName.sort_way", request()->input('sort_way'));
Session::put("$rName.sorted", true);
}
if (request()->rst) {
@ -161,12 +164,16 @@ 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 (
!isset($ignore) or
(isset($ignore) and !in_array(request()->sort_col, $ignore))
) {
$query = $query->orderBy(\sprintf("$table.%s", request()->sort_col), request()->sort_way);
if (
request()->input('sort_col') and
request()->input('sort_way') and
Schema::hasColumn($table, request()->input('sort_col'))
) {
if (!in_array(request()->input('sort_col'), $ignore)) {
$query = $query->orderBy(
\sprintf("$table.%s", request()->input('sort_col')),
request()->input('sort_way')
);
}
} elseif (Schema::hasColumn($table, 'order')) {
$query = $query->orderBy('order', 'ASC');

View file

@ -59,7 +59,10 @@ class SecureHeaders
config('app.debug') ? "https://{$host}:4443" : '',
'https://yl.s-web.fr',
]) . ';',
"img-src * https://yl.s-web.fr data: blob:;",
"img-src 'self' data: blob: " . implode(' ', [
// * VITE DEV
config('app.debug') ? "https://{$host}:4443" : ''
]) . ';',
'frame-src ' . implode(' ', [
'https://www.google.com/recaptcha/',
'https://recaptcha.google.com/recaptcha/',

View file

@ -24,8 +24,10 @@ class UpdateStaticPageRequest extends FormRequest
*/
public function prepareForValidation(): void
{
/** @var \App\Models\StaticPage $staticPageModel */
$staticPageModel = $this->route('static_page');
if (
\in_array($this->route('static_page')->type, [
\in_array($staticPageModel->type, [
\App\Enums\StaticPageType::confidentiality,
\App\Enums\StaticPageType::legals
])

View file

@ -109,7 +109,7 @@ abstract class UpdateMiniCrudRequest extends FormRequest
$rules = array_merge($rules, [
"data.$iptName.value" => [
function (string $attribute, $value, callable $fail) use ($sizes) {
return ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
}
],
$this->compileValidate(

View file

@ -3,7 +3,9 @@
namespace App\Http\Requests\Bo\Users;
use App\Enums\Users\RoleEnum;
use App\Models\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rules\Enum;
use Illuminate\Validation\Rules\Password;
@ -16,7 +18,7 @@ class StoreUserRequest extends FormRequest
*/
public function authorize(): bool
{
return auth('backend')->check();
return Gate::check('create', User::class);
}
/**
@ -24,10 +26,10 @@ class StoreUserRequest extends FormRequest
*
* @return void
*/
protected function prepareForValidation()
protected function prepareForValidation(): void
{
$this->merge([
'published' => $this->published ? true : false
'published' => $this->boolean('published')
]);
}

View file

@ -2,23 +2,35 @@
namespace App\Http\Requests\Bo\Users;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\Password;
class UpdateUserRequest extends StoreUserRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return Gate::check('update', $this->route('user'));
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
protected function prepareForValidation(): void
{
$this->merge([
'published' => $this->published ? true : false,
'password' => $this->password ? $this->password : $this->route('user')->password,
'password_confirmation' => $this->password_confirmation ?
$this->password_confirmation :
$this->route('user')->password
'published' => $this->boolean('published'),
'password' => $this->input('password') ??
\optional($this->route('user'))->password,
'password_confirmation' => $this->input('password_confirmation') ??
\optional($this->route('user'))->password
]);
}
@ -30,10 +42,10 @@ class UpdateUserRequest extends StoreUserRequest
public function rules(): array
{
return array_merge(parent::rules(), [
'email' => [
'email' => [
'required',
'email:rfc,strict,dns,spoof,filter',
'unique:users,email,' . $this->route('user')->getKey() . ',id',
Rule::unique('users', 'email')->ignore(\optional($this->route('user'))->getRouteKey())
],
'password' => [
'required', 'required_with:password_confirmation', 'confirmed', 'max:255', Password::min(8)

View file

@ -21,8 +21,8 @@ class ContactRequest extends FormRequest
protected function prepareForValidation()
{
$this->merge([
'accept_rules' => $this->accept_rules ? true : false,
'send_data' => $this->send_data ? true : false,
'accept_rules' => $this->boolean('accept_rules'),
'send_data' => $this->boolean('send_data'),
]);
$this->mergePicture('file');
}
@ -45,9 +45,9 @@ class ContactRequest extends FormRequest
'society' => 'sometimes|nullable|string|between:3,255',
'email' => 'required|email:rfc,strict,dns,spoof,filter|max:255',
'phone' => 'sometimes|nullable|numeric|min:0',
'address' => 'sometimes|nullable|string|between:3,255',
'postal_code' => 'sometimes|nullable|numeric|min:0',
'city' => 'sometimes|nullable|string|between:3,255',
'address' => 'required|string|between:3,255',
'postal_code' => 'required|numeric|min:0',
'city' => 'required|string|between:3,255',
'object' => ['required', new Enum(ObjectEnum::class)],
'message' => 'required|string|between:3,500',
'accept_rules' => 'required|boolean',
@ -57,7 +57,7 @@ class ContactRequest extends FormRequest
$rules = \array_merge($rules, [
'product_name' => [
'string', 'between:3,255', 'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if ($this->get("object") != ObjectEnum::customerService->value()) {
$fail(\trans('le Champs :field doit être vide lorsque le champs objet
@ -69,8 +69,8 @@ class ContactRequest extends FormRequest
}
],
'product_date_limit' => [
'string', 'between:3,255', 'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
'required', 'date',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if ($this->get("object") != ObjectEnum::customerService->value()) {
$fail(\trans('le Champs :field doit être vide lorsque le champs objet
@ -83,7 +83,7 @@ class ContactRequest extends FormRequest
],
'product_barcode' => [
'numeric', 'min:0', 'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if ($this->get("object") != ObjectEnum::customerService->value()) {
$fail(\trans('le Champs :field doit être vide lorsque le champs objet
@ -96,7 +96,7 @@ class ContactRequest extends FormRequest
],
'product_lot' => [
'numeric', 'min:0', 'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if ($this->get("object") != ObjectEnum::customerService->value()) {
$fail(\trans('le Champs :field doit être vide lorsque le champs objet
@ -108,8 +108,8 @@ class ContactRequest extends FormRequest
}
],
'product_date_consumption' => [
'string', 'between:3,255', 'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
'required', 'date',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if ($this->get("object") != ObjectEnum::customerService->value()) {
$fail(\trans('le Champs :field doit être vide lorsque le champs objet
@ -122,7 +122,7 @@ class ContactRequest extends FormRequest
],
'product_location' => [
'string', 'between:3,255', 'required',
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
if ($this->get("object") != ObjectEnum::customerService->value()) {
$fail(\trans('le Champs :field doit être vide lorsque le champs objet
@ -146,8 +146,8 @@ class ContactRequest extends FormRequest
0,
1920,
1080,
3000,
true,
3000,
'product_name,product_date_limit,product_barcode,product_lot,product_date_consumption,product_location'
));
} elseif (isset(request()->file) and (request()->file->getClientMimeType() === "application/pdf")) {
@ -163,7 +163,7 @@ class ContactRequest extends FormRequest
) {
$rules = \array_merge($rules, [
'file' => [
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
// @phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
function ($attribute, $value, $fail) {
$fail(\trans('Le format du fichier doit être .jpg, .png ou .pdf'));
}

View file

@ -19,7 +19,7 @@ class SeasonalSectionStatusUpdate
*/
public function handle()
{
/** @var \Illuminate\Database\Eloquent\Collection<array-key, \App\Models\SeasonalSections> */
/** @var \Illuminate\Database\Eloquent\Collection<array-key, \App\Models\SeasonalSection> */
$seasonalsectionsListToPublish = SeasonalSection::query()
->where('publish_at', '<=', Carbon::now()->toDateTime())
->whereNotNull('publish_at')
@ -30,7 +30,7 @@ class SeasonalSectionStatusUpdate
$seasonalsections->published = true;
$seasonalsections->saveOrFail();
}
/** @var \Illuminate\Database\Eloquent\Collection<array-key, \App\Models\SeasonalSections> */
/** @var \Illuminate\Database\Eloquent\Collection<array-key, \App\Models\SeasonalSection> */
$seasonalsectionsListToUnPublish = SeasonalSection::query()
->where('unpublish_at', '<=', Carbon::now()->toDateTime())
->whereNotNull('unpublish_at')

View file

@ -145,7 +145,7 @@ class ExceptionsHelper
$traceStr .= self::handleArgs($stack);
}
$traceStr .= ")\n";
} elseif (isset($stack['function'])) {
} else {
$traceStr .= "{$stack['function']}(";
if (isset($stack['args'])) {
$traceStr .= self::handleArgs($stack);

View file

@ -118,7 +118,7 @@ class FileStorageHelper
);
return str_replace('/private/', '', $newPath);
}//end if
} //end if
if (\is_object($file) and $file instanceof \SplFileInfo) {
/** @var \SplFileInfo $file */
$filename = $filename ?: $file->getBaseName();
@ -309,7 +309,6 @@ class FileStorageHelper
$private ? 'app/private/modelfiles' : 'app/public/modelfiles',
$tableName,
$filename,
$private
);
$filename = self::getFileUniqueName($folderPath, $filename);
return "{$folderPath}/{$filename}";
@ -404,7 +403,7 @@ class FileStorageHelper
$filename = Str::of($filename)->ltrim('.-');
// * Optional beautification
if ($beautify) {
$filename = static::beautifyFilename($filename);
$filename = self::beautifyFilename($filename);
}
// * Maximize filename length to 255 bytes http://serverfault.com/a/9548/44086
/** @var string */

View file

@ -175,11 +175,10 @@ class ToolboxHelper
$url = $match;
try {
$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) &&
$routes->match($request)
) {
// Assert route matches existing routes.
$routes->match($request);
// ? Is url internal ?
if (\parse_url(config('app.url'), \PHP_URL_HOST) === \parse_url($url, \PHP_URL_HOST)) {
// Removes the matched url.
throw ValidationException::withMessages([
$field => trans(
@ -205,14 +204,14 @@ class ToolboxHelper
* @param array|string $replace
* @param array|string $subject
* @param integer $count
* @return array|string
* @return array|string|false
*/
public static function mbReplace(
array|string $search,
array|string $replace,
array|string $subject,
int &$count = 0
): array|string {
): array|string|false {
if (!is_array($search) && is_array($replace)) {
return false;
}
@ -289,9 +288,12 @@ class ToolboxHelper
public static function getOriginal(Model $model, string $attribute): mixed
{
if (\in_array('Spatie\Translatable\HasTranslations', \class_uses_recursive($model))) {
// @phpstan-ignore-next-line
return $model->getTranslation(
$attribute,
// @phpstan-ignore-next-line
$model->getLocale(),
// @phpstan-ignore-next-line
$model->useFallbackLocale()
);
}
@ -361,47 +363,45 @@ class ToolboxHelper
/**
* Convert deeply an object to array
*
* @param array|object $input
* @param mixed $input
* @return array
* @throws \RuntimeException If $input var is a scalar value.
*/
public static function objectToArray($input): array
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)) {
$ret = (array)$input;
foreach ($ret as &$item) {
// Recursively process EACH element only if not scalar.
$item = (is_object($item) or is_array($item)) ?
self::objectToArray($item) : $item;
}
return $ret;
} else {
if (!(is_object($input) or 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)) ?
self::objectToArray($item) : $item;
}
return $ret;
}
/**
* Convert deeply an array to object
*
* @param array|object $input
* @param mixed $input
* @return object
* @throws \RuntimeException If $input var is a scalar value.
*/
public static function arrayToObject($input): object
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)) {
$ret = (object)$input;
foreach ($ret as &$item) {
// Recursively process EACH element only if not scalar.
$item = (is_object($item) or is_array($item)) ?
self::arrayToObject($item) : $item;
}
return $ret;
} else {
if (!(is_object($input) or 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)) ?
self::arrayToObject($item) : $item;
}
return $ret;
}
/**
@ -409,11 +409,11 @@ class ToolboxHelper
*
* @param string $attribute
* @param string|null $value
* @param callback $fail
* @param callable $fail
* @param object $sizes
* @return void
*/
public static function validatePicture(string $attribute, string|null $value, callable $fail, object $sizes)
public static function validatePicture(string $attribute, string|null $value, callable $fail, object $sizes): void
{
if (!($useStorage = Storage::exists($value)) and !File::exists($value)) {
$fail(trans(':attribute n\'existe pas dans le système de fichier', [
@ -432,7 +432,7 @@ class ToolboxHelper
'attribute' => $attribute
]));
}
if (!($dimensions = \getimagesize($fileFullPath)) or !isset($dimensions[0]) or !isset($dimensions[1])) {
if (!($dimensions = \getimagesize($fileFullPath))) {
$fail(trans(':attribute impossible de valider les dimensions', [
'attribute' => $attribute
]));

View file

@ -16,7 +16,7 @@ class SendContactMail extends Mailable
use SerializesModels;
/**
* @var \App\Mail\Contact
* @var \stdClass
*/
private \stdClass $data;
@ -39,9 +39,11 @@ class SendContactMail extends Mailable
*/
public function envelope(): \Illuminate\Mail\Mailables\Envelope
{
$subject = ObjectEnum::make($this->data->object) ?
ObjectEnum::make($this->data->object)->label() :
__('Nouveau message');
return new Envelope(
subject: sprintf('%s - %s', ObjectEnum::make($this->data->object)->label() ??
__('Nouveau message'), config('app.name')),
subject: sprintf('%s - %s', $subject, config('app.name')),
);
}

View file

@ -15,7 +15,7 @@ class SendJoinusMail extends Mailable
use SerializesModels;
/**
* @var \App\Mail\Joinus
* @var \stdClass
*/
private \stdClass $data;
@ -24,7 +24,6 @@ class SendJoinusMail extends Mailable
*
* @param \stdClass $data
* @return void
* @phpcs:disable Generic.Metrics.CyclomaticComplexity.TooHigh
*/
public function __construct(\stdClass $data)
{

View file

@ -3,18 +3,17 @@
namespace App\Models;
use App\Enums\ActivityLogs\ActivityLogsEventEnum;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Schema;
/**
* @property string $model Target model.
* @property string $model_id Id of the target model.
* @property string $event Event of this activity (ActivityLogsEventEnum).
* @property string $data Changes.
* @property-read \Illuminate\Support\Carbon $created_at Created date.
* @property string $model Target model.
* @property string $model_id Id of the target model.
* @property \App\Enums\ActivityLogs\ActivityLogsEventEnum $event Event of this activity (ActivityLogsEventEnum).
* @property array $data Changes.
* @property-read \Illuminate\Support\Carbon $created_at Created date.
*
* @property-read \App\Models\User $user User BelongsTo relation.
*/
@ -82,19 +81,20 @@ class ActivityLog extends Model
$activity->model_id = $model->getKey();
$activity->event = $eventEnum;
$activity->data = static::getChangedColumns($activity, $model, $eventEnum);
$activity->created_at = Carbon::now();
// @phpstan-ignore-next-line
$activity->created_at = now();
$activity->saveOrFail();
}
/**
* Get old, new columns that has changed.
*
* @param \self $activity
* @param self $activity
* @param \Illuminate\Database\Eloquent\Model $model
* @param \App\Enums\ActivityLogs\ActivityLogsEventEnum $eventEnum
* @return array|null
* @return array
*/
public static function getChangedColumns(self $activity, Model $model, ActivityLogsEventEnum $eventEnum): array|null
public static function getChangedColumns(self $activity, Model $model, ActivityLogsEventEnum $eventEnum): array
{
$modelClassName = $activity->model_class;
/** Get type of each fields of the target model */
@ -103,16 +103,17 @@ class ActivityLog extends Model
$activity->model_id
)->first();
if ($targetModel != null) {
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
$targetModelTypes = collect($targetModel->toArray())
// phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed
->map(function ($field, $fieldIndex) use ($targetModel) {
return Schema::getColumnType($targetModel->getTable(), $fieldIndex);
})->toArray();
// phpcs:enable
/** Return old, new and type of values changed */
return ($eventEnum === ActivityLogsEventEnum::updated) ?
array_intersect_key($targetModelTypes, $model->getChanges()) : [];
}
/** Return old, new and type of values changed */
return ($eventEnum === ActivityLogsEventEnum::updated) ?
array_intersect_key($targetModelTypes, $model->getChanges()) : null;
return [];
}
// * RELATIONS

View file

@ -47,7 +47,7 @@ class Homepage extends Model
/**
* The attributes that should be cast.
*
* @var string[]
* @var array<string, string>
*/
protected $casts = [
'display_video' => 'bool'

View file

@ -207,7 +207,7 @@ class News extends Model implements SeoInterface
/**
* Transform to seoModel
*
* @return \App\Objects\SeoItem
* @return \Uwil\Seo\Laravel\Objects\SeoItem
*/
public function toSeoItem(): SeoItem
{

View file

@ -198,7 +198,7 @@ class Product extends Model implements SeoInterface
/**
* Transform to seoModel
*
* @return \App\Objects\SeoItem
* @return \Uwil\Seo\Laravel\Objects\SeoItem
*/
public function toSeoItem(): SeoItem
{

View file

@ -179,7 +179,7 @@ class Range extends Model implements SeoInterface
/**
* Transform to seoModel
*
* @return \App\Objects\SeoItem
* @return \Uwil\Seo\Laravel\Objects\SeoItem
*/
public function toSeoItem(): SeoItem
{

View file

@ -61,7 +61,7 @@ class StaticPage extends Model implements SeoInterface
});
static::updating(function (self $model) {
// * ASSERTIONS
static::assertTitleIsUnique($model->title, $model->id);
self::assertTitleIsUnique($model->title, $model->id);
// * CHANGES
$model->slug = Str::slug($model->title);
@ -92,7 +92,7 @@ class StaticPage extends Model implements SeoInterface
/**
* Transform to seoModel
*
* @return \App\Objects\SeoItem
* @return \Uwil\Seo\Laravel\Objects\SeoItem
*/
public function toSeoItem(): SeoItem
{

View file

@ -4,6 +4,7 @@ namespace App\Models;
use App\Enums\Users\RoleEnum;
use App\Traits\Models\ActivityLog;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
@ -72,7 +73,7 @@ class User extends Authenticatable
protected static function booted(): void
{
static::creating(function (self $model) {
static::updatePassword($model);
self::updatePassword($model);
// * Prevent user elevation privileges
throw_if(
auth('backend')->user() and auth('backend')->user()->role->value() > $model->role->value(),
@ -80,7 +81,7 @@ class User extends Authenticatable
);
});
static::updating(function (self $model) {
static::updatePassword($model);
self::updatePassword($model);
if (optional(auth('backend')->user())->getKey() === $model->getKey()) {
\validator(
['published' => $model->published],

View file

@ -32,7 +32,7 @@ class TranslationServiceProvider extends ServiceProvider
/**
* Gather provided langs checking from files
*
* @return \Illuminate\Support\Collection<string, string>
* @return \Illuminate\Support\Collection<int, string>
*/
private function collectLocalesStrings(): Collection
{

View file

@ -37,18 +37,16 @@ trait ChangesModelOrder
return DB::transaction(function () use ($request, $className, $model) {
/** @var \Illuminate\Database\Eloquent\Model|null */
$tmp = $className::where('order', $request->direction ? '<' : '>', $model->order)
$tmp = $className::where('order', $request->direction ? '<' : '>', $model->getOriginal('order'))
->orderBy('order', $request->direction ? 'DESC' : 'ASC')->first();
if (!$tmp) {
return back()->with('error', trans('crud.messages.order_not_changed'));
}
$newOrder = $tmp->order;
$tmp->order = $model->order;
$model->order = $newOrder;
$tmp->saveOrFail();
$model->saveOrFail();
$newOrder = $tmp->getOriginal('order');
$tmp->update(['order' => $model->getOriginal('order')]);
$model->update(['order' => $newOrder]);
Session::flash('success', trans('crud.messages.order_changed'));
return back();

View file

@ -19,8 +19,7 @@ trait UpdateModelPublished
*/
public function changePublished(Model $model)
{
$model->published = !$model->published;
$model->saveOrFail();
$model->update(['published' => !$model->getOriginal('published')]);
return redirect()->back()->with('success', trans(__('crud.messages.publish_status_saved')));
}
}

View file

@ -118,9 +118,9 @@ trait BaseEnum
/**
* Fetch enum using value.
*
* @param \App\Traits\Enums\BaseEnum|integer|string $value
* @param string $field
* @return \App\Traits\Enums\BaseEnum|null
* @param self|integer|string $value
* @param string $field
* @return self|null
*/
public static function make(self|int|string $value, string $field = 'value'): self|null
{

View file

@ -10,7 +10,8 @@ use Illuminate\Support\Facades\Cache;
/**
* ! Use this only on limited elements, (not on tags, or products, or posts for ex.)
*
* @property private static array $cacheConditions Eloquent condition to cache elements (to be used in where statement).
* @property array<string,string|integer|float|boolean> $cacheConditions
* Eloquent condition to cache elements (to be used in where statement).
*/
trait IsCachedAsCollection
{

View file

@ -78,7 +78,7 @@ trait HasPicture
(!empty($requiredIf)) ? "required_if:{$requiredIf}" : '',
($size) ? "max:{$size}" : '',
function (string $attribute, $value, callable $fail) use ($dimensions) {
return ToolboxHelper::validatePicture($attribute, $value, $fail, $dimensions);
ToolboxHelper::validatePicture($attribute, $value, $fail, $dimensions);
}
]
];
@ -113,7 +113,7 @@ trait HasPicture
"{$name}Validate.*" => [
'required',
function (string $attribute, $value, callable $fail) use ($sizes) {
return $this->validatePicture($attribute, $value, $fail, $sizes);
ToolboxHelper::validatePicture($attribute, $value, $fail, $sizes);
}
]
];

View file

@ -20,6 +20,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"larastan/larastan": "^2.8",
"laravel-lang/common": "^4.0",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",

1868
composer.lock generated

File diff suppressed because it is too large Load diff

View file

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

10
phpstan.neon Normal file
View file

@ -0,0 +1,10 @@
includes:
- vendor/larastan/larastan/extension.neon
parameters:
paths:
- app/
# Level 9 is the highest level
level: 5

View file

@ -224,69 +224,70 @@ return [
'female' => 'of the ',
'vowel' => 'of the '
],
'accept_rules' => 'acceptation of rules',
'activated' => 'activated',
'attribute_alt' => 'alt attribute',
'attribute_title' => 'title attribute',
'background' => 'background',
'category' => 'category',
'category' => 'category',
'civility' => 'civility',
'cooking_advice' => 'cooking advice',
'description' => 'description',
'direction' => 'direction',
'event' => 'event',
'file' => 'file',
'ingredients' => 'ingredients',
'job' => 'job',
'key_earth_1' => 'key number for "respect the earth" 1',
'key_earth_2' => 'key number for "respect the earth" 2',
'key_feed' => 'key number for "feed well"',
'key_territory' => 'key number for "integrate its territory"',
'key_together_1' => 'key number for "live together" 1',
'key_together_2' => 'key number for "live together" 2',
'key_together_3' => 'key number for "live together" 3',
'key_together_4' => 'key number for "live together" 4',
'model' => 'target element',
'nutritionnal_values' => 'nutritionnal values',
'object' => 'object',
'order' => 'order',
'picture_1' => 'picture one',
'picture_2' => 'picture two',
'picture_3' => 'picture three',
'picture_alt' => 'attribut alt of the :field',
'picture_ambiance' => 'ambiance picture',
'picture_packshot' => 'packshot picture',
'picture_productsheet' => 'productsheet picture',
'picture_thumbnail' => 'thumbnail',
'picture_title' => 'attribut title of the :field',
'picture' => 'picture',
'presentation_content' => 'presentation content',
'presentation_title' => 'presentation title',
'product_barcode' => 'product barcode',
'product_date_consumption' => 'product date consumption',
'product_date_limit' => 'product date limit',
'product_location' => 'product location',
'product_lot' => 'product lot',
'product_name' => 'product name',
'publication' => 'publication',
'publish_at' => 'publication date',
'publish_at' => 'publication date',
'send_data' => 'autorization to send data',
'seo_description' => 'SEO description',
'seo_title' => 'SEO title',
'seo' => 'SEO',
'society' => 'society',
'static_page_type' => 'static page type',
'statut' => 'statut',
'subtitle' => 'subtitle',
'tagline' => 'tagline',
'target' => 'target',
'title_part1' => 'title part one',
'title_part2' => 'title part two',
'title_part3' => 'title part three',
'unpublish_at' => 'end of publication date',
'unpublish_at' => 'end of publication date',
'video_id' => 'ID of the video',
'accept_rules' => 'acceptation of rules',
'activated' => 'activated',
'attribute_alt' => 'alt attribute',
'attribute_title' => 'title attribute',
'background' => 'background',
'category' => 'category',
'category' => 'category',
'civility' => 'civility',
'cooking_advice' => 'cooking advice',
'description' => 'description',
'direction' => 'direction',
'event' => 'event',
'file' => 'file',
'ingredients' => 'ingredients',
'job' => 'job',
'key_earth_1' => 'key number for "respect the earth" 1',
'key_earth_2' => 'key number for "respect the earth" 2',
'key_feed' => 'key number for "feed well"',
'key_territory' => 'key number for "integrate its territory"',
'key_together_1' => 'key number for "live together" 1',
'key_together_2' => 'key number for "live together" 2',
'key_together_3' => 'key number for "live together" 3',
'key_together_4' => 'key number for "live together" 4',
'model' => 'target element',
'nutritionnal_values' => 'nutritionnal values',
'object' => 'object',
'order' => 'order',
'picture_1' => 'picture one',
'picture_2' => 'picture two',
'picture_3' => 'picture three',
'picture_alt' => 'attribut alt of the :field',
'picture_ambiance' => 'ambiance picture',
'picture_packshot' => 'packshot picture',
'picture_productsheet' => 'productsheet picture',
'picture_thumbnail' => 'thumbnail',
'picture_title' => 'attribut title of the :field',
'picture' => 'picture',
'presentation_content' => 'presentation content',
'presentation_title' => 'presentation title',
'product_barcode' => 'product barcode',
'product_barcode_detail' => '(13 digits)',
'product_date_consumption' => 'product date consumption',
'product_date_limit' => 'product date limit',
'product_location' => 'product location',
'product_lot' => 'product lot',
'product_name' => 'product name',
'publication' => 'publication',
'publish_at' => 'publication date',
'publish_at' => 'publication date',
'send_data' => 'autorization to send data',
'seo_description' => 'SEO description',
'seo_title' => 'SEO title',
'seo' => 'SEO',
'society' => 'society',
'static_page_type' => 'static page type',
'statut' => 'statut',
'subtitle' => 'subtitle',
'tagline' => 'tagline',
'target' => 'target',
'title_part1' => 'title part one',
'title_part2' => 'title part two',
'title_part3' => 'title part three',
'unpublish_at' => 'end of publication date',
'unpublish_at' => 'end of publication date',
'video_id' => 'ID of the video',
],
];

View file

@ -226,72 +226,73 @@ return [
'female' => 'de la ',
'vowel' => 'de l\''
],
'accept_rules' => 'acceptation des règles',
'activated' => 'activé',
'attribute_alt' => 'attribut alt',
'attribute_title' => 'attribut title',
'background' => 'fond',
'category' => 'catégorie',
'category' => 'catégorie',
'civility' => 'civilité',
'cooking_advice' => 'conseil de réchauffage',
'description' => 'description',
'direction' => 'direction',
'event' => 'évènement',
'file' => 'fichier',
'ingredients' => 'ingrédients',
'job' => 'métier',
'key_earth_1' => 'Chiffre clé "respecter la terre" 1',
'key_earth_2' => 'Chiffre clé "respecter la terre" 2',
'key_feed' => 'chiffre clé "bien nourrir"',
'key_territory' => 'Chiffre clé "intégrer son territoire"',
'key_together_1' => 'Chiffre clé "vivre ensemble" 1',
'key_together_2' => 'Chiffre clé "vivre ensemble" 2',
'key_together_3' => 'Chiffre clé "vivre ensemble" 3',
'key_together_4' => 'Chiffre clé "vivre ensemble" 4',
'model' => 'élément ciblé',
'nutritionnal_values' => 'valeurs nutritionnelles',
'object' => 'objet',
'order' => 'ordre',
'picture_1' => 'image une',
'picture_2' => 'image deux',
'picture_3' => 'image trois',
'picture_alt' => 'attribut alt de l\':field',
'picture_ambiance' => 'image d\'ambiance',
'picture_packshot' => 'image du packshot',
'picture_productsheet' => 'image de la fiche produit',
'picture_thumbnail' => 'vignette',
'picture_title' => 'attribut title de l\':field',
'picture' => 'image',
'presentation_content' => 'contenu de présentation',
'presentation_title' => 'titre de présentation',
'product_barcode' => 'le code barre du produit',
'product_date_consumption' => 'date de consommation',
'product_date_limit' => 'date de limite de consommation',
'product_location' => 'le lieu de l\'achat',
'product_lot' => 'numéro du lot figurant à côté de la date',
'product_name' => 'nom du produit',
'publication' => 'publication',
'publish_at' => 'date de publication',
'published' => 'état de publication',
'send_data' => 'autorisation d\'enregistrer des données',
'seo_description' => 'description SEO',
'seo_title' => 'titre SEO',
'seo' => 'référencement SEO',
'society' => 'société',
'static_page_type' => 'type de page',
'statut' => 'statut',
'subtitle' => 'sous-titre',
'tagline' => 'phrase d\'accroche',
'target' => 'cible',
'title_part1' => 'première partie du titre',
'title_part2' => 'seconde partie du titre',
'title_part3' => 'dernière partie du titre',
'type' => 'type',
'unpublish_at' => 'date de fin de publication',
'unpublish_at' => 'date de fin de publication',
'video_id' => 'ID de la vidéo',
'youtube_video_id' => 'ID de la vidéo youtube',
'display_video' => 'affichage de la vidéo',
'accept_rules' => 'acceptation des règles',
'activated' => 'activé',
'attribute_alt' => 'attribut alt',
'attribute_title' => 'attribut title',
'background' => 'fond',
'category' => 'catégorie',
'category' => 'catégorie',
'civility' => 'civilité',
'cooking_advice' => 'conseil de réchauffage',
'description' => 'description',
'direction' => 'direction',
'event' => 'évènement',
'file' => 'fichier',
'ingredients' => 'ingrédients',
'job' => 'métier',
'key_earth_1' => 'Chiffre clé "respecter la terre" 1',
'key_earth_2' => 'Chiffre clé "respecter la terre" 2',
'key_feed' => 'chiffre clé "bien nourrir"',
'key_territory' => 'Chiffre clé "intégrer son territoire"',
'key_together_1' => 'Chiffre clé "vivre ensemble" 1',
'key_together_2' => 'Chiffre clé "vivre ensemble" 2',
'key_together_3' => 'Chiffre clé "vivre ensemble" 3',
'key_together_4' => 'Chiffre clé "vivre ensemble" 4',
'model' => 'élément ciblé',
'nutritionnal_values' => 'valeurs nutritionnelles',
'object' => 'objet',
'order' => 'ordre',
'picture_1' => 'image une',
'picture_2' => 'image deux',
'picture_3' => 'image trois',
'picture_alt' => 'attribut alt de l\':field',
'picture_ambiance' => 'image d\'ambiance',
'picture_packshot' => 'image du packshot',
'picture_productsheet' => 'image de la fiche produit',
'picture_thumbnail' => 'vignette',
'picture_title' => 'attribut title de l\':field',
'picture' => 'image',
'presentation_content' => 'contenu de présentation',
'presentation_title' => 'titre de présentation',
'product_barcode' => 'code barre du produit',
'product_barcode_detail' => '(13 chiffres)',
'product_date_consumption' => 'date de consommation',
'product_date_limit' => 'date de limite de consommation',
'product_location' => 'le lieu de l\'achat',
'product_lot' => 'numéro du lot figurant à côté de la date',
'product_name' => 'nom du produit',
'publication' => 'publication',
'publish_at' => 'date de publication',
'publish_at' => 'date de publication',
'send_data' => 'autorisation d\'enregistrer des données',
'seo_description' => 'description SEO',
'seo_title' => 'titre SEO',
'seo' => 'référencement SEO',
'society' => 'société',
'static_page_type' => 'type de page',
'statut' => 'statut',
'subtitle' => 'sous-titre',
'tagline' => 'phrase d\'accroche',
'target' => 'cible',
'title_part1' => 'première partie du titre',
'title_part2' => 'seconde partie du titre',
'title_part3' => 'dernière partie du titre',
'type' => 'type',
'unpublish_at' => 'date de fin de publication',
'unpublish_at' => 'date de fin de publication',
'video_id' => 'ID de la vidéo',
'youtube_video_id' => 'ID de la vidéo youtube',
'display_video' => 'affichage de la vidéo',
],
];

View file

@ -4,8 +4,8 @@
@import './utilities/variables';
// * VENDOR
@import './vendor/ckEditorContent';
@import './vendor/bootstrap';
@import './vendor/ckEditorContent';
@import "./vendor/cookie-notice";
@import "./vendor/swiper";

View file

@ -13,6 +13,20 @@
@import "bootstrap/scss/mixins";
@import "bootstrap/scss/root";
@import "bootstrap/scss/reboot";
// * CK CONTENT overload pour créa
h2 {
width: fit-content;
padding: 0.2rem 1.5rem;
margin-top: 0.5rem;
color: $body-bg;
font-family: 'Readex Pro', sans-serif !important;
hyphens: auto;
overflow-wrap: break-word;
@include input-shape($body-color);
}
}
/*

View file

@ -28,10 +28,10 @@
### Information sur le produit:
@component('mail::panel')
- **{{ __('validation.custom.product_name') }}:** {{ $data->product_name ?? '' }}
- **{{ __('validation.custom.product_date_limit') }}:** {{ $data->product_date_limit ?? '' }}
- **{{ __('validation.custom.product_date_limit') }}:** {{ \Carbon\Carbon::make($data->product_date_limit)->format('d/m/Y') ?? '' }}
- **{{ __('validation.custom.product_barcode') }}:** {{ $data->product_barcode ?? '' }}
- **{{ __('validation.custom.product_lot') }}:** {{ $data->product_lot ?? '' }}
- **{{ __('validation.custom.product_date_consumption') }}:** {{ $data->product_date_consumption ?? '' }}
- **{{ __('validation.custom.product_date_consumption') }}:** {{ \Carbon\Carbon::make($data->product_date_consumption)->format('d/m/Y') ?? '' }}
- **{{ __('validation.custom.product_location') }}:** {{ $data->product_location ?? '' }}
@endcomponent
@endif

View file

@ -79,20 +79,20 @@
</div>
<div class="col-12 col-md-6 p-0">
<fieldset class="d-flex flex-column justify-content-center align-items-start pe-md-5">
<label class="mt-1">{{ Str::of(__('validation.attributes.address'))->ucFirst() }}&nbsp;:</label>
<input class="form-control" name="address" value="{{ old('address') }}">
<label class="mt-1">{{ Str::of(__('validation.attributes.address'))->ucFirst() }}*&nbsp;:</label>
<input class="form-control" name="address" value="{{ old('address') }}" required>
</fieldset>
</div>
<div class="col-12 col-md-6 p-0">
<fieldset class="d-flex flex-column justify-content-center align-items-start ps-md-5">
<label class="mt-1">{{ Str::of(__('validation.attributes.postal_code'))->ucFirst() }}&nbsp;:</label>
<input class="form-control" name="postal_code" type="number" value="{{ old('postal_code') }}">
<label class="mt-1">{{ Str::of(__('validation.attributes.postal_code'))->ucFirst() }}*&nbsp;:</label>
<input class="form-control" name="postal_code" type="number" value="{{ old('postal_code') }}" required>
</fieldset>
</div>
<div class="col-12 col-md-6 p-0">
<fieldset class="d-flex flex-column justify-content-center align-items-start pe-md-5">
<label class="mt-1">{{ Str::of(__('validation.attributes.city'))->ucFirst()->value() }}&nbsp;:</label>
<input class="form-control" name="city" value="{{ old('city') }}">
<label class="mt-1">{{ Str::of(__('validation.attributes.city'))->ucFirst()->value() }}*&nbsp;:</label>
<input class="form-control" name="city" value="{{ old('city') }}" required>
</fieldset>
</div>
<div class="col-12 col-md-6 p-0">
@ -126,15 +126,17 @@
<fieldset class="d-flex flex-column justify-content-center align-items-start ps-md-5">
<label class="mt-1" for="product_date_limit">
{{ Str::of(__('validation.custom.product_date_limit'))->ucFirst()->value() }}*&nbsp;:
<span class="text-body-secondary">{{ __('Ex : 25/08/2028') }}</span>
</label>
<input class="form-control" id="product_date_limit" name="product_date_limit"
<input class="form-control" id="product_date_limit" name="product_date_limit" type="date"
value="{{ old('product_date_limit') }}">
</fieldset>
</div>
<div class="col-12 col-md-6 p-0">
<fieldset class="d-flex flex-column justify-content-center align-items-start pe-md-5">
<label class="mt-1" for="product_barcode">
{{ Str::of(__('validation.custom.product_barcode'))->ucFirst()->value() }}*&nbsp;:
{{ Str::of(__('validation.custom.product_barcode'))->ucFirst()->value() }}*
{{ __('validation.custom.product_barcode_detail') }}&nbsp;:
</label>
<input class="form-control" id="product_barcode" name="product_barcode" type="number"
value="{{ old('product_barcode') }}">
@ -156,7 +158,7 @@
<span class="text-body-secondary">{{ __('Ex : 25/08/2028') }}</span>
</label>
<input class="form-control" id="product_date_consumption" name="product_date_consumption"
value="{{ old('product_date_consumption') }}">
type="date" value="{{ old('product_date_consumption') }}">
</fieldset>
</div>
<div class="col-12 col-md-6 p-0">
@ -189,7 +191,7 @@
</fieldset>
</div>
<p class="highlight white w-100 w-xl-fit m-0 mx-auto my-5 px-5 text-center">
{{ __('Laissez nous votre message, le service consommateurs vous répondra par mail dans les plus brefs délais.') }}
{{ __('Laissez nous votre message, le service consommateurs vous répondra dans les plus brefs délais.') }}
</p>
</div>
<div class="col-12 mb-3 p-0">

View file

@ -49,7 +49,9 @@
<span class="f-readex-pro fs-6 fw-semibold">{{ __('au fil de l\'année') }}</span>
<span class="f-sheldon fs-1 mb-3 mt-1">{{ $seasonalSectionsModel->title }}</span>
</h2>
{!! clean($seasonalSectionsModel->text) !!}
<div class="ck-content">
{!! clean($seasonalSectionsModel->text) !!}
</div>
</div>
</div>
<div class="seasonal-sections-image bg-agis-white col-12 col-xl-6 position-relative mx-xl-0 mx-auto w-auto p-4">
@ -74,7 +76,9 @@
</div>
<div class="col-12 col-md-6">
<div class="description-paragraph d-flex flex-column justify-content-center align-items-start h-100">
{!! clean($homepageModel->presentation_content) !!}
<div class="ck-content">
{!! clean($homepageModel->presentation_content) !!}
</div>
<a class="btn btn-primary fw-bold mt-1" href="{{ route('fo.explorer') }}">{{ __('> En savoir +') }}</a>
</div>
</div>

View file

@ -34,7 +34,9 @@
<div class="news-single-content mx-auto mt-3">
<p class="fs-7 fw-semibold text-center">{{ $newsModel->subtitle }}</p>
<br>
{!! clean($newsModel->content) !!}
<div class="ck-content">
{!! clean($newsModel->content) !!}
</div>
</div>
</div>
<div class="row pb-5">

View file

@ -57,7 +57,11 @@
</div>
{{-- DESCRIPTION --}}
<div class="text-lg-center col-12 col-lg-9 mx-lg-auto px-3 text-justify">{!! clean($productModel->description) !!}</div>
<div class="text-lg-center col-12 col-lg-9 mx-lg-auto px-3 text-justify">
<div class="ck-content">
{!! clean($productModel->description) !!}
</div>
</div>
{{-- PICTOS --}}
@if (!empty($productModel->commitments))
@ -89,7 +93,11 @@
<div class="col-12 mt-4">
<img class="picto-img float-start me-3 mt-3" src="{{ Vite::asset($productModel->cooking_mode->picture()) }}"
title="{{ $productModel->cooking_mode->label() }}" alt="{{ $productModel->cooking_mode->alt() }}">
<div class="cooking-advice text-justify">{!! clean($productModel->cooking_advice) !!}</div>
<div class="cooking-advice text-justify">
<div class="ck-content">
{!! clean($productModel->cooking_advice) !!}
</div>
</div>
</div>
</section>
</div>

View file

@ -23,7 +23,9 @@
<p class="highlight black f-readex-pro m-0 mb-2 px-3 text-white">
{{ Str::of($rangeModel->tagline)->ucFirst() }}
</p>
{!! clean($rangeModel->description) !!}
<div class="ck-content">
{!! clean($rangeModel->description) !!}
</div>
</div>
<div class="col-12 col-xl-6 m-xl-0 my-4">
<div class="d-flex justify-content-center">