Handle accessories route names

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-08-01 16:06:28 -07:00
parent 744d0d299e
commit 4a4636bd03
3 changed files with 8 additions and 8 deletions

View file

@ -63,7 +63,7 @@ class AccessoryCheckoutController extends Controller
$this->authorize('checkout', $accessory); $this->authorize('checkout', $accessory);
if (! $user = User::find($request->input('assigned_to'))) { if (! $user = User::find($request->input('assigned_to'))) {
return redirect()->route('checkout/accessory', $accessory->id)->with('error', trans('admin/accessories/message.checkout.user_does_not_exist')); return redirect()->route('accessories.checkout.show', $accessory->id)->with('error', trans('admin/accessories/message.checkout.user_does_not_exist'));
} }
// Update the accessory data // Update the accessory data

View file

@ -24,13 +24,13 @@
@if ($accessory->assigned_to != '') @if ($accessory->assigned_to != '')
@can('checkin', \App\Models\Accessory::class) @can('checkin', \App\Models\Accessory::class)
<li role="menuitem"> <li role="menuitem">
<a href="{{ route('checkin/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.checkin') }}</a> <a href="{{ route('accessories.checkin.show', $accessory->id) }}">{{ trans('admin/accessories/general.checkin') }}</a>
</li> </li>
@endcan @endcan
@else @else
@can('checkout', \App\Models\Accessory::class) @can('checkout', \App\Models\Accessory::class)
<li role="menuitem"> <li role="menuitem">
<a href="{{ route('checkout/accessory', $accessory->id) }}">{{ trans('admin/accessories/general.checkout') }}</a> <a href="{{ route('accessories.checkout.show', $accessory->id) }}">{{ trans('admin/accessories/general.checkout') }}</a>
</li> </li>
@endcan @endcan
@endif @endif
@ -171,7 +171,7 @@
@can('checkout', \App\Models\Accessory::class) @can('checkout', \App\Models\Accessory::class)
<div class="row"> <div class="row">
<div class="col-md-12 text-center"> <div class="col-md-12 text-center">
<a href="{{ route('checkout/accessory', $accessory->id) }}" style="margin-right:5px;" class="btn btn-primary btn-sm" {{ (($accessory->numRemaining() > 0 ) ? '' : ' disabled') }}>{{ trans('general.checkout') }}</a> <a href="{{ route('accessories.checkout.show', $accessory->id) }}" style="margin-right:5px;" class="btn btn-primary btn-sm" {{ (($accessory->numRemaining() > 0 ) ? '' : ' disabled') }}>{{ trans('general.checkout') }}</a>
</div> </div>
</div> </div>
@endcan @endcan

View file

@ -10,22 +10,22 @@ Route::group(['prefix' => 'accessories', 'middleware' => ['auth']], function ()
Route::get( Route::get(
'{accessoryID}/checkout', '{accessoryID}/checkout',
[Accessories\AccessoryCheckoutController::class, 'create'] [Accessories\AccessoryCheckoutController::class, 'create']
)->name('checkout/accessory'); )->name('accessories.checkout.show');
Route::post( Route::post(
'{accessoryID}/checkout', '{accessoryID}/checkout',
[Accessories\AccessoryCheckoutController::class, 'store'] [Accessories\AccessoryCheckoutController::class, 'store']
)->name('checkout/accessory'); )->name('accessories.checkout.store');
Route::get( Route::get(
'{accessoryID}/checkin/{backto?}', '{accessoryID}/checkin/{backto?}',
[Accessories\AccessoryCheckinController::class, 'create'] [Accessories\AccessoryCheckinController::class, 'create']
)->name('checkin/accessory'); )->name('accessories.checkin.show');
Route::post( Route::post(
'{accessoryID}/checkin/{backto?}', '{accessoryID}/checkin/{backto?}',
[Accessories\AccessoryCheckinController::class, 'store'] [Accessories\AccessoryCheckinController::class, 'store']
)->name('checkin/accessory'); )->name('accessories.checkin.store');
}); });