From 82fab7c010e2c49193d9f1609367358f7619dbb1 Mon Sep 17 00:00:00 2001 From: Alexis Gousseau Date: Mon, 25 Mar 2024 16:11:43 +0100 Subject: [PATCH] use default laravel helpers in blade files --- app/Providers/RouteServiceProvider.php | 5 +- resources/views/bo/auth/login.blade.php | 109 +++++++++--------- resources/views/bo/layouts/header.blade.php | 8 +- resources/views/bo/layouts/nav-list.blade.php | 18 +-- .../bo/modules/change-model-order.blade.php | 10 +- .../views/bo/modules/pagination.blade.php | 13 +-- .../bo/modules/table-col-sorter.blade.php | 11 +- .../pages/activity_logs/index-list.blade.php | 20 ++-- .../bo/pages/activity_logs/index.blade.php | 4 +- .../bo/pages/activity_logs/show.blade.php | 11 +- .../bo/pages/static_pages/edit.blade.php | 9 +- .../bo/pages/static_pages/form.blade.php | 20 ++-- .../pages/static_pages/index-list.blade.php | 8 +- .../bo/pages/static_pages/index.blade.php | 2 +- .../views/bo/pages/users/create.blade.php | 7 +- resources/views/bo/pages/users/edit.blade.php | 8 +- .../views/bo/pages/users/index-list.blade.php | 18 +-- .../views/bo/pages/users/index.blade.php | 4 +- .../bo/partials/inputs/int-number.blade.php | 4 +- .../views/modules/flash-messages.blade.php | 28 ++--- .../modules/minicrud-form-inputs.blade.php | 58 +++++----- resources/views/vendor/errors/403.blade.php | 4 +- resources/views/vendor/errors/404.blade.php | 4 +- resources/views/vendor/errors/503.blade.php | 4 +- .../views/vendor/mail/html/header.blade.php | 8 +- 25 files changed, 192 insertions(+), 203 deletions(-) diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index e2e4129..6f9a47b 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,6 +2,7 @@ namespace App\Providers; +use App\Http\Middleware\VerifyCsrfToken; use App\Models\User; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; @@ -73,7 +74,7 @@ class RouteServiceProvider extends ServiceProvider private function cspReportRoute() { // * CSP REPORT URI, Please add /csp-report to VerifyCsrfToken $except middleware - \Illuminate\Support\Facades\Route::post('/csp-report', function () { + Route::post('/csp-report', function () { $isCspRequest = request()->header('Content-Type') === 'application/csp-report'; if (!$isCspRequest or !request()->json('csp-report') or !is_array(request()->json('csp-report'))) { abort(401); @@ -94,7 +95,7 @@ class RouteServiceProvider extends ServiceProvider $cspReport->implode("\n") )); })->middleware('throttle:5,2') - ->withoutMiddleware(\App\Http\Middleware\VerifyCsrfToken::class) + ->withoutMiddleware(VerifyCsrfToken::class) ->name('cspReportUri'); } } diff --git a/resources/views/bo/auth/login.blade.php b/resources/views/bo/auth/login.blade.php index 1731442..d3b97a0 100644 --- a/resources/views/bo/auth/login.blade.php +++ b/resources/views/bo/auth/login.blade.php @@ -3,65 +3,66 @@ @section('description', __('Formulaire d\'authentification au back-office.')) @section('content') -
-
-
-
-
{{ __('Connexion') }}
-
-
- @csrf -
- -
- - @error('email') - - {{ $message }} - - @enderror -
-
-
- -
- - @error('password') - - {{ $message }} - - @enderror -
-
-
-
-
- - +
+
+
+
+
{{ __('Connexion') }}
+
+ + @csrf +
+ +
+ + @error('email') + + {{ $message }} + + @enderror
-
-
-
- - @if (Route::has('bo.password.request')) - - {{ __('Mot de passe oublié ?') }} - - @endif +
+ +
+ + @error('password') + + {{ $message }} + + @enderror +
-
- +
+
+
+ + +
+
+
+
+
+ + @if (route()->has('bo.password.request')) + + {{ __('Mot de passe oublié ?') }} + + @endif +
+
+ +
-
@endsection diff --git a/resources/views/bo/layouts/header.blade.php b/resources/views/bo/layouts/header.blade.php index ee7578c..e88fc4c 100644 --- a/resources/views/bo/layouts/header.blade.php +++ b/resources/views/bo/layouts/header.blade.php @@ -45,11 +45,11 @@ @endforeach @@ -62,7 +62,7 @@
{{ auth('backend')->user()->first_name }} {{ auth('backend')->user()->last_name }} - {{ Str::of(auth('backend')->user()->role->label())->ucFirst() }} + {{ str(auth('backend')->user()->role->label())->ucFirst() }}
diff --git a/resources/views/bo/pages/static_pages/form.blade.php b/resources/views/bo/pages/static_pages/form.blade.php index c171fb6..fc1e4bf 100644 --- a/resources/views/bo/pages/static_pages/form.blade.php +++ b/resources/views/bo/pages/static_pages/form.blade.php @@ -2,7 +2,7 @@ {{-- TYPE --}}
- {{ Str::ucfirst(__('validation.custom.static_page_type')) }} + {{ str(__('validation.custom.static_page_type'))->ucfirst() }}
@include('bo.partials.inputs.tinyint-enum', [ @@ -23,7 +23,7 @@ {{-- TITLE --}}
- {{ Str::ucfirst(__('validation.attributes.title')) }} + {{ str(__('validation.attributes.title'))->ucfirst() }}
@include('bo.partials.inputs.varchar', [ @@ -47,13 +47,13 @@ {{-- SEO_TITLE --}}
- {{ Str::ucfirst(__('validation.custom.seo_title')) }} + {{ str(__('validation.custom.seo_title'))->ucfirst() }}
@include('bo.partials.inputs.varchar', [ 'id' => 'staticPagesSeoTitle', 'label' => __(':field :inter:model', [ - 'field' => Str::ucfirst(__('validation.custom.seo_title')), + 'field' => str(__('validation.custom.seo_title'))->ucfirst(), 'inter' => __('validation.custom.of_the.female'), 'model' => trans_choice('models.classes.static_page', 1), ]), @@ -74,7 +74,7 @@ 'max' => 70, ])), 'placeholder' => __(':field :inter:model', [ - 'field' => Str::ucfirst(__('validation.custom.seo_title')), + 'field' => str(__('validation.custom.seo_title'))->ucfirst(), 'inter' => __('validation.custom.of_the.female'), 'model' => trans_choice('models.classes.static_page', 1), ]), @@ -86,13 +86,13 @@ {{-- SEO_DESCRIPTION --}}
- {{ Str::ucfirst(__('validation.custom.seo_description')) }} + {{ str(__('validation.custom.seo_description'))->ucfirst() }}
@include('bo.partials.inputs.varchar-multiline', [ 'id' => 'staticPagesSeoDescription', 'label' => __(':field :inter:model', [ - 'field' => Str::ucfirst(__('validation.custom.seo_description')), + 'field' => str(__('validation.custom.seo_description'))->ucfirst(), 'inter' => __('validation.custom.of_the.female'), 'model' => trans_choice('models.classes.static_page', 1), ]), @@ -112,7 +112,7 @@ 'max' => 160, ])), 'placeholder' => __(':field :inter:model', [ - 'field' => Str::ucfirst(__('validation.custom.seo_description')), + 'field' => str(__('validation.custom.seo_description'))->ucfirst(), 'inter' => __('validation.custom.of_the.female'), 'model' => trans_choice('models.classes.static_page', 1), ]), @@ -124,13 +124,13 @@ {{-- CONTENT --}}
- {{ Str::ucfirst(__('validation.attributes.content')) }} + {{ str(__('validation.attributes.content'))->ucfirst() }}
@include('bo.partials.inputs.text-html', [ 'id' => 'articleContent', 'label' => __(':field :inter:model', [ - 'field' => Str::ucfirst(__('validation.attributes.content')), + 'field' => str(__('validation.attributes.content'))->ucfirst(), 'inter' => __('validation.custom.of_the.female'), 'model' => trans_choice('models.classes.static_page', 1), ]), diff --git a/resources/views/bo/pages/static_pages/index-list.blade.php b/resources/views/bo/pages/static_pages/index-list.blade.php index 5724bfc..3647bde 100644 --- a/resources/views/bo/pages/static_pages/index-list.blade.php +++ b/resources/views/bo/pages/static_pages/index-list.blade.php @@ -3,9 +3,9 @@ @include('bo.modules.table-col-sorter', [ 'cols' => [ - 'type' => Str::ucfirst(__('validation.custom.static_page_type')), - 'title' => Str::ucfirst(__('validation.attributes.title')), - 'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')), + 'type' => str(__('validation.custom.static_page_type'))->ucfirst(), + 'title' => str(__('validation.attributes.title'))->ucfirst(), + 'updated_at' => str(__('validation.attributes.updated_at'))->ucfirst(), ], ]) @@ -23,7 +23,7 @@ @can('update', $staticPageModel) + title="{{ str(__('crud.actions.update'))->ucfirst() }}"> @endcan diff --git a/resources/views/bo/pages/static_pages/index.blade.php b/resources/views/bo/pages/static_pages/index.blade.php index 197550e..6b758b8 100644 --- a/resources/views/bo/pages/static_pages/index.blade.php +++ b/resources/views/bo/pages/static_pages/index.blade.php @@ -1,6 +1,6 @@ @extends('bo.layout') -@section('title', Str::ucfirst(trans_choice('models.classes.static_page', 2))) +@section('title', str(trans_choice('models.classes.static_page', 2))->ucfirst()) @section('description', __('Liste de toutes les :model', ['model' => trans_choice('models.classes.static_page', 2)])) @section('content') diff --git a/resources/views/bo/pages/users/create.blade.php b/resources/views/bo/pages/users/create.blade.php index f86ec66..d5064a5 100644 --- a/resources/views/bo/pages/users/create.blade.php +++ b/resources/views/bo/pages/users/create.blade.php @@ -2,8 +2,7 @@ @section('title', __('Création d\'un :model', ['model' => __('models.classes.user')])) @section('description', __('Création d\'un tout nouveau :model', ['model' => __('models.classes.user')])) -@section('breadcrumb', - request()->route()->getName()) +@section('breadcrumb', request()->route()->getName()) @section('content')
@@ -17,7 +16,7 @@
@@ -29,7 +28,7 @@
diff --git a/resources/views/bo/pages/users/edit.blade.php b/resources/views/bo/pages/users/edit.blade.php index e545f1d..84ed9b7 100644 --- a/resources/views/bo/pages/users/edit.blade.php +++ b/resources/views/bo/pages/users/edit.blade.php @@ -10,7 +10,7 @@
+ title="{{ __('crud.helpers.list_all', ['model' => str(__('models.classes.user'))->plural()]) }}"> @include('modules.breadcrumbs.breadcrumb-body', ['brParam' => $userModel]) @@ -28,13 +28,13 @@ @can('duplicate', $userModel) + title="{{ str(__('crud.actions.duplicate'))->ucfirst() }}"> @endcan @can('delete', $userModel) @csrf @@ -65,7 +65,7 @@
diff --git a/resources/views/bo/pages/users/index-list.blade.php b/resources/views/bo/pages/users/index-list.blade.php index 71b7a6a..ea36d5c 100644 --- a/resources/views/bo/pages/users/index-list.blade.php +++ b/resources/views/bo/pages/users/index-list.blade.php @@ -3,12 +3,12 @@ @include('bo.modules.table-col-sorter', [ 'cols' => [ - 'role' => Str::ucfirst(__('validation.attributes.role')), - 'first_name' => Str::ucfirst(__('validation.attributes.first_name')), - 'last_name' => Str::ucfirst(__('validation.attributes.last_name')), - 'email' => Str::ucfirst(__('validation.attributes.email')), - 'published' => Str::ucfirst(__('validation.custom.activated')), - 'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')), + 'role' => str(__('validation.attributes.role'))->ucfirst(), + 'first_name' => str(__('validation.attributes.first_name'))->ucfirst(), + 'last_name' => str(__('validation.attributes.last_name'))->ucfirst(), + 'email' => str(__('validation.attributes.email'))->ucfirst(), + 'published' => str(__('validation.custom.activated'))->ucfirst(), + 'updated_at' => str(__('validation.attributes.updated_at'))->ucfirst(), ], ]) @@ -40,14 +40,14 @@ @can('duplicate', $userModel) + title="{{ str(__('crud.actions.duplicate'))->ucfirst() }}"> @endcan @can('update', $userModel) + title="{{ str(__('crud.actions.update'))->ucfirst() }}"> @endcan @@ -55,7 +55,7 @@ @csrf @method('DELETE') @endcan diff --git a/resources/views/bo/pages/users/index.blade.php b/resources/views/bo/pages/users/index.blade.php index adf2e6e..cf586ed 100644 --- a/resources/views/bo/pages/users/index.blade.php +++ b/resources/views/bo/pages/users/index.blade.php @@ -1,7 +1,7 @@ @extends('bo.layout') -@section('title', Str::ucfirst(__('models.classes.user'))) -@section('description', __('Liste de tous les :model', ['model' => Str::plural(__('models.classes.user'))])) +@section('title', str(__('models.classes.user'))->ucfirst()) +@section('description', __('Liste de tous les :model', ['model' => str(__('models.classes.user'))->plural()])) @section('content')
diff --git a/resources/views/bo/partials/inputs/int-number.blade.php b/resources/views/bo/partials/inputs/int-number.blade.php index 6885a98..444e68c 100644 --- a/resources/views/bo/partials/inputs/int-number.blade.php +++ b/resources/views/bo/partials/inputs/int-number.blade.php @@ -28,14 +28,14 @@ $errors->has($name) ]) aria-describedby="{{ $id }}Help" @if(!empty($step)) - step="{{ Str::replace(',', '.', strval($step)) }}" + step="{{ str()->replace(',', '.', strval($step)) }}" @else step="1" @endif @if(!empty($max)) diff --git a/resources/views/modules/flash-messages.blade.php b/resources/views/modules/flash-messages.blade.php index 96c010b..62b9f02 100644 --- a/resources/views/modules/flash-messages.blade.php +++ b/resources/views/modules/flash-messages.blade.php @@ -1,47 +1,43 @@ @if (!request()->routeIs('login')) - @if ($message = Session::get('success', Session::get('bo.success'))) -