From 4113e2254a51e73a8fe1e761a8cfb914bd68dce1 Mon Sep 17 00:00:00 2001 From: Noah Lancien Date: Thu, 24 Aug 2023 13:00:43 +0200 Subject: [PATCH] Some fixes, docblocks, style, cleaning ... Added a footer --- app/Console/Commands/ExportCodesUniques.php | 3 +- app/Console/Commands/UserCreate.php | 12 +- app/Http/Controllers/Bo/CodesController.php | 12 +- .../Controllers/Bo/CodesEANController.php | 159 ------- app/Http/Controllers/Bo/ContentController.php | 9 +- .../Controllers/Bo/DashboardController.php | 16 +- .../Controllers/Bo/FaqThemesController.php | 9 +- .../Controllers/Bo/InstantWinController.php | 2 +- app/Http/Controllers/EnterCodeController.php | 2 +- .../Bo/CodesEan/StoreCodeEanRequest.php | 49 --- .../Bo/CodesEan/UpdateCodeEanRequest.php | 23 - app/Http/Requests/ParticipateRequest.php | 11 +- app/Models/BannedIp.php | 5 + app/Models/Code.php | 20 +- app/Models/CodeEan.php | 31 -- app/Models/Content.php | 8 + app/Models/Customer.php | 27 ++ app/Models/FaqQuestion.php | 10 + app/Models/FaqTheme.php | 11 + app/Models/GainView.php | 17 +- app/Models/InstantWin.php | 9 + app/Models/Participation.php | 37 +- app/Models/Prize.php | 35 +- app/Models/Product.php | 27 ++ app/Models/Range.php | 14 + app/Models/Reduction.php | 11 + app/Models/Settings.php | 27 ++ app/Models/User.php | 30 +- config/google.php | 5 - .../2014_10_12_000000_create_users_table.php | 3 - .../2020_10_20_171937_create_code_eans.php | 33 -- ...23_08_22_091935_create_participations.php} | 2 +- ...2023_08_22_120243_create_instant_wins.php} | 0 database/seeders/SettingsSeeder.php | 1 - resources/lang/fr/models.php | 1 - resources/sass/bo/base/_common.scss | 4 + resources/views/bo/layout.blade.php | 5 +- resources/views/bo/layouts/footer.blade.php | 8 + resources/views/bo/layouts/nav-menu.blade.php | 78 ++-- .../views/bo/modules/search-bar.blade.php | 2 +- .../views/bo/pages/codes-ean/create.blade.php | 46 -- .../views/bo/pages/codes-ean/edit.blade.php | 62 --- .../bo/pages/codes-ean/form-inputs.blade.php | 76 ---- .../views/bo/pages/codes-ean/index.blade.php | 66 --- .../bo/{ => pages}/dashboard/index.blade.php | 2 +- .../{ => pages}/instant-win/index.blade.php | 0 .../views/bo/pages/prizes/index.blade.php | 6 +- .../bo/pages/ranges/form-inputs.blade.php | 1 - .../views/bo/pages/settings/manage.blade.php | 350 --------------- .../bo/pages/winners-list/index.blade.php | 4 +- resources/views/bo/products/create.blade.php | 27 -- resources/views/bo/products/edit.blade.php | 30 -- resources/views/bo/products/index.blade.php | 66 --- .../views/bo/products/input-forms.blade.php | 38 -- resources/views/bo/ranges/create.blade.php | 27 -- resources/views/bo/ranges/edit.blade.php | 30 -- resources/views/bo/ranges/index.blade.php | 52 --- .../views/bo/ranges/input-forms.blade.php | 15 - resources/views/bo/settings/manage.blade.php | 401 ------------------ .../breadcrumbs/breadcrumb-body.blade.php | 4 +- .../breadcrumbs/breadcrumb-head.blade.php | 9 +- .../breadcrumbs/breadcrumb-layout.blade.php | 30 +- .../views/front/basic_example/gain1.blade.php | 2 +- .../notif-win-admin-email.blade.php | 4 +- resources/views/re7.blade.php | 2 +- routes/breadcrumbs-bo.php | 14 - routes/web-bo.php | 5 - routes/web-fo.php | 3 +- 68 files changed, 382 insertions(+), 1758 deletions(-) delete mode 100644 app/Http/Controllers/Bo/CodesEANController.php delete mode 100644 app/Http/Requests/Bo/CodesEan/StoreCodeEanRequest.php delete mode 100644 app/Http/Requests/Bo/CodesEan/UpdateCodeEanRequest.php delete mode 100644 app/Models/CodeEan.php delete mode 100644 config/google.php delete mode 100644 database/migrations/2020_10_20_171937_create_code_eans.php rename database/migrations/{2020_10_28_091935_create_participations.php => 2023_08_22_091935_create_participations.php} (92%) rename database/migrations/{2020_10_29_120243_create_instant_wins.php => 2023_08_22_120243_create_instant_wins.php} (100%) create mode 100644 resources/views/bo/layouts/footer.blade.php delete mode 100644 resources/views/bo/pages/codes-ean/create.blade.php delete mode 100644 resources/views/bo/pages/codes-ean/edit.blade.php delete mode 100644 resources/views/bo/pages/codes-ean/form-inputs.blade.php delete mode 100644 resources/views/bo/pages/codes-ean/index.blade.php rename resources/views/bo/{ => pages}/dashboard/index.blade.php (95%) rename resources/views/bo/{ => pages}/instant-win/index.blade.php (100%) delete mode 100644 resources/views/bo/pages/settings/manage.blade.php delete mode 100644 resources/views/bo/products/create.blade.php delete mode 100644 resources/views/bo/products/edit.blade.php delete mode 100644 resources/views/bo/products/index.blade.php delete mode 100644 resources/views/bo/products/input-forms.blade.php delete mode 100644 resources/views/bo/ranges/create.blade.php delete mode 100644 resources/views/bo/ranges/edit.blade.php delete mode 100644 resources/views/bo/ranges/index.blade.php delete mode 100644 resources/views/bo/ranges/input-forms.blade.php delete mode 100644 resources/views/bo/settings/manage.blade.php diff --git a/app/Console/Commands/ExportCodesUniques.php b/app/Console/Commands/ExportCodesUniques.php index b9024b5..bb4056d 100644 --- a/app/Console/Commands/ExportCodesUniques.php +++ b/app/Console/Commands/ExportCodesUniques.php @@ -4,7 +4,6 @@ namespace App\Console\Commands; use App\Mail\ExportCodesUniques as MailExportCodesUniques; use App\Models\Code; -use App\Models\Settings; use Illuminate\Console\Command; use Illuminate\Support\Facades\Mail; @@ -109,7 +108,7 @@ class ExportCodesUniques extends Command // Envoi de mail à MAIL_ADMIN avec le nom du ZIP "CodesUniques_". date('dmY') .".zip" . Mail::to(config('mail.MAIL_ADMIN')) - ->send(new MailExportCodesUniques(app(Settings::class)->name, $nbCodeFic, $nbCodeTot, $nbCodeLigne)); + ->send(new MailExportCodesUniques($nbCodeFic, $nbCodeTot, $nbCodeLigne)); return 0; } diff --git a/app/Console/Commands/UserCreate.php b/app/Console/Commands/UserCreate.php index ce74442..b14d954 100644 --- a/app/Console/Commands/UserCreate.php +++ b/app/Console/Commands/UserCreate.php @@ -200,16 +200,16 @@ class UserCreate extends Command try { $tmp = $this->choice( 'Select his role', - [RoleEnum::conceptor()->label, RoleEnum::admin()->label], - RoleEnum::admin()->label, + [RoleEnum::conceptor->label(), RoleEnum::admin->label()], + RoleEnum::admin->label(), $maxAttempts = null, $allowMultipleSelections = false ); - if ($tmp === RoleEnum::conceptor()->label) { - $tmp = RoleEnum::conceptor(); + if ($tmp === RoleEnum::conceptor->label()) { + $tmp = RoleEnum::conceptor; } - if ($tmp === RoleEnum::admin()->label) { - $tmp = RoleEnum::admin(); + if ($tmp === RoleEnum::admin->label()) { + $tmp = RoleEnum::admin; } $validator = Validator::make(['role' => $tmp], [ 'role' => 'required' diff --git a/app/Http/Controllers/Bo/CodesController.php b/app/Http/Controllers/Bo/CodesController.php index a0c8608..1a2a4b7 100644 --- a/app/Http/Controllers/Bo/CodesController.php +++ b/app/Http/Controllers/Bo/CodesController.php @@ -17,9 +17,9 @@ class CodesController extends Controller /** * Show code form to generate and export * - * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory + * @return \Illuminate\Contracts\View\View */ - public function index() + public function index(): \Illuminate\Contracts\View\View { $settings = Settings::first(); $nbCodeBase = Code::count(); @@ -41,7 +41,7 @@ class CodesController extends Controller * @param GenerateCodesRequest $request * @return \Illuminate\Http\RedirectResponse */ - public function generate(GenerateCodesRequest $request) + public function generate(GenerateCodesRequest $request): \Illuminate\Http\RedirectResponse { ProcessUniqueCode::dispatch( $request->quantity, @@ -61,7 +61,7 @@ class CodesController extends Controller * @param ExportCodesRequest $request * @return \Illuminate\Http\RedirectResponse */ - public function export(ExportCodesRequest $request) + public function export(ExportCodesRequest $request): \Illuminate\Http\RedirectResponse { ProcessExportCodesUniques::dispatch( intval($request->nb_code_fic), @@ -80,9 +80,9 @@ class CodesController extends Controller * Search for a specific code. * * @param CodeSearchRequest $request - * @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory + * @return \Illuminate\Contracts\View\View */ - public function search(CodeSearchRequest $request) + public function search(CodeSearchRequest $request): \Illuminate\Contracts\View\View { $code = null; try { diff --git a/app/Http/Controllers/Bo/CodesEANController.php b/app/Http/Controllers/Bo/CodesEANController.php deleted file mode 100644 index 11c14cd..0000000 --- a/app/Http/Controllers/Bo/CodesEANController.php +++ /dev/null @@ -1,159 +0,0 @@ -search; - if ($search) { - $this->searchQuery( - $codeEanModels, - $search, - null, - 'code', - 'product' - ); - } - $searchFields = \sprintf( - '%s, %s', - Str::ucfirst(__('validation.attributes.code')), - Str::ucfirst(__('validation.attributes.product')) - ); - - /** Sort columns with a query */ - $this->sortQuery($codeEanModels); - - /** Custom pagination */ - $codeEanModels = $this->customPaginate($codeEanModels, $request->pagination); - - return view('bo.pages.codes-ean.index', compact('codeEanModels', 'search', 'searchFields')); - } - - /** - * Show the form for creating a new resource. - * - * @param \App\Models\CodeEan $codeEan - * @return \Illuminate\Contracts\View\View - */ - public function create(CodeEan $codeEan): \Illuminate\Contracts\View\View - { - return view('bo.pages.codes-ean.create', [ - 'codeEanModel' => $codeEan, - ]); - } - - /** - * Store a newly created resource in storage. - * - * @param \App\Http\Requests\Bo\CodesEan\StoreCodeEanRequest $request - * @return \Illuminate\Http\RedirectResponse - */ - public function store(StoreCodeEanRequest $request): \Illuminate\Http\RedirectResponse - { - return DB::transaction(function () use ($request) { - $codeEan = new CodeEan(); - $codeEan->fill($request->validated()); - if ($codeEan->saveOrFail()) { - return redirect() - ->route('bo.code-eans.edit', $codeEan) - ->with('success', trans( - 'crud.messages.has_been_created', - ['model' => \trans_choice('models.classes.codes-ean', 1)] - )); - } - return redirect() - ->back() - ->with('error', trans( - 'crud.messages.cannot_be_created', - ['model' => \trans_choice('models.classes.codes-ean', 1)] - )); - }); - } - - /** - * Show the form for editing the specified resource. - * - * @param \App\Models\CodeEan $codeEan - * @return \Illuminate\Contracts\View\View - */ - public function edit(CodeEan $codeEan): \Illuminate\Contracts\View\View - { - return view('bo.pages.codes-ean.edit', [ - 'codeEanModel' => $codeEan, - ]); - } - - /** - * Update the specified resource in storage. - * - * @param \App\Http\Requests\Bo\CodesEan\UpdateCodeEanRequest $request - * @param \App\Models\CodeEan $codeEan - * @return \Illuminate\Http\RedirectResponse - */ - public function update(UpdateCodeEanRequest $request, CodeEan $codeEan): \Illuminate\Http\RedirectResponse - { - return DB::transaction(function () use ($request, $codeEan) { - $codeEan->fill($request->validated()); - if ($codeEan->saveOrFail()) { - return redirect() - ->route('bo.code-eans.edit', $codeEan) - ->with('success', trans( - 'crud.messages.has_been_updated', - ['model' => trans_choice('models.classes.codes-ean', 1)] - )); - } - return redirect() - ->back() - ->with('error', trans( - 'crud.messages.cannot_be_updated', - ['model' => trans_choice('models.classes.codes-ean', 1)] - )); - }); - } - - /** - * Remove the specified resource from storage. - * - * @param \App\Models\CodeEan $codeEan - * @return \Illuminate\Http\RedirectResponse - */ - public function destroy(CodeEan $codeEan): \Illuminate\Http\RedirectResponse - { - return DB::transaction(function () use ($codeEan) { - if ($codeEan->deleteOrFail()) { - return redirect() - ->route('bo.code-eans.index') - ->with('success', __( - 'crud.messages.has_been_deleted', - ['model' => trans_choice('models.classes.codes-ean', 1)] - )); - } - return redirect() - ->back() - ->with('error', __( - ':crud.messages.cannot_be_deleted', - ['model' => trans_choice('models.classes.codes-ean', 1)] - )); - }); - } -} diff --git a/app/Http/Controllers/Bo/ContentController.php b/app/Http/Controllers/Bo/ContentController.php index 4f1c03e..1453ffd 100644 --- a/app/Http/Controllers/Bo/ContentController.php +++ b/app/Http/Controllers/Bo/ContentController.php @@ -29,10 +29,15 @@ class ContentController extends Controller $contentModels, $search, null, - 'ip', + 'key', + 'value' ); } - $searchFields = trans('validation.attributes.ip'); + $searchFields = \sprintf( + '%s, %s', + trans('validation.attributes.name'), + trans('validation.attributes.value'), + ); /** Sort columns with a query */ $this->sortQuery($contentModels); diff --git a/app/Http/Controllers/Bo/DashboardController.php b/app/Http/Controllers/Bo/DashboardController.php index c68c025..bd40941 100644 --- a/app/Http/Controllers/Bo/DashboardController.php +++ b/app/Http/Controllers/Bo/DashboardController.php @@ -15,20 +15,20 @@ class DashboardController extends Controller * * @return \Illuminate\Contracts\View\View */ - public function index() + public function index(): \Illuminate\Contracts\View\View { // Pour les stats. $settings = app(Settings::class); $participations = Participation::selectRaw("COUNT(*) AS count, DATE(created_at) AS date") ->groupByRaw("DATE(created_at)")->get(); - $participationsUniquePerDay = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count, DATE(created_at) AS date") + $participationsUniquePerDay = Participation::selectRaw("DISTINCT customer_id AS user, COUNT(*) AS count, DATE(created_at) AS date") ->groupByRaw("DATE(created_at), user")->get(); $statsUnique = []; foreach ($participationsUniquePerDay as $participationPerDay) { - $dateUnique = $participationPerDay->date->format('d/m/Y'); + $dateUnique = Carbon::parse($participationPerDay->date)->format('d/m/Y'); $statsUnique[$dateUnique] = isset($statsUnique[$dateUnique]) ? $statsUnique[$dateUnique] + 1 : 1; } - $participationsUnique = Participation::selectRaw("DISTINCT user_id AS user, COUNT(*) AS count") + $participationsUnique = Participation::selectRaw("DISTINCT customer_id AS user, COUNT(*) AS count") ->groupBy("user")->orderBy("user")->get(); // Données calculées à afficher. @@ -41,7 +41,7 @@ class DashboardController extends Controller // Tableau des dates comprises dans la table participation. foreach ($participations as $participation) { - $datesParticipations[$participation->date->format('d/m/Y')] = $participation->count; + $datesParticipations[Carbon::parse($participation->date)->format('d/m/Y')] = $participation->count; } // Création des tableaux avec toutes les dates depuis le début du jeu et le nombre de participations associées. @@ -50,8 +50,8 @@ class DashboardController extends Controller // Récupération des 3 codes EAN les plus utilisés. $codesEan = Participation::select( - DB::raw('COUNT(code_ean_id) AS nb_usage, code_ean_id') - )->groupBy('code_ean_id')->orderByDesc('nb_usage')->limit(3)->get(); + DB::raw('COUNT(product_id) AS nb_usage, product_id') + )->groupBy('product_id')->orderByDesc('nb_usage')->limit(3)->get(); // TODO : Carbon Interval. @@ -67,7 +67,7 @@ class DashboardController extends Controller $date->addDay(); } - return view('bo.dashboard.index', compact( + return view('bo.pages.dashboard.index', compact( 'dates', 'count', 'countUnique', diff --git a/app/Http/Controllers/Bo/FaqThemesController.php b/app/Http/Controllers/Bo/FaqThemesController.php index 162f9f0..8c9da64 100644 --- a/app/Http/Controllers/Bo/FaqThemesController.php +++ b/app/Http/Controllers/Bo/FaqThemesController.php @@ -30,15 +30,10 @@ class FaqThemesController extends Controller $faqThemeModels, $search, null, - 'question', - 'answer' + 'name', ); } - $searchFields = \sprintf( - '%s, %s ...', - Str::ucfirst(__('validation.attributes.question')), - __('validation.attributes.answer'), - ); + $searchFields = Str::ucfirst(__('validation.attributes.name')); /** Sort columns with a query */ $this->sortQuery($faqThemeModels); diff --git a/app/Http/Controllers/Bo/InstantWinController.php b/app/Http/Controllers/Bo/InstantWinController.php index c77f986..361a7dc 100644 --- a/app/Http/Controllers/Bo/InstantWinController.php +++ b/app/Http/Controllers/Bo/InstantWinController.php @@ -32,7 +32,7 @@ class InstantWinController extends Controller $instantWin = InstantWin::orderBy('appear_date')->get(); - return view('bo.instant-win.index', [ + return view('bo.pages.instant-win.index', [ 'can_generate' => $canGenerate, 'instant_win' => $instantWin ]); diff --git a/app/Http/Controllers/EnterCodeController.php b/app/Http/Controllers/EnterCodeController.php index 4567845..fe5f0d0 100644 --- a/app/Http/Controllers/EnterCodeController.php +++ b/app/Http/Controllers/EnterCodeController.php @@ -178,7 +178,7 @@ class EnterCodeController extends Controller Mail::to($mail->email)->send(new NotifWinAdmin($settings, $participation)); } $participation->save(); - return view("front.basic." . $instantWin->prize->gain_view->file_name, compact('settings')) + return view("front.basic." . $instantWin->prize->gainView->file_name, compact('settings')) ->with('prize', $instantWin->prize); } diff --git a/app/Http/Requests/Bo/CodesEan/StoreCodeEanRequest.php b/app/Http/Requests/Bo/CodesEan/StoreCodeEanRequest.php deleted file mode 100644 index c34e88d..0000000 --- a/app/Http/Requests/Bo/CodesEan/StoreCodeEanRequest.php +++ /dev/null @@ -1,49 +0,0 @@ -check(); - } - - /** - * Get the validation rules that apply to the request. - * - * @return array - */ - public function rules() - { - return [ - 'code' => [ - 'required', - 'numeric', - 'unique:code_eans,code', - 'regex:/^[0-9]{7}$|^[0-9]{8}$|^[0-9]{13}$/', - ], - 'product' => 'required|string|min:3|max:255', - ]; - } - - /** - * Get custom attributes for validator errors. - * - * @return array - */ - public function attributes(): array - { - return [ - 'code' => trans('Code EAN'), - 'product' => trans('Produit'), - ]; - } -} diff --git a/app/Http/Requests/Bo/CodesEan/UpdateCodeEanRequest.php b/app/Http/Requests/Bo/CodesEan/UpdateCodeEanRequest.php deleted file mode 100644 index 7ef29d4..0000000 --- a/app/Http/Requests/Bo/CodesEan/UpdateCodeEanRequest.php +++ /dev/null @@ -1,23 +0,0 @@ - [ - 'required', - 'numeric', - 'unique:code_eans,code,' . $this->route('code_ean')->id . ',id', - 'regex:/^[0-9]{7}$|^[0-9]{8}$|^[0-9]{13}$/', - ], - ]); - } -} diff --git a/app/Http/Requests/ParticipateRequest.php b/app/Http/Requests/ParticipateRequest.php index d65a3c1..e9d24b3 100644 --- a/app/Http/Requests/ParticipateRequest.php +++ b/app/Http/Requests/ParticipateRequest.php @@ -5,6 +5,7 @@ namespace App\Http\Requests; use App\Models\Code; use App\Models\CodeEan; use App\Models\Participation; +use App\Models\Product; use App\Models\Settings; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Validator; @@ -50,10 +51,10 @@ class ParticipateRequest extends FormRequest ], $this->attributes()); // * Union pour faire des recherches séparée en une seule requête. - /** @var \App\Models\CodeEan|null */ - $codeEan = CodeEan::where('code', $this->code_ean) - ->union(CodeEan::where('code', Str::limit($this->code_ean, 8, ''))) - ->union(CodeEan::where('code', Str::limit($this->code_ean, 7, ''))) + /** @var \App\Models\Product|null */ + $codeEan = Product::where('code_ean', $this->code_ean) + ->union(Product::where('code_ean', Str::limit($this->code_ean, 8, ''))) + ->union(Product::where('code_ean', Str::limit($this->code_ean, 7, ''))) ->first() ?? false; $this->merge(['code_ean' => $codeEan]); @@ -135,7 +136,7 @@ class ParticipateRequest extends FormRequest 'required', // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed function ($attribute, $value, $fail) { - if (!\is_object($value) or \get_class($value) !== CodeEan::class) { + if (!\is_object($value) or \get_class($value) !== Product::class) { $fail('Le code barre entré est incorrect, veuillez réessayer.'); } } diff --git a/app/Models/BannedIp.php b/app/Models/BannedIp.php index 150b0a3..7bf6e05 100644 --- a/app/Models/BannedIp.php +++ b/app/Models/BannedIp.php @@ -4,6 +4,11 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * BannedIp. + * + * @property integer $ip IP. + */ class BannedIp extends Model { /** diff --git a/app/Models/Code.php b/app/Models/Code.php index 4f79b45..deb2a58 100644 --- a/app/Models/Code.php +++ b/app/Models/Code.php @@ -5,6 +5,21 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; use Kwaadpepper\Serial\SerialCaster; +/** + * Code. + * + * @property boolean $code_used Is the code used ? + * @property boolean $code_exported Is the code exported ? + * @property \Illuminate\Support\Carbon $date_creation Date of creation. + * + * @property-read string|null $code_unique The unique code + * + * @method public static function intToSerial($int) Generate a serial from an int. + * @method public static function serialToInt($serial) Get an int from a serial. + * + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations + * Associated participations. + */ class Code extends Model { /** @@ -13,7 +28,8 @@ class Code extends Model * @var array */ protected $fillable = [ - 'code_used', 'code_exported', + 'code_used', + 'code_exported', 'date_creation' ]; @@ -68,7 +84,7 @@ class Code extends Model } /** - * Generate a serial from an int. + * Get an int from a serial. * * @param string $serial * @return integer The ID represented diff --git a/app/Models/CodeEan.php b/app/Models/CodeEan.php deleted file mode 100644 index dc07b29..0000000 --- a/app/Models/CodeEan.php +++ /dev/null @@ -1,31 +0,0 @@ -hasMany(Participation::class); - } -} diff --git a/app/Models/Content.php b/app/Models/Content.php index 38d1cf1..05074e7 100644 --- a/app/Models/Content.php +++ b/app/Models/Content.php @@ -4,6 +4,14 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * Content. + * + * @property-read string $key Content key. + * @property string $value Content text + * @property-read \Illuminate\Support\Carbon $created_at Created date. + * @property-read \Illuminate\Support\Carbon $updated_at Updated date. + */ class Content extends Model { /** diff --git a/app/Models/Customer.php b/app/Models/Customer.php index d338ca5..974aebd 100644 --- a/app/Models/Customer.php +++ b/app/Models/Customer.php @@ -6,6 +6,33 @@ use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\Hash; +/** + * Customer. + * + * @property integer $crm_id CRM ID + * @property string $firstname Firstname + * @property string $lastname Lastname + * @property \Illuminate\Support\Carbon $birth_date Birth date. + * @property string $email Email + * @property string $password Password + * @property string $address Address + * @property string $address2 Second address + * @property string $town Town + * @property string $postal_code Postal code + * @property string $country Country + * @property string $phone Phone number + * @property-read string $email_verify_token Token for email verification + * @property-read boolean $email_verified Is the email verified ? + * @property-read string $password_token Password token + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @method protected static function booted() The "booted" method of the model. + * @method private static function updatePassword($model) Update the password if needed. + * + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations + * Associated participations. + */ class Customer extends Authenticatable { use Notifiable; diff --git a/app/Models/FaqQuestion.php b/app/Models/FaqQuestion.php index 592fc68..901d326 100644 --- a/app/Models/FaqQuestion.php +++ b/app/Models/FaqQuestion.php @@ -4,6 +4,16 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * FaqQuestion. + * + * @property string $question Question + * @property string $answer Answer + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @property-read \App\Models\FaqTheme $theme Associated theme. + */ class FaqQuestion extends Model { /** diff --git a/app/Models/FaqTheme.php b/app/Models/FaqTheme.php index 176ec57..9c6fe19 100644 --- a/app/Models/FaqTheme.php +++ b/app/Models/FaqTheme.php @@ -4,6 +4,17 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * FaqTheme. + * + * @property string $question Question + * @property string $answer Answer + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\FaqQuestion[] $questions + * Associated questions. + */ class FaqTheme extends Model { /** diff --git a/app/Models/GainView.php b/app/Models/GainView.php index 3e8600d..31e5fae 100644 --- a/app/Models/GainView.php +++ b/app/Models/GainView.php @@ -4,6 +4,17 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * GainView. + * + * @property string $name Name + * @property string $file_name Name of the view file. + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Prizes[] $prizes + * Associated prizes. + */ class GainView extends Model { /** @@ -11,10 +22,14 @@ class GainView extends Model * * @var array */ - protected $fillable = ['name', 'file_name']; + protected $fillable = [ + 'name', + 'file_name' + ]; /** * Prize relation + * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function prizes() diff --git a/app/Models/InstantWin.php b/app/Models/InstantWin.php index 4c58117..2435abf 100644 --- a/app/Models/InstantWin.php +++ b/app/Models/InstantWin.php @@ -4,6 +4,15 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * InstantWin. + * + * @property-read \Illuminate\Support\Carbon $appear_date Appear date + * @property-read boolean $won Is the prize won ? + * + * @property-read \App\Models\Prizes $prize Associated prize. + * @property-read \App\Models\Participation $participation Associated participation. + */ class InstantWin extends Model { /** diff --git a/app/Models/Participation.php b/app/Models/Participation.php index 074a1b2..bb98746 100644 --- a/app/Models/Participation.php +++ b/app/Models/Participation.php @@ -2,8 +2,27 @@ namespace App\Models; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Model; +/** + * Participation. + * + * @property string $ip IP + * @property string $sticker Path of the sticker file + * @property string $ticket Path of the ticket file + * @property string $barcode Path of the barcode file + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @property-read string|null $code_ean Accessor for code_ean, from product table. + * + * @property-read \App\Models\Customer $customer Associated customer. + * @property-read \App\Models\Code $code Associated code. + * @property-read \App\Models\Product $product Associated product. + * @property-read \App\Models\InstantWin $instantWin Associated instantWin. + * @property-read \App\Models\Reduction $reduction Associated reduction. + */ class Participation extends Model { /** @@ -11,7 +30,7 @@ class Participation extends Model * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function user() + public function customer() { return $this->belongsTo(Customer::class); } @@ -27,13 +46,13 @@ class Participation extends Model } /** - * BelongsTo CodesEAN relation + * BelongsTo Product relation * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ - public function codeEan() + public function product() { - return $this->belongsTo(CodeEan::class); + return $this->belongsTo(Product::class); } /** @@ -57,12 +76,14 @@ class Participation extends Model } /** - * ean_code_value accessor + * Accessor for code_ean, from product table. * - * @return integer|null + * @return \Illuminate\Database\Eloquent\Casts\Attribute; */ - public function getCodeEanValueAttribute() + public function codeEan(): Attribute { - return optional($this->codeEan)->code; + return Attribute::make( + get: fn () => optional($this->product)->code_ean, + ); } } diff --git a/app/Models/Prize.php b/app/Models/Prize.php index 1f5c52b..8965904 100644 --- a/app/Models/Prize.php +++ b/app/Models/Prize.php @@ -5,6 +5,27 @@ namespace App\Models; use App\Lib\Helpers\FileStorageHelper; use Illuminate\Database\Eloquent\Model; +/** + * Prize. + * + * @property string $label_one Singular label + * @property string $label_many Plural label + * @property string $arg_title Description title + * @property string $arg_subtitle Description subtitle + * @property string $arg_content Description content + * @property integer $quantity Quantity + * @property string $pdf_winning_proof Path of the winning proof file + * @property boolean $need_proof Does the prize need a winning proof ? + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @method protected static function booted() The "booted" method of the model. + * @method private static function manageFields($model) Manage model fields. + * + * @property-read \App\Models\GainView[] $gainView Associated gainViews. + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\InstantWin[] $instantWins + * Associated instantWins. + */ class Prize extends Model { /** @@ -58,12 +79,22 @@ class Prize extends Model $model->pdf_winning_proof = FileStorageHelper::storeFile($model, $model->pdf_winning_proof, true); } - public function gain_view() + /** + * BelongsTo GainView relation + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function gainView() { return $this->belongsTo(GainView::class, 'gain_view_id'); } - public function instant_wins() + /** + * HasMany InstantWin relation + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function instantWins() { return $this->hasMany(InstantWin::class, 'prize_id'); } diff --git a/app/Models/Product.php b/app/Models/Product.php index e0a7d92..0b5d1d5 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -5,6 +5,23 @@ namespace App\Models; use App\Lib\Helpers\FileStorageHelper; use Illuminate\Database\Eloquent\Model; +/** + * Product. + * + * @property string $name Name + * @property integer $no_art Number of this article + * @property string $picture Path of the picture + * @property integer $code_ean Ean code + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @method protected static function booted() The "booted" method of the model. + * @method private static function manageFields($model) Manage model fields. + * + * @property-read \App\Models\Range[] $range Associated range. + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Participation[] $participations + * Associated participations. + */ class Product extends Model { /** @@ -65,4 +82,14 @@ class Product extends Model { return $this->belongsTo(Range::class); } + + /** + * Participations relation + * + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function participations() + { + return $this->hasMany(Participation::class); + } } diff --git a/app/Models/Range.php b/app/Models/Range.php index 6392e4f..8716f31 100644 --- a/app/Models/Range.php +++ b/app/Models/Range.php @@ -5,6 +5,20 @@ namespace App\Models; use App\Lib\Helpers\FileStorageHelper; use Illuminate\Database\Eloquent\Model; +/** + * Range. + * + * @property string $name Name + * @property string $picture Path of the picture + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @method protected static function booted() The "booted" method of the model. + * @method private static function manageFields($model) Manage model fields. + * + * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Product[] $products + * Associated products. + */ class Range extends Model { /** diff --git a/app/Models/Reduction.php b/app/Models/Reduction.php index 7323441..7f009e9 100644 --- a/app/Models/Reduction.php +++ b/app/Models/Reduction.php @@ -4,6 +4,17 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * Reduction. + * + * @property string $link Link + * @property string $basket_id Basket id + * @property string $verification Verification + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @property-read \App\Models\Participation $participation Associated participation. + */ class Reduction extends Model { /** diff --git a/app/Models/Settings.php b/app/Models/Settings.php index de0e8bd..64f15b1 100644 --- a/app/Models/Settings.php +++ b/app/Models/Settings.php @@ -4,6 +4,33 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; +/** + * Settings. + * + * @property integer $name Name + * @property \Illuminate\Support\Carbon $start_date Start date of the game + * @property \Illuminate\Support\Carbon $end_date End date of the game + * @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 \Illuminate\Support\Carbon $teaser_end_activity End date of the teaser + * @property boolean $activated_close_page Is the close page active ? + * @property \Illuminate\Support\Carbon $close_page_active_date End date of the close page + * @property string $redirect_close Link to redirect when the game is ended + * @property boolean $reductions_activated Are the reductions active ? + * @property string $reductions_site Reduction site + * @property string $reductions_campaign Reduction campaign + * @property string $web_coupons Array of web coupons + * @property string $notification_emails Array of email to notify when there's a winnner + * @property boolean $winning_proof Is the winning proof needed + * @property string $company Name of the company + * @property string $analytics Matomo siteId + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + */ class Settings extends Model { /** diff --git a/app/Models/User.php b/app/Models/User.php index a4c8761..8684263 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -8,6 +8,22 @@ use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\Hash; +/** + * User. + * + * @property string $firstname Firstname + * @property string $lastname Lastname + * @property string $email Email + * @property-read \Illuminate\Support\Carbon $email_verified_at Date of email verification. + * @property string $password Password + * @property-read string $remember_token Remember token + * @property \App\Enums\Users\RoleEnum $role Role of the user + * @property-read \Illuminate\Support\Carbon $created_at Creation Date. + * @property-read \Illuminate\Support\Carbon $updated_at Last update Date. + * + * @method protected static function booted() The "booted" method of the model. + * @method private static function updatePassword($model) Update the password if needed. + */ class User extends Authenticatable { use HasFactory; @@ -24,9 +40,6 @@ class User extends Authenticatable 'email', 'password', 'role', - 'published', - 'published_at', - 'order', ]; /** @@ -68,17 +81,6 @@ class User extends Authenticatable // * METHODS - /** - * Set order after the last element of the list. - * - * @param self $model - * @return void - */ - private static function setOrder(self $model): void - { - $model->order = \intval(self::query()->max('order')) + 1; - } - /** * Update password. * diff --git a/config/google.php b/config/google.php deleted file mode 100644 index 7575aec..0000000 --- a/config/google.php +++ /dev/null @@ -1,5 +0,0 @@ - env('ANALYTICS_GOOGLE_ID') -]; diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index 8222263..e3d921b 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -22,9 +22,6 @@ return new class extends Migration $table->string('password')->comment('Password of the user account.'); $table->rememberToken(); $table->boolean('role')->comment('Role of the user who defines the rights/access.'); - $table->boolean('published')->comment('The user is published or not.'); - $table->timestamp('published_at')->nullable()->comment('The date on which the user was published.'); - $table->integer('order')->comment('Order of this user.'); $table->timestamps(); }); } diff --git a/database/migrations/2020_10_20_171937_create_code_eans.php b/database/migrations/2020_10_20_171937_create_code_eans.php deleted file mode 100644 index 0890e95..0000000 --- a/database/migrations/2020_10_20_171937_create_code_eans.php +++ /dev/null @@ -1,33 +0,0 @@ -id(); - $table->unsignedBigInteger('code'); - $table->string('product'); - $table->unique('code'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::dropIfExists('code_eans'); - } -} diff --git a/database/migrations/2020_10_28_091935_create_participations.php b/database/migrations/2023_08_22_091935_create_participations.php similarity index 92% rename from database/migrations/2020_10_28_091935_create_participations.php rename to database/migrations/2023_08_22_091935_create_participations.php index fd83496..8f8ba16 100644 --- a/database/migrations/2020_10_28_091935_create_participations.php +++ b/database/migrations/2023_08_22_091935_create_participations.php @@ -21,7 +21,7 @@ class CreateParticipations extends Migration $table->string('barcode')->nullable(); $table->foreignId('customer_id')->constrained('customers'); $table->foreignId('code_unique_id')->constrained('codes'); - $table->foreignId('code_ean_id')->nullable()->constrained('code_eans'); + $table->foreignId('product_id')->nullable()->constrained('products'); $table->foreignId('reduction_id')->nullable()->constrained('reductions'); $table->timestamps(); }); diff --git a/database/migrations/2020_10_29_120243_create_instant_wins.php b/database/migrations/2023_08_22_120243_create_instant_wins.php similarity index 100% rename from database/migrations/2020_10_29_120243_create_instant_wins.php rename to database/migrations/2023_08_22_120243_create_instant_wins.php diff --git a/database/seeders/SettingsSeeder.php b/database/seeders/SettingsSeeder.php index 420f9f6..4d0fb44 100644 --- a/database/seeders/SettingsSeeder.php +++ b/database/seeders/SettingsSeeder.php @@ -27,7 +27,6 @@ class SettingsSeeder extends Seeder $settings->activated_close_page = false; $settings->redirect_close = "https://example.test"; $settings->reductions_activated = false; - $settings->facebook_activated = false; $settings->notification_emails = "[]"; $settings->winning_proof = 0; $settings->company = "Société"; diff --git a/resources/lang/fr/models.php b/resources/lang/fr/models.php index b91d01b..3d01b35 100644 --- a/resources/lang/fr/models.php +++ b/resources/lang/fr/models.php @@ -3,7 +3,6 @@ return [ 'classes' => [ 'bannedips' => 'IP bannies', - 'codes-ean' => 'Code EAN|Codes EAN', 'contents' => 'Contenus', 'faq-questions' => 'Question pour la FAQ|Questions pour la FAQ', 'faq-themes' => 'Thème pour la FAQ|Thèmes pour la FAQ', diff --git a/resources/sass/bo/base/_common.scss b/resources/sass/bo/base/_common.scss index c481a71..659127d 100644 --- a/resources/sass/bo/base/_common.scss +++ b/resources/sass/bo/base/_common.scss @@ -113,3 +113,7 @@ font-size: large; text-align: center; } + +.btn-md { + height: 38px; +} diff --git a/resources/views/bo/layout.blade.php b/resources/views/bo/layout.blade.php index c3d8ab9..aa66d98 100644 --- a/resources/views/bo/layout.blade.php +++ b/resources/views/bo/layout.blade.php @@ -5,7 +5,7 @@ @include('bo.layouts.head') - + -
+
@include('modules.flash-messages') @@ -67,6 +67,7 @@
+ @include('bo.layouts.footer') @stack('scripts-constants') @include('modules.script-constants') @vite(['resources/ts/bo.ts']) diff --git a/resources/views/bo/layouts/footer.blade.php b/resources/views/bo/layouts/footer.blade.php new file mode 100644 index 0000000..34e895d --- /dev/null +++ b/resources/views/bo/layouts/footer.blade.php @@ -0,0 +1,8 @@ +
+
+ {{ $name }} - {{ $version }} + - + UWIL + © {{ date('Y') }} +
+
diff --git a/resources/views/bo/layouts/nav-menu.blade.php b/resources/views/bo/layouts/nav-menu.blade.php index d07c47b..6f73fd0 100644 --- a/resources/views/bo/layouts/nav-menu.blade.php +++ b/resources/views/bo/layouts/nav-menu.blade.php @@ -17,6 +17,26 @@ {{ __('models.classes.settings') }}
+ @endsuperadmin - - @superadmin - - @endsuperadmin @endauth diff --git a/resources/views/bo/modules/search-bar.blade.php b/resources/views/bo/modules/search-bar.blade.php index 1717cb7..8cb21e1 100644 --- a/resources/views/bo/modules/search-bar.blade.php +++ b/resources/views/bo/modules/search-bar.blade.php @@ -8,7 +8,7 @@ $iArgs['search'] = request()->sort_way; } @endphp -
+
diff --git a/resources/views/bo/pages/codes-ean/create.blade.php b/resources/views/bo/pages/codes-ean/create.blade.php deleted file mode 100644 index 627f07b..0000000 --- a/resources/views/bo/pages/codes-ean/create.blade.php +++ /dev/null @@ -1,46 +0,0 @@ -@extends('bo.layout', ['brParam' => $codeEanModel]) - -@section('title', __('Création d\'une :model', ['model' => trans_choice('models.classes.codes-ean', 1)])) -@section('description', __('Création d\'un tout nouveau :model', ['model' => trans_choice('models.classes.codes-ean', 1)])) -@section('breadcrumb', request()->route()->getName()) - -@section('content') -
-
- - - - @include('breadcrumbs.breadcrumb-body', ['brParam' => $codeEanModel]) -
-
- -
-
- - @csrf - @include('bo.pages.codes-ean.form-inputs') -
-
- -
-
- -@endsection diff --git a/resources/views/bo/pages/codes-ean/edit.blade.php b/resources/views/bo/pages/codes-ean/edit.blade.php deleted file mode 100644 index 5c6b661..0000000 --- a/resources/views/bo/pages/codes-ean/edit.blade.php +++ /dev/null @@ -1,62 +0,0 @@ -@extends('bo.layout', ['brParam' => $codeEanModel]) - -@section('title', __('Édition d\'une :model', ['model' => trans_choice('models.classes.codes-ean', 1)])) -@section('description', __('Édition d\'une :model déjà existante', ['model' => trans_choice('models.classes.codes-ean', 1)])) -@section('breadcrumb', request()->route()->getName()) - -@section('content') -
-
- - - - @include('breadcrumbs.breadcrumb-body', ['brParam' => $codeEanModel]) -
-
-
- @csrf - @method('DELETE') -
- - -
-
-
-
-
- @csrf - @method('PUT') - @include('bo.pages.codes-ean.form-inputs') -
-
- -
-
-
-@endsection diff --git a/resources/views/bo/pages/codes-ean/form-inputs.blade.php b/resources/views/bo/pages/codes-ean/form-inputs.blade.php deleted file mode 100644 index 09673b0..0000000 --- a/resources/views/bo/pages/codes-ean/form-inputs.blade.php +++ /dev/null @@ -1,76 +0,0 @@ -
- {{-- CODE --}} -
-
- {{ Str::ucfirst(__('validation.attributes.code')) }} -
-
- @include('bo.partials.inputs.int-number', [ - 'id' => 'codeEanCode', - 'label' => __(':field', [ - 'field' => Str::ucfirst(__('validation.attributes.code')), - ]), - 'name' => 'code', - 'required' => true, - 'model' => $codeEanModel ?? null, - 'helper' => __('validation.ean', [ - 'attribute' => __(':field', [ - 'field' => Str::ucfirst(__('validation.attributes.code')), - ]), - ]), - 'placeholder' => __(':field', [ - 'field' => Str::ucfirst(__('validation.attributes.code')), - ]), - // Unsigned between 7 and 13 digits - 'min' => 1000000, - 'max' => 9999999999999 - ]) -
-
-
-
- {{-- PRODUCT --}} -
-
- {{ Str::ucfirst(__('validation.attributes.product')) }} -
-
- @include('bo.partials.inputs.varchar', [ - 'id' => 'codeEanProduct', - 'label' => __('Nom du :field', [ - 'field' => Str::ucfirst(__('validation.attributes.product')), - ]), - 'hasWordCounter' => true, - 'name' => 'product', - 'required' => true, - 'model' => $codeEanModel ?? null, - 'helper' => __('validation.between.string', [ - 'attribute' => __('Nom du :field', [ - 'field' => Str::ucfirst(__('validation.attributes.product')), - ]), - 'min' => 3, - 'max' => 255 - ]), - 'placeholder' => __('Nom du :field', [ - 'field' => Str::ucfirst(__('validation.attributes.product')), - ]), - ]) -
-
-
-
-
- -@push('scripts') - -@endpush diff --git a/resources/views/bo/pages/codes-ean/index.blade.php b/resources/views/bo/pages/codes-ean/index.blade.php deleted file mode 100644 index f969478..0000000 --- a/resources/views/bo/pages/codes-ean/index.blade.php +++ /dev/null @@ -1,66 +0,0 @@ -@extends('bo.layout') - -@section('title', trans_choice('models.classes.codes-ean', 2)) -@section('description', __('Liste de toutes les :model', ['model' => trans_choice('models.classes.codes-ean', 2)])) - -@section('content') -
- @include('breadcrumbs.breadcrumb-body') - - - -
-@include('bo.modules.search-bar') - - @if (count($codeEanModels) > 0) - - @include('bo.modules.table-col-sorter', [ - 'cols' => [ - 'code' => Str::ucfirst(__('validation.attributes.code')), - 'product' => Str::ucfirst(__('validation.attributes.product')), - ], - ]) - - - @foreach ($codeEanModels as $codeEanModel) - - - - - - @endforeach - - @else - - - - @endif -
{{ $codeEanModel->code }}{{ $codeEanModel->product }} -
- - - - @csrf - @method('DELETE') - -
-
{{ __('crud.other.no_model_found', ['model' => trans_choice('models.classes.codes-ean', 1)]) }}
-{!! $codeEanModels->links() !!} -@endsection diff --git a/resources/views/bo/dashboard/index.blade.php b/resources/views/bo/pages/dashboard/index.blade.php similarity index 95% rename from resources/views/bo/dashboard/index.blade.php rename to resources/views/bo/pages/dashboard/index.blade.php index ac7d31a..a1ee799 100644 --- a/resources/views/bo/dashboard/index.blade.php +++ b/resources/views/bo/pages/dashboard/index.blade.php @@ -15,7 +15,7 @@ {{ __('Top 3 des codes EAN les plus utilisés') }} :
    @foreach ($codesEan as $codeEan) -
  • {{ $codeEan->code_ean_value }} : {{ $codeEan->nb_usage }}
  • +
  • {{ $codeEan->code_ean }} : {{ $codeEan->nb_usage }}
  • @endforeach
@endif diff --git a/resources/views/bo/instant-win/index.blade.php b/resources/views/bo/pages/instant-win/index.blade.php similarity index 100% rename from resources/views/bo/instant-win/index.blade.php rename to resources/views/bo/pages/instant-win/index.blade.php diff --git a/resources/views/bo/pages/prizes/index.blade.php b/resources/views/bo/pages/prizes/index.blade.php index edc4c1c..e7a95dd 100644 --- a/resources/views/bo/pages/prizes/index.blade.php +++ b/resources/views/bo/pages/prizes/index.blade.php @@ -41,12 +41,12 @@ - {{ $prizeModel->gain_view->name }} + {{ $prizeModel->gainView->name }} diff --git a/resources/views/bo/pages/ranges/form-inputs.blade.php b/resources/views/bo/pages/ranges/form-inputs.blade.php index d99f4b9..e253b1f 100644 --- a/resources/views/bo/pages/ranges/form-inputs.blade.php +++ b/resources/views/bo/pages/ranges/form-inputs.blade.php @@ -50,7 +50,6 @@ 'preview' => true, ])
-
diff --git a/resources/views/bo/pages/settings/manage.blade.php b/resources/views/bo/pages/settings/manage.blade.php deleted file mode 100644 index 67d6f81..0000000 --- a/resources/views/bo/pages/settings/manage.blade.php +++ /dev/null @@ -1,350 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
- Règlages du jeu -
- -
- @method('PUT') - @csrf -
-
-
-
- - -
-
-
- Générale
- Paramétres généraux du jeu -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - -
- @if ($settings->use_ean_codes === 1) - - @else - - @endif - -
-
- - -
- @if ($settings->activated_teaser === 1) - - @else - - @endif - -
-
- - - -
- - -
- @if ($settings->activated_close_page === 1) - - @else - - @endif - -
-
- - - -
- - - -
- - -
- @if ($settings->winning_proof === 1) - - @else - - @endif - -
-
- - - -
-
-
- Les réductions
- Paramétrages des bons de réduction MLDC -
-
- - - - - - - - - - - - - - - - - - -
- - -
- @if ($settings->reductions_activated === 1) - - @else - - @endif - -
-
- - - -
- - - -
- -
-
-
- Destinataires des notifications de gain
- Ces mails recevront toutes les notifications de gain. -
-
- -
-
- Google analytics
- Insérer ici la clé analytics pour le jeu. -
- - - - - -
Clé analytics (eg: UA-XX196604-1)
-
-
-
- -
-
-@endsection - -@push('scripts') - -@endpush diff --git a/resources/views/bo/pages/winners-list/index.blade.php b/resources/views/bo/pages/winners-list/index.blade.php index 3b2b745..50d1e52 100644 --- a/resources/views/bo/pages/winners-list/index.blade.php +++ b/resources/views/bo/pages/winners-list/index.blade.php @@ -36,9 +36,9 @@ {{ \Carbon\Carbon::parse($participationModel->created_at)->format('d/m/Y à H:i') }} {{$participationModel->instantWin()->first()->prize->label_one}} - {{$participationModel->user->email}} + {{$participationModel->customer->email}} @if ($settings->use_ean_codes) - {{$participationModel->codeEan->code}} + {{$participationModel->codeEan}} @endif {{$participationModel->code->code_unique}} @if ($settings->winning_proof === 1) diff --git a/resources/views/bo/products/create.blade.php b/resources/views/bo/products/create.blade.php deleted file mode 100644 index f2eb397..0000000 --- a/resources/views/bo/products/create.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
- @csrf -
-
-
- < Produit Porteur - Ajout -
-
- -
-
- -
-
-
-
- @include('bo.products.input-forms') -
-
-
-@endsection diff --git a/resources/views/bo/products/edit.blade.php b/resources/views/bo/products/edit.blade.php deleted file mode 100644 index d4d9ce8..0000000 --- a/resources/views/bo/products/edit.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
- @method('PUT') - @csrf -
-
-
- < Produit Porteur - Modification -
-
- @if (session('success')) - {{ session('success') }} - @endif -
-
- -
-
-
-
- @include('bo.products.input-forms') -
-
-
-@endsection diff --git a/resources/views/bo/products/index.blade.php b/resources/views/bo/products/index.blade.php deleted file mode 100644 index 426ea34..0000000 --- a/resources/views/bo/products/index.blade.php +++ /dev/null @@ -1,66 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
-
-
- Produits Porteur -
-
- -
- -
-
-
- @if ($errors->any()) -
-
    - @foreach ($errors->all() as $error) -
  • {{ $error }}
  • - @endforeach -
