diff --git a/app/Http/Controllers/Bo/ConvictionpageController.php b/app/Http/Controllers/Bo/ConvictionpageController.php new file mode 100644 index 0000000..445827c --- /dev/null +++ b/app/Http/Controllers/Bo/ConvictionpageController.php @@ -0,0 +1,77 @@ +authorizeResource(Convictionpage::class); + } + + /** + * Display a listing of the resource. + * + * @return \Illuminate\Contracts\View\View + */ + public function index(): \Illuminate\Contracts\View\View + { + /** @var \Illuminate\Database\Eloquent\Builder $convictionpageModels */ + $convictionpageModels = Convictionpage::query(); + + /** Sort columns with a query */ + $this->sortQuery($convictionpageModels); + + /** Custom pagination */ + $convictionpageModels = $this->paginate($convictionpageModels); + + return view('bo.pages.convictionpages.index', compact('convictionpageModels')); + } + + /** + * Show the form for editing the specified resource. + * + * @param App\Models\Convictionpage $convictionpage + * @return \Illuminate\Contracts\View\View + */ + public function edit(Convictionpage $convictionpage): \Illuminate\Contracts\View\View + { + return view('bo.pages.convictionpages.edit', ['convictionpageModel' => $convictionpage]); + } + + /** + * Update the specified resource in storage. + * + * @param \App\Http\Requests\Bo\Convictionpages\UpdateConvictionpageRequest $request + * @param \App\Models\Convictionpage $convictionpage + * @return \Illuminate\Http\RedirectResponse + */ + public function update( + UpdateConvictionpageRequest $request, + Convictionpage $convictionpage + ): \Illuminate\Http\RedirectResponse { + return DB::transaction(function () use ($request, $convictionpage) { + $convictionpage->fill($request->validated()); + + if ($convictionpage->saveOrFail()) { + return redirect()->route('bo.convictionpages.edit', $convictionpage) + ->with('success', __('crud.messages.has_been_updated', [ + 'model' => Str::ucfirst(__('models.classes.convictionpage')) + ])); + } + return redirect()->route('bo.convictionpages.edit', $convictionpage) + ->with('error', __('crud.messages.cannot_be_updated', [ + 'model' => Str::ucfirst(__('models.classes.convictionpage')) + ])); + }); + } +} diff --git a/app/Http/Requests/Bo/Convictionpages/StoreConvictionpageRequest.php b/app/Http/Requests/Bo/Convictionpages/StoreConvictionpageRequest.php new file mode 100644 index 0000000..26f2b43 --- /dev/null +++ b/app/Http/Requests/Bo/Convictionpages/StoreConvictionpageRequest.php @@ -0,0 +1,40 @@ +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', + ]; + } +} diff --git a/app/Http/Requests/Bo/Convictionpages/UpdateConvictionpageRequest.php b/app/Http/Requests/Bo/Convictionpages/UpdateConvictionpageRequest.php new file mode 100644 index 0000000..f459858 --- /dev/null +++ b/app/Http/Requests/Bo/Convictionpages/UpdateConvictionpageRequest.php @@ -0,0 +1,18 @@ + 'explorer page', 'commitment' => 'commitment', 'product' => 'product', + 'convictionpage' => 'conviction page', ] ]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php index 4fa21f3..aed6654 100644 --- a/resources/lang/en/validation.php +++ b/resources/lang/en/validation.php @@ -246,9 +246,9 @@ return [ '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', + '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', @@ -257,5 +257,13 @@ return [ 'cooking_advice' => 'cooking advice', 'ingredients' => 'ingredients', 'nutritionnal_values' => 'nutritionnal values', + 'key_feed' => 'key number for "feed well"', + 'key_earth_1' => 'key number for "respect the earth" 1', + 'key_earth_2' => 'key number for "respect the earth" 2', + '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"', ], ]; diff --git a/resources/lang/fr/models.php b/resources/lang/fr/models.php index 5432d52..cab2280 100644 --- a/resources/lang/fr/models.php +++ b/resources/lang/fr/models.php @@ -13,5 +13,6 @@ return [ 'stamp' => 'tampon', 'explorerpage' => 'page explorateur', 'product' => 'produit', + 'convictionpage' => 'page conviction', ] ]; diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index bdbde5b..fcdcd33 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -259,5 +259,13 @@ return [ 'cooking_advice' => 'conseil de réchauffage', 'ingredients' => 'ingrédients', 'nutritionnal_values' => 'valeurs nutritionnelles', + 'key_feed' => 'chiffre clé "bien nourrir"', + 'key_earth_1' => 'Chiffre clé "respecter la terre" 1', + 'key_earth_2' => 'Chiffre clé "respecter la terre" 2', + '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"', ], ]; diff --git a/resources/views/bo/layouts/nav-list.blade.php b/resources/views/bo/layouts/nav-list.blade.php index 3b5ee44..e268fe1 100644 --- a/resources/views/bo/layouts/nav-list.blade.php +++ b/resources/views/bo/layouts/nav-list.blade.php @@ -6,32 +6,14 @@ {{ __('Accueil') }} - @can('viewAny', \App\Models\StaticPage::class) - - @endcan @can('viewAny', \App\Models\Commitment::class) @endcan - @can('viewAny', \App\Models\News::class) - - @endcan @can('viewAny', \App\Models\SeasonalSection::class)
  • @endcan - @can('viewAny', \App\Models\Homepage::class) -
  • - - {{ Str::of(__('models.classes.homepage'))->plural()->ucfirst() }} - -
  • - @endcan @can('viewAny', \App\Models\Stamp::class)
  • @endcan - @can('viewAny', \App\Models\Explorerpage::class) + @can('viewAny', \App\Models\Convictionpage::class)
  • - - {{ Str::of(__('models.classes.explorerpage'))->plural()->ucfirst() }} + + {{ Str::of(__('models.classes.convictionpage'))->plural()->ucfirst() }}
  • @endcan +