lot of fix (translations, docblocks, saveQuietly seeder)

This commit is contained in:
Alexis Gousseau 2023-11-06 12:57:17 +01:00
parent 3c63d85bd9
commit 705aa7c522
53 changed files with 634 additions and 615 deletions

View file

@ -81,9 +81,8 @@ class CommitmentController extends Controller
{
return DB::transaction(function () use ($request) {
$commitment = new Commitment();
$commitment->fill($request->validated());
if ($commitment->saveOrFail()) {
if ($commitment->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.commitments.edit', $commitment)
->with('success', __('crud.messages.has_been_created', [
'model' => Str::ucfirst(__('models.classes.commitment'))
@ -117,9 +116,7 @@ class CommitmentController extends Controller
public function update(UpdateCommitmentRequest $request, Commitment $commitment): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $commitment) {
$commitment->fill($request->validated());
if ($commitment->saveOrFail()) {
if ($commitment->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.commitments.edit', $commitment)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.commitment'))

View file

@ -39,9 +39,7 @@ class ConvictionpageController extends Controller
/** @var \App\Models\Convictionpage $convictionpageModel */
$convictionpageModel = Convictionpage::query()->firstOrFail();
$convictionpageModel->fill($request->validated());
if ($convictionpageModel->saveOrFail()) {
if (($convictionpageModel->fill($request->validated()))->saveOrFail()) {
return redirect()->route('bo.convictionpages.edit')
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.convictionpage'))

View file

@ -39,9 +39,7 @@ class HomepageController extends Controller
/** @var \App\Models\Homepage $homepageModel */
$homepageModel = Homepage::query()->firstOrFail();
$homepageModel->fill($request->validated());
if ($homepageModel->saveOrFail()) {
if ($homepageModel->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.homepages.edit')
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.homepage'))

View file

@ -39,9 +39,7 @@ class JoinuspageController extends Controller
/** @var \App\Models\Joinuspage $joinuspageModel */
$joinuspageModel = Joinuspage::query()->firstOrFail();
$joinuspageModel->fill($request->validated());
if ($joinuspageModel->saveOrFail()) {
if ($joinuspageModel->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.joinuspages.edit')
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.joinuspage'))

View file

@ -87,9 +87,8 @@ class NewsController extends Controller
{
return DB::transaction(function () use ($request) {
$news = new News();
$news->fill($request->validated());
if ($news->saveOrFail()) {
if ($news->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.news.edit', $news)
->with('success', __('crud.messages.has_been_created', [
'model' => Str::ucfirst(__('models.classes.news'))
@ -123,9 +122,7 @@ class NewsController extends Controller
public function update(UpdateNewsRequest $request, News $news): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $news) {
$news->fill($request->validated());
if ($news->saveOrFail()) {
if ($news->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.news.edit', $news)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.news'))

View file

@ -87,9 +87,8 @@ class RangeController extends Controller
{
return DB::transaction(function () use ($request) {
$range = new Range();
$range->fill($request->validated());
if ($range->saveOrFail()) {
if ($range->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.ranges.edit', $range)
->with('success', __('crud.messages.has_been_created', [
'model' => Str::ucfirst(__('models.classes.range'))
@ -123,9 +122,7 @@ class RangeController extends Controller
public function update(UpdateRangeRequest $request, Range $range): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $range) {
$range->fill($request->validated());
if ($range->saveOrFail()) {
if ($range->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.ranges.edit', $range)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.range'))

View file

@ -81,17 +81,16 @@ class SeasonalSectionController extends Controller
{
return DB::transaction(function () use ($request) {
$seasonalSection = new SeasonalSection();
$seasonalSection->fill($request->validated());
if ($seasonalSection->saveOrFail()) {
if ($seasonalSection->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.seasonalsections.edit', $seasonalSection)
->with('success', __('crud.messages.has_been_created', [
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
]));
}
return redirect()->back()
->with('error', __('crud.messages.cannot_be_created', [
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
]));
});
}
@ -119,17 +118,15 @@ class SeasonalSectionController extends Controller
SeasonalSection $seasonalSection
): \Illuminate\Http\RedirectResponse {
return DB::transaction(function () use ($request, $seasonalSection) {
$seasonalSection->fill($request->validated());
if ($seasonalSection->saveOrFail()) {
if ($seasonalSection->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.seasonalsections.edit', $seasonalSection)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
]));
}
return redirect()->route('bo.seasonalsections.edit', $seasonalSection)
->with('error', __('crud.messages.cannot_be_updated', [
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
]));
});
}
@ -145,12 +142,12 @@ class SeasonalSectionController extends Controller
if ($seasonalSection->deleteOrFail()) {
return redirect()->route('bo.seasonalsections.index')
->with('success', __('crud.messages.has_been_deleted', [
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
]));
}
return redirect()->back()
->with('error', __('crud.messages.cannot_be_deleted', [
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
'model' => Str::ucfirst(trans_choice('models.classes.seasonal_section', 1))
]));
}

View file

@ -81,9 +81,8 @@ class StampController extends Controller
{
return DB::transaction(function () use ($request) {
$stamp = new Stamp();
$stamp->fill($request->validated());
if ($stamp->saveOrFail()) {
if ($stamp->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.stamps.edit', $stamp)
->with('success', __('crud.messages.has_been_created', [
'model' => Str::ucfirst(__('models.classes.stamp'))
@ -117,9 +116,7 @@ class StampController extends Controller
public function update(UpdateStampRequest $request, Stamp $stamp): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $stamp) {
$stamp->fill($request->validated());
if ($stamp->saveOrFail()) {
if ($stamp->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.stamps.edit', $stamp)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.stamp'))

View file

@ -41,7 +41,7 @@ class StaticPageController extends Controller
);
}
$searchFields = \implode(', ', [
trans('validation.attributes.title'),
Str::ucfirst(trans('validation.attributes.title'))
]);
/** Sort columns with a query */
@ -74,9 +74,7 @@ class StaticPageController extends Controller
public function update(UpdateStaticPageRequest $request, StaticPage $static_page): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $static_page) {
$static_page->fill($request->validated());
if ($static_page->saveOrFail()) {
if ($static_page->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.static_pages.edit', $static_page)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(\trans_choice('models.classes.static_page', 1))

View file

@ -83,9 +83,8 @@ class TestimonialController extends Controller
{
return DB::transaction(function () use ($request) {
$testimonial = new Testimonial();
$testimonial->fill($request->validated());
if ($testimonial->saveOrFail()) {
if ($testimonial->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.testimonials.edit', $testimonial)
->with('success', __('crud.messages.has_been_created', [
'model' => Str::ucfirst(__('models.classes.testimonial'))
@ -121,9 +120,7 @@ class TestimonialController extends Controller
Testimonial $testimonial
): \Illuminate\Http\RedirectResponse {
return DB::transaction(function () use ($request, $testimonial) {
$testimonial->fill($request->validated());
if ($testimonial->saveOrFail()) {
if ($testimonial->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.testimonials.edit', $testimonial)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.testimonial'))

View file

@ -85,9 +85,8 @@ class UsersController extends Controller
{
return DB::transaction(function () use ($request) {
$user = new User();
$user->fill($request->validated());
if ($user->saveOrFail()) {
if ($user->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.users.edit', $user)
->with('success', __('crud.messages.has_been_created', [
'model' => Str::ucfirst(__('models.classes.user'))
@ -121,9 +120,7 @@ class UsersController extends Controller
public function update(UpdateUserRequest $request, User $user): \Illuminate\Http\RedirectResponse
{
return DB::transaction(function () use ($request, $user) {
$user->fill($request->validated());
if ($user->saveOrFail()) {
if ($user->fill($request->validated())->saveOrFail()) {
return redirect()->route('bo.users.edit', $user)
->with('success', __('crud.messages.has_been_updated', [
'model' => Str::ucfirst(__('models.classes.user'))

View file

@ -40,14 +40,29 @@ class StoreCommitmentRequest extends FormRequest
public function rules()
{
$rules = [
'title' => 'required|string|min:3|max:255',
'picture_alt' => 'required|string|min:3|max:255',
'title' => 'required|string|min:3|max:255',
'picture_alt' => 'required|string|min:3|max:255',
'picture_title' => 'required|string|min:3|max:255',
'published' => 'required|boolean',
'published' => 'required|boolean',
];
return \array_merge(
$rules,
$this->pictureRules('picture', 185, 185, 185, 185, false),
);
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'title' => trans('validation.attributes.title'),
'picture_alt' => trans('validation.custom.picture_alt', ['field' => __('validation.custom.picture')]),
'picture_title' => trans('validation.custom.picture_title', ['field' => __('validation.custom.picture')]),
'published' => trans('validation.attributes.published'),
];
}
}

View file

@ -4,15 +4,4 @@ namespace App\Http\Requests\Bo\Commitments;
class UpdateCommitmentRequest extends StoreCommitmentRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return \array_merge(
parent::rules()
);
}
}

View file

@ -1,40 +0,0 @@
<?php
namespace App\Http\Requests\Bo\Convictionpages;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class StoreConvictionpageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'key_feed' => 'required|numeric',
'key_earth_1' => 'required|numeric',
'key_earth_2' => 'required|numeric',
'key_together_1' => 'required|numeric',
'key_together_2' => 'required|numeric',
'key_together_3' => 'required|numeric',
'key_together_4' => 'required|numeric',
'key_territory' => 'required|numeric',
];
}
}

View file

@ -2,8 +2,23 @@
namespace App\Http\Requests\Bo\Convictionpages;
class UpdateConvictionpageRequest extends StoreConvictionpageRequest
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class UpdateConvictionpageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Get the validation rules that apply to the request.
*
@ -11,8 +26,34 @@ class UpdateConvictionpageRequest extends StoreConvictionpageRequest
*/
public function rules()
{
return \array_merge(
parent::rules()
);
return [
'key_feed' => 'required|numeric',
'key_earth_1' => 'required|numeric',
'key_earth_2' => 'required|numeric',
'key_together_1' => 'required|numeric',
'key_together_2' => 'required|numeric',
'key_together_3' => 'required|numeric',
'key_together_4' => 'required|numeric',
'key_territory' => 'required|numeric',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'key_feed' => trans('validation.custom.key_feed'),
'key_earth_1' => trans('validation.custom.key_earth_1'),
'key_earth_2' => trans('validation.custom.key_earth_2'),
'key_together_1' => trans('validation.custom.key_together_1'),
'key_together_2' => trans('validation.custom.key_together_2'),
'key_together_3' => trans('validation.custom.key_together_3'),
'key_together_4' => trans('validation.custom.key_together_4'),
'key_territory' => trans('validation.custom.key_territory'),
];
}
}

View file

@ -1,60 +0,0 @@
<?php
namespace App\Http\Requests\Bo\Explorerpage;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class StoreExplorerpageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->mergePicture('picture_1');
$this->mergePicture('picture_2');
$this->mergePicture('picture_3');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'picture_1_alt' => 'required|string|between:3,255',
'picture_1_title' => 'required|string|between:3,255',
'picture_2_alt' => 'required|string|between:3,255',
'picture_2_title' => 'required|string|between:3,255',
'picture_3_alt' => 'required|string|between:3,255',
'picture_3_title' => 'required|string|between:3,255',
'commitments' => 'required|array',
'commitments.*.id' => 'required|exists:commitments,id',
];
return \array_merge(
$rules,
$this->pictureRules('picture_1', 265, 364, 265, 364, false),
$this->pictureRules('picture_2', 265, 364, 265, 364, false),
$this->pictureRules('picture_3', 265, 364, 265, 364, false),
);
}
}

View file

@ -2,8 +2,35 @@
namespace App\Http\Requests\Bo\Explorerpage;
class UpdateExplorerpageRequest extends StoreExplorerpageRequest
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class UpdateExplorerpageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->mergePicture('picture_1');
$this->mergePicture('picture_2');
$this->mergePicture('picture_3');
}
/**
* Get the validation rules that apply to the request.
*
@ -11,8 +38,54 @@ class UpdateExplorerpageRequest extends StoreExplorerpageRequest
*/
public function rules()
{
$rules = [
'picture_1_alt' => 'required|string|between:3,255',
'picture_1_title' => 'required|string|between:3,255',
'picture_2_alt' => 'required|string|between:3,255',
'picture_2_title' => 'required|string|between:3,255',
'picture_3_alt' => 'required|string|between:3,255',
'picture_3_title' => 'required|string|between:3,255',
'commitments' => 'required|array',
'commitments.*.id' => 'required|exists:commitments,id',
];
return \array_merge(
parent::rules()
$rules,
$this->pictureRules('picture_1', 265, 364, 265, 364, false),
$this->pictureRules('picture_2', 265, 364, 265, 364, false),
$this->pictureRules('picture_3', 265, 364, 265, 364, false),
);
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'picture_1_alt' => trans('validation.custom.picture_alt', [
'field' => __('validation.custom.picture_1')
]),
'picture_1_title' => trans('validation.custom.picture_title', [
'field' => __('validation.custom.picture_1')
]),
'picture_2_alt' => trans('validation.custom.picture_alt', [
'field' => __('validation.custom.picture_2')
]),
'picture_2_title' => trans('validation.custom.picture_title', [
'field' => __('validation.custom.picture_2')
]),
'picture_3_alt' => trans('validation.custom.picture_alt', [
'field' => __('validation.custom.picture_3')
]),
'picture_3_title' => trans('validation.custom.picture_title', [
'field' => __('validation.custom.picture_3')
]),
'commitments' => trans('validation.custom.commitments'),
'commitments.*.id' => trans('validation.custom.commitments'),
];
}
}

View file

@ -1,53 +0,0 @@
<?php
namespace App\Http\Requests\Bo\Homepage;
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class StoreHomepageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->mergePicture('picture');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'title_part1' => 'required|string|between:3,255',
'title_part2' => 'required|string|between:3,255',
'title_part3' => 'required|string|between:3,255',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'presentation_title' => 'required|string|between:3,255',
'presentation_content' => 'required|string',
];
return \array_merge(
$rules,
$this->pictureRules('picture', 640, 390, 640, 390, false),
);
}
}

View file

@ -2,8 +2,33 @@
namespace App\Http\Requests\Bo\Homepage;
class UpdateHomepageRequest extends StoreHomepageRequest
use App\Traits\Requests\HasPicture;
use Illuminate\Foundation\Http\FormRequest;
class UpdateHomepageRequest extends FormRequest
{
use HasPicture;
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Prepare the data for validation.
*
* @return void
*/
protected function prepareForValidation()
{
$this->mergePicture('picture');
}
/**
* Get the validation rules that apply to the request.
*
@ -11,8 +36,36 @@ class UpdateHomepageRequest extends StoreHomepageRequest
*/
public function rules()
{
$rules = [
'title_part1' => 'required|string|between:3,255',
'title_part2' => 'required|string|between:3,255',
'title_part3' => 'required|string|between:3,255',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'presentation_title' => 'required|string|between:3,255',
'presentation_content' => 'required|string',
];
return \array_merge(
parent::rules()
$rules,
$this->pictureRules('picture', 640, 390, 640, 390, false),
);
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'title_part1' => trans('validation.custom.title_part1'),
'title_part2' => trans('validation.custom.title_part2'),
'title_part3' => trans('validation.custom.title_part3'),
'picture_alt' => trans('validation.custom.picture_alt', ['field' => __('validation.custom.picture')]),
'picture_title' => trans('validation.custom.picture_title', ['field' => __('validation.custom.picture')]),
'presentation_title' => trans('validation.custom.presentation_title'),
'presentation_content' => trans('validation.custom.presentation_content'),
];
}
}

View file

@ -1,30 +0,0 @@
<?php
namespace App\Http\Requests\Bo\Joinuspage;
use Illuminate\Foundation\Http\FormRequest;
class StoreJoinuspageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'video_id' => 'required|string|regex:%([^"&?\/\s]{11})%i',
];
}
}

View file

@ -2,8 +2,20 @@
namespace App\Http\Requests\Bo\Joinuspage;
class UpdateJoinuspageRequest extends StoreJoinuspageRequest
use Illuminate\Foundation\Http\FormRequest;
class UpdateJoinuspageRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth('backend')->check();
}
/**
* Get the validation rules that apply to the request.
*
@ -11,8 +23,20 @@ class UpdateJoinuspageRequest extends StoreJoinuspageRequest
*/
public function rules()
{
return \array_merge(
parent::rules()
);
return [
'video_id' => 'required|string|regex:%([^"&?\/\s]{11})%i',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'video_id' => trans('validation.custom.video_id'),
];
}
}

View file

@ -43,19 +43,19 @@ class StoreNewsRequest extends FormRequest
public function rules(): array
{
$rules = [
'seo_title' => 'required|between:45,70',
'seo_description' => 'required|between:50,160',
'title' => 'required|string|between:3,100',
'category' => ['required', new Enum(CategoryEnum::class)],
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'picture_thumbnail_alt' => 'required|string|between:3,255',
'seo_title' => 'required|between:45,70',
'seo_description' => 'required|between:50,160',
'title' => 'required|string|between:3,100',
'category' => ['required', new Enum(CategoryEnum::class)],
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'picture_thumbnail_alt' => 'required|string|between:3,255',
'picture_thumbnail_title' => 'required|string|between:3,255',
'subtitle' => 'required|string|between:3,255',
'content' => 'required|string|min:15',
'published' => 'required|boolean',
'publish_at' => 'nullable|date',
'unpublish_at' => 'nullable|date|after:publish_at',
'subtitle' => 'required|string|between:3,255',
'content' => 'required|string|min:15',
'published' => 'required|boolean',
'publish_at' => 'nullable|date',
'unpublish_at' => 'nullable|date|after:publish_at',
];
return \array_merge(
@ -73,19 +73,19 @@ class StoreNewsRequest extends FormRequest
public function attributes(): array
{
return [
'seo_title' => trans('validation.custom.seo_title'),
'seo_description' => trans('validation.custom.seo_description'),
'title' => trans('validation.attributes.title'),
'category' => trans('validation.custom.category'),
'subtitle' => trans('validation.custom.subtitle'),
'content' => trans('validation.attributes.content'),
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_title' => trans('validation.custom.picture_title'),
'picture_thumbnail_alt' => trans('validation.custom.picture_thumbnail_alt'),
'seo_title' => trans('validation.custom.seo_title'),
'seo_description' => trans('validation.custom.seo_description'),
'title' => trans('validation.attributes.title'),
'category' => trans('validation.custom.category'),
'subtitle' => trans('validation.custom.subtitle'),
'content' => trans('validation.attributes.content'),
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_title' => trans('validation.custom.picture_title'),
'picture_thumbnail_alt' => trans('validation.custom.picture_thumbnail_alt'),
'picture_thumbnail_title' => trans('validation.custom.picture_thumbnail_title'),
'published' => trans('validation.custom.activated'),
'publish_at' => trans('validation.custom.publish_at'),
'unpublish_at' => trans('validation.custom.unpublish_at'),
'published' => trans('validation.custom.activated'),
'publish_at' => trans('validation.custom.publish_at'),
'unpublish_at' => trans('validation.custom.unpublish_at'),
];
}
}

View file

@ -44,26 +44,26 @@ class StoreProductRequest extends FormRequest
public function rules(): array
{
$rules = [
'seo_title' => 'required|between:45,70',
'seo_description' => 'required|between:50,160',
'title' => 'required|string|between:3,100',
'subtitle' => 'required|string|between:3,255',
'picture_thumbnail_alt' => 'required|string|between:3,255',
'seo_title' => 'required|between:45,70',
'seo_description' => 'required|between:50,160',
'title' => 'required|string|between:3,100',
'subtitle' => 'required|string|between:3,255',
'picture_thumbnail_alt' => 'required|string|between:3,255',
'picture_thumbnail_title' => 'required|string|between:3,255',
'picture_ambiance_alt' => 'required|string|between:3,255',
'picture_ambiance_title' => 'required|string|between:3,255',
'picture_packshot_alt' => 'required|string|between:3,255',
'picture_packshot_title' => 'required|string|between:3,255',
'description' => 'required|string|min:15',
'cooking_mode' => ['required', new Enum(CookingModeEnum::class)],
'cooking_advice' => 'required|string|min:15',
'ingredients' => 'required|string|min:15',
'nutritionnal_values' => 'required|array',
'nutritionnal_values.*' => 'required|numeric|min:0',
'range_id' => 'required|exists:ranges,id',
'commitments' => 'nullable|array',
'commitments.*.id' => 'required|exists:commitments,id',
'published' => 'required|boolean',
'picture_ambiance_alt' => 'required|string|between:3,255',
'picture_ambiance_title' => 'required|string|between:3,255',
'picture_packshot_alt' => 'required|string|between:3,255',
'picture_packshot_title' => 'required|string|between:3,255',
'description' => 'required|string|min:15',
'cooking_mode' => ['required', new Enum(CookingModeEnum::class)],
'cooking_advice' => 'required|string|min:15',
'ingredients' => 'required|string|min:15',
'nutritionnal_values' => 'required|array',
'nutritionnal_values.*' => 'required|numeric|min:0',
'range_id' => 'required|exists:ranges,id',
'commitments' => 'nullable|array',
'commitments.*.id' => 'required|exists:commitments,id',
'published' => 'required|boolean',
];
return \array_merge(
$rules,
@ -139,25 +139,25 @@ class StoreProductRequest extends FormRequest
public function attributes(): array
{
return [
'seo_title' => trans('validation.custom.seo_title'),
'seo_description' => trans('validation.custom.seo_description'),
'title' => trans('validation.attributes.title'),
'subtitle' => trans('validation.custom.subtitle'),
'description' => trans('validation.custom.description'),
'picture_thumbnail_alt' => trans('validation.custom.picture_thumbnail_alt'),
'seo_title' => trans('validation.custom.seo_title'),
'seo_description' => trans('validation.custom.seo_description'),
'title' => trans('validation.attributes.title'),
'subtitle' => trans('validation.custom.subtitle'),
'description' => trans('validation.custom.description'),
'picture_thumbnail_alt' => trans('validation.custom.picture_thumbnail_alt'),
'picture_thumbnail_title' => trans('validation.custom.picture_thumbnail_title'),
'picture_ambiance_alt' => trans('validation.custom.picture_ambiance_alt'),
'picture_ambiance_title' => trans('validation.custom.picture_ambiance_title'),
'picture_packshot_alt' => trans('validation.custom.picture_packshot_alt'),
'picture_packshot_title' => trans('validation.custom.picture_packshot_title'),
'cooking_mode' => trans('validation.custom.cooking_mode'),
'cooking_advice' => trans('validation.custom.cooking_advice'),
'ingredients' => trans('validation.custom.ingredients'),
'nutritionnal_values' => trans('validation.custom.nutritionnal_values'),
'range_id' => trans('models.classes.range'),
'commitments' => trans('Engagements associés au produit'),
'commitments.*.id' => trans('Élément parmis les engagements associés au produit'),
'published' => trans('validation.custom.activated'),
'picture_ambiance_alt' => trans('validation.custom.picture_ambiance_alt'),
'picture_ambiance_title' => trans('validation.custom.picture_ambiance_title'),
'picture_packshot_alt' => trans('validation.custom.picture_packshot_alt'),
'picture_packshot_title' => trans('validation.custom.picture_packshot_title'),
'cooking_mode' => trans('validation.custom.cooking_mode'),
'cooking_advice' => trans('validation.custom.cooking_advice'),
'ingredients' => trans('validation.custom.ingredients'),
'nutritionnal_values' => trans('validation.custom.nutritionnal_values'),
'range_id' => trans('models.classes.range'),
'commitments' => trans('Engagements associés au produit'),
'commitments.*.id' => trans('Élément parmis les engagements associés au produit'),
'published' => trans('validation.custom.activated'),
];
}
}

View file

@ -42,19 +42,19 @@ class StoreRangeRequest extends FormRequest
public function rules(): array
{
$rules = [
'seo_title' => 'required|between:45,70',
'seo_description' => 'required|between:50,160',
'title' => 'required|string|between:3,100',
'subtitle' => 'required|string|between:3,255',
'tagline' => 'required|string|between:3,255',
'description' => 'required|string|min:15',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'picture_productsheet_alt' => 'required|string|between:3,255',
'seo_title' => 'required|between:45,70',
'seo_description' => 'required|between:50,160',
'title' => 'required|string|between:3,100',
'subtitle' => 'required|string|between:3,255',
'tagline' => 'required|string|between:3,255',
'description' => 'required|string|min:15',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'picture_productsheet_alt' => 'required|string|between:3,255',
'picture_productsheet_title' => 'required|string|between:3,255',
'picture_thumbnail_alt' => 'required|string|between:3,255',
'picture_thumbnail_title' => 'required|string|between:3,255',
'published' => 'required|boolean',
'picture_thumbnail_alt' => 'required|string|between:3,255',
'picture_thumbnail_title' => 'required|string|between:3,255',
'published' => 'required|boolean',
];
return \array_merge(
$rules,
@ -72,19 +72,19 @@ class StoreRangeRequest extends FormRequest
public function attributes(): array
{
return [
'seo_title' => trans('validation.custom.seo_title'),
'seo_description' => trans('validation.custom.seo_description'),
'title' => trans('validation.attributes.title'),
'subtitle' => trans('validation.custom.subtitle'),
'tagline' => trans('validation.custom.tagline'),
'description' => trans('validation.custom.description'),
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_title' => trans('validation.custom.picture_title'),
'picture_productsheet_alt' => trans('validation.custom.picture_productsheet_alt'),
'seo_title' => trans('validation.custom.seo_title'),
'seo_description' => trans('validation.custom.seo_description'),
'title' => trans('validation.attributes.title'),
'subtitle' => trans('validation.custom.subtitle'),
'tagline' => trans('validation.custom.tagline'),
'description' => trans('validation.custom.description'),
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_title' => trans('validation.custom.picture_title'),
'picture_productsheet_alt' => trans('validation.custom.picture_productsheet_alt'),
'picture_productsheet_title' => trans('validation.custom.picture_productsheet_title'),
'picture_thumbnail_alt' => trans('validation.custom.picture_thumbnail_alt'),
'picture_thumbnail_title' => trans('validation.custom.picture_thumbnail_title'),
'published' => trans('validation.custom.activated'),
'picture_thumbnail_alt' => trans('validation.custom.picture_thumbnail_alt'),
'picture_thumbnail_title' => trans('validation.custom.picture_thumbnail_title'),
'published' => trans('validation.custom.activated'),
];
}
}

View file

@ -42,14 +42,14 @@ class StoreSeasonalSectionRequest extends FormRequest
public function rules(): array
{
$rules = [
'title' => 'required|string|between:3,100',
'text' => 'required|string|min:15',
'picture_alt' => 'required|string|between:3,255',
'title' => 'required|string|between:3,100',
'text' => 'required|string|min:15',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'background' => ['required', new Enum(BackgroundEnum::class)],
'published' => 'required|boolean',
'publish_at' => 'nullable|date',
'unpublish_at' => 'nullable|date|after:publish_at',
'background' => ['required', new Enum(BackgroundEnum::class)],
'published' => 'required|boolean',
'publish_at' => 'nullable|date',
'unpublish_at' => 'nullable|date|after:publish_at',
];
return \array_merge(
@ -66,14 +66,14 @@ class StoreSeasonalSectionRequest extends FormRequest
public function attributes(): array
{
return [
'title' => trans('validation.attributes.title'),
'text' => trans('validation.attributes.content'),
'picture_alt' => trans('validation.custom.picture_alt'),
'title' => trans('validation.attributes.title'),
'text' => trans('validation.attributes.content'),
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_title' => trans('validation.custom.picture_title'),
'background' => trans('validation.custom.background'),
'published' => trans('validation.custom.activated'),
'publish_at' => trans('validation.custom.publish_at'),
'unpublish_at' => trans('validation.custom.unpublish_at'),
'background' => trans('validation.custom.background'),
'published' => trans('validation.custom.activated'),
'publish_at' => trans('validation.custom.publish_at'),
'unpublish_at' => trans('validation.custom.unpublish_at'),
];
}

View file

@ -40,9 +40,9 @@ class StoreStampRequest extends FormRequest
public function rules(): array
{
$rules = [
'picture_alt' => 'required|string|between:3,255',
'picture_alt' => 'required|string|between:3,255',
'picture_title' => 'required|string|between:3,255',
'published' => 'required|boolean',
'published' => 'required|boolean',
];
return \array_merge(
$rules,
@ -58,9 +58,9 @@ class StoreStampRequest extends FormRequest
public function attributes(): array
{
return [
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_alt' => trans('validation.custom.picture_alt'),
'picture_title' => trans('validation.custom.picture_title'),
'published' => trans('validation.custom.activated'),
'published' => trans('validation.custom.activated'),
];
}
}

View file

@ -48,10 +48,25 @@ class UpdateStaticPageRequest extends FormRequest
public function rules(): array
{
return [
'seo_title' => 'required|min:45|max:70',
'seo_title' => 'required|min:45|max:70',
'seo_description' => 'required|min:50|max:160',
'title' => 'required|min:3|max:255',
'content' => 'present',
'title' => 'required|min:3|max:255',
'content' => 'present',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'seo_title' => trans('validation.custom.seo_title'),
'seo_description' => trans('validation.custom.seo_description'),
'title' => trans('validation.attributes.title'),
'content' => trans('validation.attributes.content'),
];
}
}

View file

@ -48,4 +48,20 @@ class StoreTestimonialRequest extends FormRequest
$this->pictureRules('picture', 292, 417, 292, 417, false),
);
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'picture_alt' => trans('validation.custom.picture_alt', ['field' => __('validation.custom.picture')]),
'picture_title' => trans('validation.custom.picture_title', ['field' => __('validation.custom.picture')]),
'description' => trans('validation.attributes.description'),
'job' => trans('validation.custom.job'),
'statut' => trans('validation.custom.statut'),
];
}
}

View file

@ -4,15 +4,4 @@ namespace App\Http\Requests\Bo\Testimonials;
class UpdateTestimonialRequest extends StoreTestimonialRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return \array_merge(
parent::rules()
);
}
}

View file

@ -39,4 +39,16 @@ class UpdateChangeOrderRequest extends FormRequest
'direction' => 'required|boolean',
];
}
/**
* Get custom attributes for validator errors.
*
* @return array
*/
public function attributes(): array
{
return [
'direction' => trans('validation.custom.direction'),
];
}
}

View file

@ -40,9 +40,9 @@ class StoreUserRequest extends FormRequest
{
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()
@ -50,8 +50,8 @@ class StoreUserRequest extends FormRequest
->symbols()
->uncompromised()
],
'role' => ['required', new Enum(RoleEnum::class)],
'published' => 'required|boolean',
'role' => ['required', new Enum(RoleEnum::class)],
'published' => 'required|boolean',
];
}
@ -64,11 +64,11 @@ class StoreUserRequest extends FormRequest
{
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')
];
}
}

View file

@ -33,7 +33,7 @@ class UpdateUserRequest extends StoreUserRequest
'email' => [
'required',
'email:rfc,strict,dns,spoof,filter',
'unique:users,email,' . $this->route('user')->id . ',id',
'unique:users,email,' . $this->route('user')->getKey() . ',id',
],
'password' => [
'required', 'required_with:password_confirmation', 'confirmed', 'max:255', Password::min(8)

View file

@ -16,10 +16,6 @@ use Illuminate\Support\Facades\Schema;
* @property string $data Changes.
* @property-read \Illuminate\Support\Carbon $created_at Created date.
*
* @method public static function addActivity($model, $eventEnum) Add new activity to the activity logs list.
* @method public static function getValuesChanged($activity, $model, $eventEnum)
* Get old, new and type of values changed.
*
* @property-read \App\Models\User $user User BelongsTo relation.
*/
class ActivityLog extends Model

View file

@ -8,12 +8,12 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $title Titre.
* @property string $picture Path de l'image de l'engagement (185px * 185px).
* @property string $picture_alt Attribut alt de l'image de l'engagement.
* @property string $picture_title Attribut title de l'image de l'engagement.
* @property boolean $published État de publication.
* @property integer $order Numéro permettant d'ordonner les engagements.
* @property string $title Title.
* @property string $picture Path of the picture (185px * 185px).
* @property string $picture_alt Picture alt attribute.
* @property string $picture_title Picture title attribute.
* @property boolean $published Publication status.
* @property integer $order Order.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*
@ -45,7 +45,7 @@ class Commitment extends Model
* @var array<string, string>
*/
protected $casts = [
'published' => 'bool',
'published' => 'bool',
];
/**

View file

@ -7,16 +7,16 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property float $key_feed Chiffre clé 'bien nourrir'.
* @property float $key_earth_1 Chiffre clé 'respecter la terre' 1.
* @property float $key_earth_2 Chiffre clé 'respecter la terre' 2.
* @property float $key_together_1 Chiffre clé 'vivre ensemble' 1.
* @property float $key_together_2 Chiffre clé 'vivre ensemble' 2.
* @property float $key_together_3 Chiffre clé 'vivre ensemble' 3.
* @property float $key_together_4 Chiffre clé 'vivre ensemble' 4.
* @property float $key_territory Chiffre clé 'intégrer son territoire'.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
* @property float $key_feed Key figure 'bien nourrir'.
* @property float $key_earth_1 Key figure 'respecter la terre' 1.
* @property float $key_earth_2 Key figure 'respecter la terre' 2.
* @property float $key_together_1 Key figure 'vivre ensemble' 1.
* @property float $key_together_2 Key figure 'vivre ensemble' 2.
* @property float $key_together_3 Key figure 'vivre ensemble' 3.
* @property float $key_together_4 Key figure 'vivre ensemble' 4.
* @property float $key_territory Key figure 'intégrer son territoire'.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/
class Convictionpage extends Model
{

View file

@ -8,15 +8,15 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $picture_1 Path de l'image n°1 explorateur.
* @property string $picture_1_alt Attribut alt de l'image n°1 explorateur.
* @property string $picture_1_title Attribut title de l'image n°1 explorateur.
* @property string $picture_2 Path de l'image n°2 explorateur.
* @property string $picture_2_alt Attribut alt de l'image n°2 explorateur.
* @property string $picture_2_title Attribut title de l'image n°2 explorateur.
* @property string $picture_3 Path de l'image n°3 explorateur.
* @property string $picture_3_alt Attribut alt de l'image n°3 explorateur.
* @property string $picture_3_title Attribut title de l'image n°3 explorateur.
* @property string $picture_1 Path of the picture 1.
* @property string $picture_1_alt Picture 1 alt attribute.
* @property string $picture_1_title Picture 1 title attribute.
* @property string $picture_2 Path of the picture 2.
* @property string $picture_2_alt Picture 2 alt attribute.
* @property string $picture_2_title Picture 2 title attribute.
* @property string $picture_3 Path of the picture 3.
* @property string $picture_3_alt Picture 3 alt attribute.
* @property string $picture_3_title Picture 3 title attribute.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*

View file

@ -8,14 +8,14 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $title_part1 Première partie du titre h1 de l'accueil.
* @property string $title_part2 Deuxième partie du titre h1 de l'accueil.
* @property string $title_part3 Dernière partie du titre h1 de l'accueil.
* @property string $picture Path de l'image de la page d'accueil (640px * 390px).
* @property string $picture_alt Attribut alt de l'image de la page d'accueil.
* @property string $picture_title Attribut title de l'image de la page d'accueil.
* @property string $presentation_title Titre de la partie 'présentation' de la page d'accueil.
* @property string $presentation_content WYSIWYG - Contenu de la partie présentation de la page d'accueil.
* @property string $title_part1 Title part 1.
* @property string $title_part2 Title part 2.
* @property string $title_part3 Title part 3.
* @property string $picture Path of the picture (640px * 390px).
* @property string $picture_alt Picture alt attribute.
* @property string $picture_title Picture title attribute.
* @property string $presentation_title Presentation title.
* @property string $presentation_content WYSIWYG - Presentation content.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/

View file

@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $video_id Lien de la vidéo youtube à afficher.
* @property string $video_id Id of the youtube video to display.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/

View file

@ -11,23 +11,23 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
/**
* @property string $seo_title Utilisé pour la balise title de la page.
* @property string $seo_description Utilisé pour la balise meta description de la page.
* @property string $title Balise h1 de la page.
* @property string $slug Slug à partir de title.
* @property \App\Enums\News\CategoryEnum $category Catégorie de la news (\App\Enums\News\CategoryEnum).
* @property string|null $picture_thumbnail Path de la vignette de l'actualité (265px * 354px).
* @property string|null $picture_thumbnail_alt Attribut alt de la vignette de l'actualité.
* @property string|null $picture_thumbnail_title Attribut title de la vignette de l'actualité.
* @property string $picture Path de l'illustration de l'actualité (1002px*565px).
* @property string $picture_alt Attribut alt de l'illustration de l'actualité.
* @property string $picture_title Attribut title de l'illustration de l'actualité.
* @property string $subtitle Sous-titre de l'actualité. Chaine vide possible.
* @property string $content WYSIWYG - Texte de l'actualité.
* @property boolean $published L'actualité est-elle visible ?
* @property \Carbon\Carbon|null $publish_at Date de publication de l'actualité.
* @property \Carbon\Carbon|null $unpublish_at Date de dépublication de l'actualité.
* @property integer $order Numéro permettant d'ordonner les engagements.
* @property string $seo_title SEO title.
* @property string $seo_description SEO description.
* @property string $title Title.
* @property string $slug Slug of the title.
* @property \App\Enums\News\CategoryEnum $category Category (\App\Enums\News\CategoryEnum).
* @property string|null $picture_thumbnail Path of the thumbnail (265px * 354px).
* @property string|null $picture_thumbnail_alt Thumbnail alt attribute.
* @property string|null $picture_thumbnail_title Thumbnail title attribute.
* @property string $picture Path of the picture (1002px*565px).
* @property string $picture_alt Picture alt attribute..
* @property string $picture_title Picture title attribute.
* @property string $subtitle Subtitle.
* @property string $content WYSIWYG - Content.
* @property boolean $published Publication status.
* @property \Carbon\Carbon|null $publish_at Publication status update date.
* @property \Carbon\Carbon|null $unpublish_at Unpublication status update date.
* @property integer $order Order.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/

View file

@ -13,27 +13,27 @@ use Illuminate\Support\Str;
/**
* @phpcs:disable Generic.Files.LineLength.TooLong
*
* @property string $seo_title Utilisé pour la balise title de la page.
* @property string $seo_description Utilisé pour la balise meta description de la page.
* @property string $title Balise h1 de la page.
* @property string $slug Slug à partir de title.
* @property string $subtitle Sous-titre du produit.
* @property string $picture_thumbnail Path de la vignette du produit (332px * 252px).
* @property string $picture_thumbnail_alt Attribut alt de la vignette du produit.
* @property string $picture_thumbnail_title Attribut title de la vignette du produit.
* @property string $picture_ambiance Path du visuel d'ambiance du produit (774px * 515px).
* @property string $picture_ambiance_alt Attribut alt du visuel d'ambiance.
* @property string $picture_ambiance_title Attribut title du visuel d'ambiance.
* @property string $picture_packshot Path de l'image du packshot (327px * 252px).
* @property string $picture_packshot_alt Attribut alt de l'image du packshot.
* @property string $picture_packshot_title Attribut title de l'image du packshot.
* @property string $description WYSIWYG - Description du produit.
* @property \App\Enums\Products\CookingModeEnum $cooking_mode Mode de cuisson \App\Enums\Products\CookingModeEnum.
* @property string $cooking_advice WYSIWYG - Conseil de réchauffage.
* @property string $ingredients WYSIWYG - Ingrédients qui composent le produit.
* @property string $nutritionnal_values JSON des valeurs nutritionnelles pour 100g.
* @property boolean $published Le produit est-il visible ?
* @property integer $order Numéro permettant d'ordonner les produits.
* @property string $seo_title SEO title.
* @property string $seo_description SEO description.
* @property string $title Title.
* @property string $slug Slug of the title.
* @property string $subtitle Subtitle.
* @property string $picture_thumbnail Path of the thumbnail (332px * 252px).
* @property string $picture_thumbnail_alt Thumbnail alt attribute.
* @property string $picture_thumbnail_title Thumbnail title attribute.
* @property string $picture_ambiance Path of the picture of the ambiance (774px * 515px).
* @property string $picture_ambiance_alt Picture alt attribute of the ambiance.
* @property string $picture_ambiance_title Picture title attribute of the ambiance.
* @property string $picture_packshot Path of the packshot (327px * 252px).
* @property string $picture_packshot_alt Packshot picture alt attribute.
* @property string $picture_packshot_title Packshot picture title attribute.
* @property string $description WYSIWYG - Description.
* @property \App\Enums\Products\CookingModeEnum $cooking_mode Cooking mode (\App\Enums\Products\CookingModeEnum).
* @property string $cooking_advice WYSIWYG - Reheating advice.
* @property string $ingredients WYSIWYG - Ingredients.
* @property string $nutritionnal_values JSON - Nutritionnal values.
* @property boolean $published Publication status.
* @property integer $order Order.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*

View file

@ -10,33 +10,32 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
// phpcs:disable Generic.Files.LineLength.TooLong
/**
* @phpcs:disable Generic.Files.LineLength.TooLong
*
* @property string $seo_title Utilisé pour la balise title de la page.
* @property string $seo_description Utilisé pour la balise meta description de la page.
* @property string $title Balise h1 de la page.
* @property string $slug Slug à partir de title.
* @property string $subtitle Sous-titre de la gamme.
* @property string $tagline Titre d'accroche de la gamme.
* @property string $description WYSIWYG - Description de la gamme.
* @property string $picture Path de l'image de la gamme (466px * 440px).
* @property string $picture_alt Attribut alt pour l'image picture.
* @property string $picture_title Attribut title pour l'image picture.
* @property string $picture_productsheet Path de l'image à afficher sur les fiches produits de cette gamme (332px * 442px).
* @property string $picture_productsheet_alt Attribut alt de l'image à afficher sur les fiches produits.
* @property string $picture_productsheet_title Attribut title de l'image à afficher sur les fiches produits.
* @property string $picture_thumbnail Path de la vignette de la gamme (246px * 337px).
* @property string $picture_thumbnail_alt Attribut alt de la vignette de la gamme.
* @property string $picture_thumbnail_title Attribut title de la vignette de la gamme.
* @property boolean $published Le produit est-il visible ?
* @property integer $order Numéro permettant d'ordonner les produits.
* @property string $seo_title SEO title.
* @property string $seo_description SEO description.
* @property string $title Title.
* @property string $slug Slug of the title.
* @property string $subtitle Subtitle.
* @property string $tagline Tagline.
* @property string $description WYSIWYG - Description.
* @property string $picture Path of the picture (466px * 440px).
* @property string $picture_alt Picture alt attribute.
* @property string $picture_title Picture title attribute.
* @property string $picture_productsheet Path of the picture of the product sheet (332px * 442px).
* @property string $picture_productsheet_alt Picture alt attribute of the product sheet.
* @property string $picture_productsheet_title Picture title attribute of the product sheet.
* @property string $picture_thumbnail Path of the thumbnail (246px * 337px).
* @property string $picture_thumbnail_alt Thumbnail alt attribute.
* @property string $picture_thumbnail_title Thumbnail title attribute.
* @property boolean $published Publication status.
* @property integer $order Order.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*
* @property-read \App\Models\Products $products Products Has Many relationship.
* @phpcs:enable
*/
// phpcs:enable
class Range extends Model
{
use ActivityLog;

View file

@ -8,22 +8,21 @@ use App\Traits\Models\ActivityLog;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
// phpcs:disable Generic.Files.LineLength.TooLong
/**
* @phpcs:disable Generic.Files.LineLength.TooLong
*
* @property string $title Titre de la section saisonnière.
* @property string $text WYSIWYG - Texte de la section saisonnière.
* @property string $picture Path de l'image de la section saisonnière (362px * 542px).
* @property string $picture_alt Attribut alt de l'image.
* @property string $picture_title Attribut title de l'image.
* @property \App\Enums\SeasonalSections\BackgroundEnum $background Fond de la section saisonnière \App\Enums\SeasonalSections\BackgroundEnum.
* @property boolean $published La section est-elle visible ?
* @property \Carbon\Carbon|null $publish_at Date de publication de la section.
* @property \Carbon\Carbon|null $unpublish_at Date de dépublication de la section.
* @property string $title Title.
* @property string $text WYSIWYG - Text.
* @property string $picture Path of the picture (362px * 542px).
* @property string $picture_alt Picture alt attribute.
* @property string $picture_title Picture title attribute.
* @property \App\Enums\SeasonalSections\BackgroundEnum $background Background (\App\Enums\SeasonalSections\BackgroundEnum).
* @property boolean $published Publication status.
* @property \Carbon\Carbon|null $publish_at Publication status update date.
* @property \Carbon\Carbon|null $unpublish_at Unpublication status update date.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
* @phpcs:enable
*/
// phpcs:enable
class SeasonalSection extends Model
{
use ActivityLog;

View file

@ -7,10 +7,10 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $picture Path de l'image du tampon (120px * 120px).
* @property string $picture_alt Attribut alt de l'image du tampon.
* @property string $picture_title Attribut title de l'image du tampon.
* @property boolean $published Le tampon est-il visible ?
* @property string $picture Path of the picture (120px * 120px).
* @property string $picture_alt Image alt attribute.
* @property string $picture_title Image title attribute.
* @property boolean $published Publication status.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/

View file

@ -8,13 +8,13 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $picture Path de l'illustration du témoignage (292px * 417px).
* @property string $picture_alt Attribut alt de l'illustration.
* @property string $picture_title Attribut title de l'illustration.
* @property string $description Texte du témoignage.
* @property string $job Métier de la personne témoignant.
* @property string $statut Statut de la personne témoignant
* @property integer $order Numéro permettant d'ordonner les témoignages.
* @property string $picture Path of the picture (292px * 417px).
* @property string $picture_alt Picture alt attribute.
* @property string $picture_title Picture title attribute.
* @property string $description Testimonial text.
* @property string $job Testifying person's profession.
* @property string $statut Testifying person's status.
* @property integer $order Order.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/

View file

@ -10,20 +10,16 @@ use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
/**
* @property string $first_name Prénom.
* @property string $last_name Nom.
* @property string $first_name Firstname.
* @property string $last_name Lastname.
* @property string $email Email.
* @property string $password Mot de passe.
* @property \App\Enums\Users\RoleEnum $role Rôle.
* @property \Illuminate\Support\Carbon $published État de publication.
* @property \Illuminate\Support\Carbon $published_at Date de mise à jour de l'état de publication.
* @property string $password Password.
* @property \App\Enums\Users\RoleEnum $role Role.
* @property \Illuminate\Support\Carbon $published Publication status.
* @property \Illuminate\Support\Carbon $published_at Publication status update date.
* @property-read \Illuminate\Support\Carbon $created_at Created date.
* @property-read \Illuminate\Support\Carbon $updated_at Updated date.
*
* @method protected static function booted() Perform any actions required after the model boots.
* @method private static function setOrder($model) Set order after the last element of the list.
* @method private static function updatePassword($model) Update password.
*
* @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship.
*/
class User extends Authenticatable

View file

@ -16,11 +16,12 @@ class CommitmentSeeder extends Seeder
public function run()
{
FileStorageHelper::removeModelFiles(new Commitment());
Commitment::factory(12)->make()->each(function (Commitment $commitment) {
Commitment::factory(12)->make()->each(function (Commitment $commitment, int $key) {
$commitment->picture = FileStorageHelper::storeFile($commitment, new \SplFileInfo(\resource_path(
'../database/factories/assets/commitments/default-picture-185x185.png'
)));
$commitment->saveOrFail();
$commitment->order = $key + 1;
$commitment->saveQuietly();
});
}
}

View file

@ -16,14 +16,15 @@ class NewsSeeder extends Seeder
public function run()
{
FileStorageHelper::removeModelFiles(new News());
News::factory(10)->make()->each(function (News $news) {
News::factory(10)->make()->each(function (News $news, int $key) {
$news->picture_thumbnail = FileStorageHelper::storeFile($news, new \SplFileInfo(\resource_path(
'../database/factories/assets/news/default-picture-265x354.png'
)));
$news->picture = FileStorageHelper::storeFile($news, new \SplFileInfo(\resource_path(
'../database/factories/assets/news/default-picture-1002x565.png'
)));
$news->save();
$news->order = $key + 1;
$news->saveQuietly();
});
}
}

View file

@ -17,7 +17,7 @@ class ProductSeeder extends Seeder
public function run()
{
FileStorageHelper::removeModelFiles(new Product());
Product::factory(25)->make()->each(function (Product $product) {
Product::factory(25)->make()->each(function (Product $product, int $key) {
$product->picture_thumbnail = FileStorageHelper::storeFile(new Product(), new \SplFileInfo(\resource_path(
'../database/factories/assets/products/default-picture-332x252.png'
)));
@ -27,7 +27,8 @@ class ProductSeeder extends Seeder
$product->picture_packshot = FileStorageHelper::storeFile(new Product(), new \SplFileInfo(\resource_path(
'../database/factories/assets/products/default-picture-327x252.png'
)));
$product->save();
$product->order = $key + 1;
$product->saveQuietly();
});
$commitments = Commitment::query()->get();

View file

@ -16,7 +16,7 @@ class RangeSeeder extends Seeder
public function run()
{
FileStorageHelper::removeModelFiles(new Range());
Range::factory(10)->make()->each(function (Range $range) {
Range::factory(10)->make()->each(function (Range $range, int $key) {
$range->picture = FileStorageHelper::storeFile($range, new \SplFileInfo(\resource_path(
'../database/factories/assets/ranges/default-picture-466x440.png'
)));
@ -26,6 +26,7 @@ class RangeSeeder extends Seeder
$range->picture_thumbnail = FileStorageHelper::storeFile($range, new \SplFileInfo(\resource_path(
'../database/factories/assets/ranges/default-picture-246x337.png'
)));
$range->order = $key + 1;
$range->save();
});
}

View file

@ -20,6 +20,7 @@ class StampSeeder extends Seeder
$stamp->picture = FileStorageHelper::storeFile($stamp, new \SplFileInfo(
\resource_path('../database/factories/assets/stamps/default-picture-120x120.png')
));
$stamp->saveOrFail();
});
}
}

View file

@ -16,11 +16,12 @@ class TestimonialSeeder extends Seeder
public function run()
{
FileStorageHelper::removeModelFiles(new Testimonial());
Testimonial::factory(12)->make()->each(function (Testimonial $testimonial) {
Testimonial::factory(12)->make()->each(function (Testimonial $testimonial, int $key) {
$testimonial->picture = FileStorageHelper::storeFile($testimonial, new \SplFileInfo(\resource_path(
'../database/factories/assets/testimonials/default-picture-292x417.png'
)));
$testimonial->saveOrFail();
$testimonial->order = $key + 1;
$testimonial->saveQuietly();
});
}
}

View file

@ -221,65 +221,69 @@ return [
'female' => 'of the ',
'vowel' => 'of the '
],
'event' => 'event',
'model' => 'target element',
'order' => 'order',
'publication' => 'publication',
'accept_rules' => 'acceptation of rules',
'activated' => 'activated',
'target' => 'target',
'static_page_type' => 'static page type',
'seo' => 'SEO',
'seo_title' => 'SEO title',
'seo_description' => 'SEO description',
'description' => 'description',
'subtitle' => 'subtitle',
'tagline' => 'tagline',
'attribute_alt' => 'alt attribute',
'attribute_title' => 'title attribute',
'picture_productsheet' => 'productsheet picture',
'picture_thumbnail' => 'thumbnail',
'category' => 'category',
'publish_at' => 'publication date',
'unpublish_at' => 'end of publication date',
'background' => 'background',
'picture' => 'picture',
'picture_1' => 'picture one',
'picture_2' => 'picture two',
'picture_3' => 'picture three',
'presentation_title' => 'presentation title',
'title_part1' => 'title part one',
'title_part2' => 'title part two',
'title_part3' => 'title part three',
'category' => 'category',
'publish_at' => 'publication date',
'unpublish_at' => 'end of publication date',
'picture_ambiance' => 'ambiance picture',
'picture_packshot' => 'packshot picture',
'category' => 'category',
'civility' => 'civility',
'cooking_advice' => 'cooking advice',
'description' => 'description',
'direction' => 'direction',
'event' => 'event',
'file' => 'file',
'ingredients' => 'ingredients',
'nutritionnal_values' => 'nutritionnal values',
'key_feed' => 'key number for "feed well"',
'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',
'key_territory' => 'key number for "integrate its territory"',
'video_id' => 'URL of the video',
'job' => 'job',
'statut' => 'statut',
'society' => 'society',
'civility' => 'civility',
'model' => 'target element',
'nutritionnal_values' => 'nutritionnal values',
'object' => 'object',
'product_name' => 'product name',
'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_barcode' => 'product barcode',
'product_lot' => 'product lot',
'product_location' => 'product location',
'accept_rules' => 'acceptation of rules',
'product_lot' => 'product lot',
'product_name' => 'product name',
'publication' => 'publication',
'publish_at' => 'publication date',
'publish_at' => 'publication date',
'send_data' => 'autorization to send data',
'file' => 'file',
'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

@ -223,65 +223,69 @@ return [
'female' => 'de la ',
'vowel' => 'de l\''
],
'event' => 'évènement',
'model' => 'élément ciblé',
'order' => 'ordre',
'publication' => 'publication',
'accept_rules' => 'acceptation des règles',
'activated' => 'activé',
'target' => 'cible',
'static_page_type' => 'type de page',
'seo' => 'référencement SEO',
'seo_title' => 'titre SEO',
'seo_description' => 'description SEO',
'description' => 'description',
'subtitle' => 'sous-titre',
'tagline' => 'phrase d\'accroche',
'attribute_alt' => 'attribut alt',
'attribute_title' => 'attribut title',
'picture_productsheet' => 'image de la fiche produit',
'picture_thumbnail' => 'vignette',
'category' => 'catégorie',
'publish_at' => 'date de publication',
'unpublish_at' => 'date de fin de publication',
'background' => 'fond',
'picture' => 'image',
'picture_1' => 'image une',
'picture_2' => 'image deux',
'picture_3' => 'image trois',
'presentation_title' => 'titre de présentation',
'title_part1' => 'première partie du titre',
'title_part2' => 'seconde partie du titre',
'title_part3' => 'dernière partie du titre',
'category' => 'catégorie',
'publish_at' => 'date de publication',
'unpublish_at' => 'date de fin de publication',
'picture_ambiance' => 'image d\'ambiance',
'picture_packshot' => 'image du packshot',
'category' => 'catégorie',
'civility' => 'civilité',
'cooking_advice' => 'conseil de réchauffage',
'description' => 'description',
'direction' => 'direction',
'event' => 'évènement',
'file' => 'fichier',
'ingredients' => 'ingrédients',
'nutritionnal_values' => 'valeurs nutritionnelles',
'key_feed' => 'chiffre clé "bien nourrir"',
'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',
'key_territory' => 'Chiffre clé "intégrer son territoire"',
'video_id' => 'URL de la vidéo',
'job' => 'métier',
'statut' => 'statut',
'society' => 'société',
'civility' => 'civilité',
'model' => 'élément ciblé',
'nutritionnal_values' => 'valeurs nutritionnelles',
'object' => 'objet',
'product_name' => 'nom du produit',
'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_barcode' => 'le code barre du produit',
'product_lot' => 'numéro du lot figurant à côté de la date',
'product_location' => 'le lieu de l\'achat',
'accept_rules' => 'acceptation des règles',
'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',
'file' => 'fichier',
'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',
'unpublish_at' => 'date de fin de publication',
'unpublish_at' => 'date de fin de publication',
'video_id' => 'ID de la vidéo',
],
];