mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Added clone to consumables
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
2bfee0c29a
commit
254e2f120b
|
@ -209,4 +209,14 @@ class ConsumablesController extends Controller
|
|||
return redirect()->route('consumables.index')
|
||||
->with('error', trans('admin/consumables/message.does_not_exist'));
|
||||
}
|
||||
|
||||
public function clone(Consumable $consumable) : View
|
||||
{
|
||||
$this->authorize('create', $consumable);
|
||||
$consumable_to_close = $consumable;
|
||||
$consumable = clone $consumable_to_close;
|
||||
$consumable->id = null;
|
||||
|
||||
return view('consumables/edit')->with('item', $consumable);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ class ConsumablesTransformer
|
|||
'checkin' => Gate::allows('checkin', Consumable::class),
|
||||
'update' => Gate::allows('update', Consumable::class),
|
||||
'delete' => Gate::allows('delete', Consumable::class),
|
||||
'clone' => (Gate::allows('create', Consumable::class) && ($consumable->deleted_at == '')),
|
||||
];
|
||||
$array += $permissions_array;
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@ Route::group(['prefix' => 'consumables', 'middleware' => ['auth']], function ()
|
|||
[Consumables\ConsumablesFilesController::class, 'show']
|
||||
)->name('show.consumablefile');
|
||||
|
||||
Route::get('{consumable}/clone',
|
||||
[Consumables\ConsumablesController::class, 'clone']
|
||||
)->name('consumables.clone.create');
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue