Merge branch 'order-and-published-changes-in-patch' into 'laravel-10'

Changed 'published' and 'order' method to PATCH

See merge request ldc-web/projets/laravel-base-project!24
This commit is contained in:
Vincent BRIDIER 2023-10-18 06:55:13 +00:00
commit 92c1e30aff
3 changed files with 16 additions and 7 deletions

View file

@ -1,20 +1,28 @@
<td class="text-center align-middle">
@can('changeOrder', $model)
<div class="d-flex justify-content-center align-items-center">
<a class="@if ($loop->first and $models->onFirstPage()) invisible @endif"
href="{{ route('bo.' . $routeName . '.change-order', [Str::singular($routeName) => $model, 'direction' => 'up']) }}">
<form class="@if ($loop->first and $models->onFirstPage()) invisible @endif"
action="{{ route('bo.' . $routeName . '.change-order', [Str::singular($routeName) => $model, 'direction' => 'up']) }}"
method="POST"
>
@csrf
@method('PATCH')
<button class="btn btn-sm btn-outline-secondary @if ($loop->first and $models->onFirstPage()) disabled @endif" data-bs-toggle="tooltip"
type="submit" title="{{ __('crud.other.up') }}">
<i class="fas fa-arrow-up"></i>
</button>
</a>
<a class="@if ($loop->last and $models->currentPage() === $models->lastPage()) invisible @endif"
href="{{ route('bo.' . $routeName . '.change-order', [Str::singular($routeName) => $model, 'direction' => 'down']) }}">
</form>
<form class="@if ($loop->last and $models->currentPage() === $models->lastPage()) invisible @endif"
action="{{ route('bo.' . $routeName . '.change-order', [Str::singular($routeName) => $model, 'direction' => 'down']) }}"
method="POST"
>
@csrf
@method('PATCH')
<button class="btn btn-sm btn-outline-secondary @if ($loop->last and $models->currentPage() === $models->lastPage()) disabled @endif ms-1" data-bs-toggle="tooltip"
type="submit" title="{{ __('crud.other.down') }}">
<i class="fas fa-arrow-down"></i>
</button>
</a>
</form>
</div>
@else
<span class="text-danger" data-bs-toggle="tooltip" title="{{ __('crud.other.right') }}">

View file

@ -2,6 +2,7 @@
@can('changePublished', $model)
<form action="{{ route('bo.' . $routeName . '.change-published', $model->getRouteKey()) }}" method="POST">
@csrf
@method('PATCH')
<button class="btn btn-sm @if ($model->published) btn-primary @else btn-danger @endif" data-bs-toggle="tooltip"
type="submit" title="{{ __($model->published ? __('crud.other.unpublish') : __('crud.other.publish')) }}">
@if ($model->published)

View file

@ -29,7 +29,7 @@ Route::prefix('bo')
// * USERS.
Route::resource('users', UsersController::class)->except('show');
Route::post('/users/{user}/change-published', [
Route::patch('/users/{user}/change-published', [
UsersController::class, 'changePublished'
])->name('users.change-published');
Route::get('/users/{user}/duplicate', [