mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-25 20:51:30 -08:00
Fixed getAssetBySerial
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
f840652395
commit
3e2fe10480
|
@ -410,7 +410,23 @@ class AssetsController extends Controller
|
||||||
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.delete.success'));
|
return redirect()->route('hardware.index')->with('success', trans('admin/hardware/message.delete.success'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Searches the assets table by serial, and redirects if it finds one
|
||||||
|
*
|
||||||
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
|
* @since [v3.0]
|
||||||
|
* @return Redirect
|
||||||
|
*/
|
||||||
|
public function getAssetBySerial(Request $request)
|
||||||
|
{
|
||||||
|
$topsearch = ($request->get('topsearch')=="true");
|
||||||
|
|
||||||
|
if (!$asset = Asset::where('serial', '=', $request->get('serial'))->first()) {
|
||||||
|
return redirect()->route('hardware.index')->with('error', trans('admin/hardware/message.does_not_exist'));
|
||||||
|
}
|
||||||
|
$this->authorize('view', $asset);
|
||||||
|
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches the assets table by asset tag, and redirects if it finds one
|
* Searches the assets table by asset tag, and redirects if it finds one
|
||||||
|
@ -429,6 +445,8 @@ class AssetsController extends Controller
|
||||||
$this->authorize('view', $asset);
|
$this->authorize('view', $asset);
|
||||||
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
|
return redirect()->route('hardware.show', $asset->id)->with('topsearch', $topsearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a QR code for the asset
|
* Return a QR code for the asset
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue