mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Added counts to show method
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
385c4f69f7
commit
63a05c89a7
|
@ -193,13 +193,20 @@ class DepreciationsController extends Controller
|
|||
*/
|
||||
public function show($id) : View | RedirectResponse
|
||||
{
|
||||
if (is_null($depreciation = Depreciation::find($id))) {
|
||||
// Redirect to the blogs management page
|
||||
return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist'));
|
||||
}
|
||||
$depreciation = Depreciation::withCount('assets as assets_count')
|
||||
->withCount('models as models_count')
|
||||
->withCount('licenses as licenses_count')
|
||||
->find($id);
|
||||
|
||||
$this->authorize('view', $depreciation);
|
||||
|
||||
return view('depreciations/view', compact('depreciation'));
|
||||
if ($depreciation) {
|
||||
return view('depreciations/view', compact('depreciation'));
|
||||
|
||||
}
|
||||
|
||||
return redirect()->route('depreciations.index')->with('error', trans('admin/depreciations/message.does_not_exist'));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue