fix: 🐛 correct publish validation, fix translation, and add slider indicators
This commit is contained in:
parent
cfffe97e06
commit
ef44546aea
6 changed files with 18 additions and 8 deletions
|
|
@ -94,9 +94,11 @@ class Aisle extends Model
|
|||
private static function assertLimitPublishedModels(self $model, bool $isDeletion = false)
|
||||
{
|
||||
$count = self::query()->where('published', true)->where('network_id', $model->network_id)->count();
|
||||
$updatePublished = !$isDeletion && $model->published && !$model->getOriginal('published');
|
||||
|
||||
if (
|
||||
(!$model->published && $count <= 1) ||
|
||||
($model->published && $count >= 4) ||
|
||||
($updatePublished && $count >= 4) ||
|
||||
($isDeletion && $count === 1)
|
||||
) {
|
||||
throw ValidationException::withMessages([
|
||||
|
|
|
|||
|
|
@ -89,11 +89,13 @@ class Brand extends Model
|
|||
*/
|
||||
private static function assertLimitPublishedModels(self $model, bool $isDeletion = false)
|
||||
{
|
||||
$count = self::query()->where('published', true)->count();
|
||||
$count = self::query()->where('published', true)->where('aisle_id', $model->aisle_id)->count();
|
||||
$updatePublished = !$isDeletion && $model->published && !$model->getOriginal('published');
|
||||
|
||||
if (
|
||||
$count !== 0 &&
|
||||
((!$model->published && $count <= 1) ||
|
||||
($model->published && $count >= 5) ||
|
||||
($updatePublished && $count >= 5) ||
|
||||
($isDeletion && $count === 1))
|
||||
) {
|
||||
throw ValidationException::withMessages([
|
||||
|
|
|
|||
|
|
@ -138,9 +138,11 @@ class Network extends Model
|
|||
private static function assertLimitPublishedModels(self $model, bool $isDeletion = false)
|
||||
{
|
||||
$count = self::query()->where('published', true)->count();
|
||||
$updatePublished = !$isDeletion && $model->published && !$model->getOriginal('published');
|
||||
|
||||
if (
|
||||
(!$model->published && $count <= 1) ||
|
||||
($model->published && $count >= 5) ||
|
||||
($updatePublished && $count >= 5) ||
|
||||
($isDeletion && $count === 1)
|
||||
) {
|
||||
throw ValidationException::withMessages([
|
||||
|
|
|
|||
|
|
@ -303,6 +303,7 @@ return [
|
|||
'link' => 'lien de l\'ancre',
|
||||
],
|
||||
'media' => 'média',
|
||||
'anchor' => 'ancre'
|
||||
'anchor' => 'ancre',
|
||||
'link' => 'lien',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -34,13 +34,13 @@
|
|||
{{-- LINK --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.attributes.link')) }}</legend>
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.link')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('bo.partials.inputs.varchar', [
|
||||
'id' => 'brandLink',
|
||||
'label' => __(':field :inter:model', [
|
||||
'field' => Str::ucfirst(__('validation.attributes.link')),
|
||||
'field' => Str::ucfirst(__('validation.custom.link')),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.brand', 1),
|
||||
]),
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
'model' => $brandModel ?? null,
|
||||
'helper' => __('validation.between.string', [
|
||||
'attribute' => __(':field :inter:model', [
|
||||
'field' => __('validation.attributes.link'),
|
||||
'field' => __('validation.custom.link'),
|
||||
'inter' => __('validation.custom.of_the.female'),
|
||||
'model' => trans_choice('models.classes.brand', 1),
|
||||
]),
|
||||
|
|
|
|||
|
|
@ -102,6 +102,9 @@
|
|||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
<div
|
||||
class="position-relative swiper-pagination swiper-networks-pagination swiper-pagination-clickable swiper-pagination-bullets swiper-pagination-horizontal d-flex justify-content-center align-items-center mt-5 flex-nowrap px-5">
|
||||
</div>
|
||||
</div>
|
||||
<button class="swiper-button swiper-button-prev-custom swiper-networks-button-prev z-1 mx-3">
|
||||
<img src="{{ Vite::asset('resources/assets/images/misc/blue-arrow.svg') }}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue