Remove code length from settings (keep on config like always)
This commit is contained in:
parent
79ee185e1c
commit
95bb4e3b09
8 changed files with 33 additions and 82 deletions
|
|
@ -40,8 +40,8 @@ class GenerateCodesRequest extends FormRequest
|
|||
public function attributes(): array
|
||||
{
|
||||
return [
|
||||
'quantity' => trans('quantité'),
|
||||
'code_length' => trans('longueur des codes'),
|
||||
'quantity' => trans('validation.custom.quantity'),
|
||||
'code_length' => trans('validation.custom.code_length'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ class UpdateSettingsRequest extends FormRequest
|
|||
'notification_emails.*' => 'email:rfc,spoof,dns',
|
||||
|
||||
'winning_proof' => 'required|boolean',
|
||||
'analytics' => 'nullable|numeric|min:1',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +108,6 @@ class UpdateSettingsRequest extends FormRequest
|
|||
'nb_participation_player' => trans('validation.custom.nb_participation_player'),
|
||||
'nb_participation_ip' => trans('validation.custom.nb_participation_ip'),
|
||||
'nb_unique_code_use' => trans('validation.custom.nb_unique_code_use'),
|
||||
'code_length' => trans('validation.custom.code_length'),
|
||||
'use_ean_codes' => trans('validation.custom.use_ean_codes'),
|
||||
'activated_teaser' => trans('validation.custom.activated_teaser'),
|
||||
'activated_close_page' => trans('validation.custom.activated_close_page'),
|
||||
|
|
@ -128,9 +126,7 @@ class UpdateSettingsRequest extends FormRequest
|
|||
'web_coupons.*.img_name' => trans('Nom image :index'),
|
||||
|
||||
'notification_emails' => trans('Tableau des email à notifier'),
|
||||
'notification_emails.*.email' => trans('validation.attributes.email'),
|
||||
|
||||
'analytics' => trans('validation.custom.analytics'),
|
||||
'notification_emails.*.email' => trans('validation.attributes.email')
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,12 +93,10 @@ class Code extends Model
|
|||
*/
|
||||
public static function intToSerial(int $int): string
|
||||
{
|
||||
/** @var \App\Models\Settings */
|
||||
$settings = app(Settings::class);
|
||||
return SerialCaster::encode(
|
||||
$int,
|
||||
\abs(\crc32(config('app.key'))),
|
||||
$settings->code_length,
|
||||
config('codes.codeLength'),
|
||||
config('codes.codeCharList')
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property int $nb_participation_player Max paticipation per player
|
||||
* @property int $nb_participation_ip Max paticipation per ip
|
||||
* @property int $nb_unique_code_use Max unique code use
|
||||
* @property-read int $code_length Code length
|
||||
* @property boolean $use_ean_codes Should the game use ean codes ?
|
||||
* @property boolean $activated_teaser Is the teaser active ?
|
||||
* @property boolean $activated_close_page Is the close page active ?
|
||||
|
|
@ -27,7 +26,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @property string $web_coupons Array of web coupons
|
||||
* @property array<string> $notification_emails Array of email to notify when there's a winnner
|
||||
* @property boolean $winning_proof Is the winning proof needed
|
||||
* @property string $analytics Matomo siteId
|
||||
* @property-read \Illuminate\Support\Carbon $created_at Creation Date.
|
||||
* @property-read \Illuminate\Support\Carbon $updated_at Last update Date.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,27 +17,34 @@ class CreateSettings extends Migration
|
|||
$table->id();
|
||||
$table->string('name')->comment('Nom du jeu');
|
||||
$table->string('company')->comment('Nom de la société qui organise le jeu');
|
||||
$table->dateTime('start_date');
|
||||
$table->dateTime('end_date');
|
||||
$table->integer('nb_participation_player');
|
||||
$table->integer('nb_participation_ip');
|
||||
$table->integer('nb_unique_code_use');
|
||||
$table->smallInteger('code_length')
|
||||
->default(config('codes.codeLength'));
|
||||
$table->boolean('use_ean_codes');
|
||||
$table->boolean('activated_teaser');
|
||||
$table->boolean('activated_close_page');
|
||||
$table->dateTime('close_page_active_date')->nullable();
|
||||
$table->string('redirect_close');
|
||||
$table->boolean('reductions_activated');
|
||||
$table->string('reductions_site')->nullable();
|
||||
$table->string('reductions_campaign')->nullable();
|
||||
$table->text('web_coupons')->nullable();
|
||||
$table->text('notification_emails')->nullable();
|
||||
$table->boolean('winning_proof');
|
||||
$table->string('analytics', 20)->nullable();
|
||||
|
||||
$table->timestamp('start_date')->useCurrent()->comment('Date de début du jeu');
|
||||
$table->timestamp('end_date')->useCurrent()->comment('Date de début du jeu');
|
||||
|
||||
$table->integer('nb_participation_player')->comment('Nombre de participation par joueur (compte crm)');
|
||||
$table->integer('nb_participation_ip')->comment('Nombre de participation par adresse ip');
|
||||
$table->integer('nb_unique_code_use')
|
||||
->comment('Nombre d\'utilisation max d\'un code unique (par plusieurs joueurs, sinon 1J = 1 code)');
|
||||
$table->boolean('use_ean_codes')->comment('Le joueur doivent entrer le code EAN du produit porteur');
|
||||
|
||||
$table->boolean('activated_teaser')->comment('Le teaser est activé, sinon redirection vers close page');
|
||||
$table->boolean('activated_close_page')
|
||||
->comment('La page de cloture est activée, sinon redirection vers close page');
|
||||
$table->timestamp('close_page_active_date')->nullable()
|
||||
->comment('Date limite pour utiliser la page de cloture, sinon redirection vers close page');
|
||||
$table->string('redirect_close')->comment('Lien de redirection du jeu quand celui-ci est fermé');
|
||||
|
||||
$table->boolean('reductions_activated')
|
||||
->comment('Les bon de réduction sont activés (gains de BR possibles)');
|
||||
$table->string('reductions_site')->nullable()->comment('Champ mesBR "site"');
|
||||
$table->string('reductions_campaign')->nullable()->comment('Champ mesBR "campaign"');
|
||||
|
||||
$table->json('web_coupons')->nullable()->comment('Les coupons disponibles comme gain pour les joueurs');
|
||||
$table->json('notification_emails')->nullable()->comment('Les mails à notifier pour les évènements de jeu');
|
||||
|
||||
$table->boolean('winning_proof')
|
||||
->comment('Les preuves de gains sont obligatoires (pdf sont à mettre dans prizes)');
|
||||
$table->timestamps();
|
||||
$table->collation = 'utf8mb4_unicode_ci';
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
'name' => 'code_length',
|
||||
'required' => true,
|
||||
'readonly' => true,
|
||||
'value' => $settings->code_length ?? config('codes.codeLength'),
|
||||
'value' => config('codes.codeLength'),
|
||||
'model' => null,
|
||||
'helper' => __('validation.min.numeric', [
|
||||
'attribute' => __(':field', [
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@
|
|||
{{-- RANGE_ID --}}
|
||||
<div class="col-12 col-md-6 pb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ trans_choice('models.classes.gain-views', 1) }}</legend>
|
||||
<legend>{{ __('models.classes.range') }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('back::partials.inputs.bigint-foreign-id', [
|
||||
|
|
|
|||
|
|
@ -168,26 +168,6 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- CODE_LENGTH --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.code_length')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('back::partials.inputs.int-number', [
|
||||
'id' => 'settingsCodeLength',
|
||||
'label' => Str::ucfirst(__('validation.custom.code_length')),
|
||||
'name' => 'code_length',
|
||||
'required' => false,
|
||||
'disabled' => true,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('Cette valeur ne doit pas varier en cours de jeu.'),
|
||||
'min' => 0,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
{{-- USE_EAN_CODES --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
|
|
@ -419,34 +399,6 @@
|
|||
@include('back::modules.input-error', ['inputName' => 'notification_emails.*'])
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<h5 class="card-subtitle mb-3">
|
||||
{{ __('Analytics') }}<br />
|
||||
<small class="text-muted">{{ __('Saississez les informations permettant d\'établir des statistiques pour le jeu.') }}</small>
|
||||
</h5>
|
||||
|
||||
<div class="row">
|
||||
{{-- ANALYTICS --}}
|
||||
<div class="col-12 col-md-6 mb-3">
|
||||
<fieldset class="h-100 border p-3">
|
||||
<legend>{{ Str::ucfirst(__('validation.custom.analytics')) }}</legend>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
@include('back::partials.inputs.int-number', [
|
||||
'id' => 'settingsanalytics',
|
||||
'label' => Str::ucfirst(__('Site ID')),
|
||||
'name' => 'analytics',
|
||||
'required' => false,
|
||||
'model' => $settingsModel ?? null,
|
||||
'helper' => __('Insérer ici l\'id du site pour Matomo'),
|
||||
'min' => 0,
|
||||
])
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue