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);
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

View file

@ -24,13 +24,13 @@
@if ($accessory->assigned_to != '')
@can('checkin', \App\Models\Accessory::class)
<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>
@endcan
@else
@can('checkout', \App\Models\Accessory::class)
<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>
@endcan
@endif
@ -171,7 +171,7 @@
@can('checkout', \App\Models\Accessory::class)
<div class="row">
<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>
@endcan

View file

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