-
- @endif - - - - - - - - - - @foreach($products as $product) - - - - - - - - @endforeach - -
N° ArticleLibelléEANImage
{{$product->no_art}}{{$product->name}}{{$product->code_ean}} - @if($product->picture) - - {{$product->name}} - - @endif - - Modifier -
- @method('DELETE') - @csrf - -
-
-
-
-@endsection diff --git a/resources/views/bo/products/input-forms.blade.php b/resources/views/bo/products/input-forms.blade.php deleted file mode 100644 index 97db738..0000000 --- a/resources/views/bo/products/input-forms.blade.php +++ /dev/null @@ -1,38 +0,0 @@ -
- - -
-
- - -
-
- - -
-
-
- - @if (isset($product->picture) and $product->picture !== null) -
-
- - {{$product->name}} - - @endif -
-
-
-
- -
- -
-
diff --git a/resources/views/bo/ranges/create.blade.php b/resources/views/bo/ranges/create.blade.php deleted file mode 100644 index 032f8b5..0000000 --- a/resources/views/bo/ranges/create.blade.php +++ /dev/null @@ -1,27 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
- @csrf -
-
-
- <{{ __('Gammes - Ajout') }} -
-
- -
-
- -
-
-
-
- @include('bo.ranges.input-forms') -
-
-
-@endsection diff --git a/resources/views/bo/ranges/edit.blade.php b/resources/views/bo/ranges/edit.blade.php deleted file mode 100644 index ec3a032..0000000 --- a/resources/views/bo/ranges/edit.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
- @method('PUT') - @csrf -
-
-
- <{{ __('Gammes - Modification') }} -
-
- @if (session('success')) - {{ session('success') }} - @endif -
-
- -
-
-
-
- @include('bo.ranges.input-forms') -
-
-
-@endsection diff --git a/resources/views/bo/ranges/index.blade.php b/resources/views/bo/ranges/index.blade.php deleted file mode 100644 index f8a8103..0000000 --- a/resources/views/bo/ranges/index.blade.php +++ /dev/null @@ -1,52 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
-
-
- {{ __('Gammes') }} -
-
- -
- -
-
-
- - - - - - - - @foreach($ranges as $range) - - - - - - @endforeach - -
{{ __('Nom') }}Image
{{$range->name}} - @if($range->picture) - - {{$range->name}} - - @endif - - {{ __('Modifier') }} -
- @method('DELETE') - @csrf - -
-
-
-
-@endsection diff --git a/resources/views/bo/ranges/input-forms.blade.php b/resources/views/bo/ranges/input-forms.blade.php deleted file mode 100644 index 3cce4bd..0000000 --- a/resources/views/bo/ranges/input-forms.blade.php +++ /dev/null @@ -1,15 +0,0 @@ -
- - -
-
-
- - @if (isset($range->picture) and $range->picture !== null) -
-
- - {{$range->name}} - - @endif -
diff --git a/resources/views/bo/settings/manage.blade.php b/resources/views/bo/settings/manage.blade.php deleted file mode 100644 index 2e10335..0000000 --- a/resources/views/bo/settings/manage.blade.php +++ /dev/null @@ -1,401 +0,0 @@ -@extends('bo.layout') - -@section('content') -
-
- Règlages du jeu -
- -
- @method('PUT') - @csrf -
-
-
-
- - -
-
-
- Générale
- Paramétres généraux du jeu -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - -
- @if ($settings->use_ean_codes === 1) - - @else - - @endif - -
-
- - -
- @if ($settings->activated_teaser === 1) - - @else - - @endif - -
-
- - - -
- - -
- @if ($settings->activated_close_page === 1) - - @else - - @endif - -
-
- - - -
- - - -
- - -
- @if ($settings->winning_proof === 1) - - @else - - @endif - -
-
- - - -
-
-
- Les réductions
- Paramétrages des bons de réduction MLDC -
-
- - - - - - - - - - - - - - - - - - -
- - -
- @if ($settings->reductions_activated === 1) - - @else - - @endif - -
-
- - - -
- - - -
- -
-
-
- Facebook Connect
- Paramétrage du Facebook Connect -
-
- - - - - - - - - - - - - - - -
- - -
- @if ($settings->facebook_activated === 1) - - @else - - @endif - -
-
- - - -
- - - -
-
-
- Destinataires des notifications de gain
- Ces mails recevront toutes les notifications de gain. -
-
- -
-
- Google analytics
- Insérer ici la clé analytics pour le jeu. -
- - - - - -
Clé analytics (eg: UA-XX196604-1)
-
-
-
- -
-
-@endsection - -@push('scripts') - -@endpush diff --git a/resources/views/breadcrumbs/breadcrumb-body.blade.php b/resources/views/breadcrumbs/breadcrumb-body.blade.php index 365b15f..2f17974 100644 --- a/resources/views/breadcrumbs/breadcrumb-body.blade.php +++ b/resources/views/breadcrumbs/breadcrumb-body.blade.php @@ -5,6 +5,8 @@ !empty($brParam) ? (is_array($brParam) ? $brParam : [$brParam]) : [] )) }} @endif -@elseif(Breadcrumbs::exists(request()->route()->getName())) +@elseif(request()->route() != null) +@if(Breadcrumbs::exists(request()->route()->getName())) {{ Breadcrumbs::render(request()->route()->getName()) }} @endif +@endif diff --git a/resources/views/breadcrumbs/breadcrumb-head.blade.php b/resources/views/breadcrumbs/breadcrumb-head.blade.php index 51ea9c5..b2d8502 100644 --- a/resources/views/breadcrumbs/breadcrumb-head.blade.php +++ b/resources/views/breadcrumbs/breadcrumb-head.blade.php @@ -1,10 +1,9 @@ @hasSection('breadcrumb') @if(Breadcrumbs::exists(app()->view->getSections()['breadcrumb'])) -{{ call_user_func_array('Breadcrumbs::view', array_merge( - ['breadcrumbs::json-ld', app()->view->getSections()['breadcrumb']], - !empty($brParam) ? (is_array($brParam) ? $brParam : [$brParam]) : [] -)) }} +{{ Breadcrumbs::view('breadcrumbs::json-ld', app()->view->getSections()['breadcrumb'], $brParam ?? null) }} @endif -@elseif(Breadcrumbs::exists(request()->route()->getName())) +@elseif(request()->route() != null) +@if (Breadcrumbs::exists(request()->route()->getName())) {{ Breadcrumbs::view('breadcrumbs::json-ld', request()->route()->getName()) }} @endif +@endif diff --git a/resources/views/breadcrumbs/breadcrumb-layout.blade.php b/resources/views/breadcrumbs/breadcrumb-layout.blade.php index 09528c9..e9ff09d 100644 --- a/resources/views/breadcrumbs/breadcrumb-layout.blade.php +++ b/resources/views/breadcrumbs/breadcrumb-layout.blade.php @@ -1,15 +1,17 @@ -@if (isset($breadcrumbs)) -@unless ($breadcrumbs->isEmpty()) - -@endunless +@if (count($breadcrumbs)) + @endif diff --git a/resources/views/front/basic_example/gain1.blade.php b/resources/views/front/basic_example/gain1.blade.php index bdd2317..f022445 100644 --- a/resources/views/front/basic_example/gain1.blade.php +++ b/resources/views/front/basic_example/gain1.blade.php @@ -1,7 +1,7 @@ @extends('front.basic.layout') @section('title') - {{$prize->gain_view->name}} + {{$prize->gainView->name}} @endsection @section('content') diff --git a/resources/views/front/basic_example/notif-win-admin-email.blade.php b/resources/views/front/basic_example/notif-win-admin-email.blade.php index c44e8f5..1d52172 100644 --- a/resources/views/front/basic_example/notif-win-admin-email.blade.php +++ b/resources/views/front/basic_example/notif-win-admin-email.blade.php @@ -13,9 +13,9 @@

{{ $participation->user->email }}


Codes utilisé@if ($settings->use_ean_codes)s @endif :

@if ($settings->use_ean_codes) -

- Code On Pack : {{ $participation->codeEan->code }}

+

- Code On Pack : {{ $participation->codeEan }}

@endif

- Code Unique : {{ $participation->code->code_unique }}

- \ No newline at end of file + diff --git a/resources/views/re7.blade.php b/resources/views/re7.blade.php index ce164c1..6a3609d 100644 --- a/resources/views/re7.blade.php +++ b/resources/views/re7.blade.php @@ -1,4 +1,4 @@ -@extends('layouts.app') +@extends('bo.layout') @section('content')
diff --git a/routes/breadcrumbs-bo.php b/routes/breadcrumbs-bo.php index 8237f44..d183029 100644 --- a/routes/breadcrumbs-bo.php +++ b/routes/breadcrumbs-bo.php @@ -1,7 +1,6 @@ push(__('crud.actions.edit'), route('bo.bannedips.edit', $bannedip->id)); }); -// * CODES EAN -Breadcrumbs::for('bo.code-eans.index', function (Generator $trail) { - $trail->push(trans_choice('models.classes.codes-ean', 2), route('bo.code-eans.index')); -}); -Breadcrumbs::for('bo.code-eans.create', function (Generator $trail) { - $trail->parent('bo.code-eans.index'); - $trail->push(__('crud.actions.create'), route('bo.code-eans.create')); -}); -Breadcrumbs::for('bo.code-eans.edit', function (Generator $trail, CodeEan $codeEan) { - $trail->parent('bo.code-eans.index'); - $trail->push(__('crud.actions.edit'), route('bo.code-eans.edit', $codeEan->id)); -}); - // * CONTENTS Breadcrumbs::for('bo.contents.index', function (Generator $trail) { $trail->push(__('models.classes.contents'), route('bo.contents.index')); diff --git a/routes/web-bo.php b/routes/web-bo.php index 27468dd..3e9d752 100644 --- a/routes/web-bo.php +++ b/routes/web-bo.php @@ -2,7 +2,6 @@ use App\Http\Controllers\Bo\BannedIpController; use App\Http\Controllers\Bo\CodesController; -use App\Http\Controllers\Bo\CodesEANController; use App\Http\Controllers\Bo\ContentController; use App\Http\Controllers\Bo\DashboardController; use App\Http\Controllers\Bo\FaqQuestionsController; @@ -40,10 +39,6 @@ Route::prefix('bo') ->name('dashboard')->withoutMiddleware('is-super-admin'); // * BANNED IPS Route::resource('/bannedips', BannedIpController::class)->except('show'); - // * CODES EAN - Route::resource('/code-eans', CodesEANController::class) - ->except('show') - ->withoutMiddleware('is-super-admin'); // * CONTENTS Route::resource('/contents', ContentController::class) ->only(['index', 'edit', 'update']) diff --git a/routes/web-fo.php b/routes/web-fo.php index a7a4d96..ae10084 100644 --- a/routes/web-fo.php +++ b/routes/web-fo.php @@ -27,8 +27,7 @@ Route::namespace('\App\Http\Controllers\Fo')->middleware(['throttle:credentials' Route::put('/rejouer', [WinningProofController::class, 'sendWinningProof']) ->name('send-winning-proof'); }); - Route::get('/', [HomeController::class, 'index'])->name('home'); - // Route::get('/', [HomeController::class, 'home'])->name('home'); + Route::get('/', [HomeController::class, 'home'])->name('home'); Route::get('/reglement', [ViewContentController::class, 'reglement'])->name('reglement'); Route::get('/charte', [ViewContentController::class, 'charte'])->name('charte');