mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Move the early return to the controller instead of the Label model
This commit is contained in:
parent
085a993340
commit
91b1cc7121
|
@ -58,8 +58,14 @@ class BulkAssetsController extends Controller
|
||||||
switch ($request->input('bulk_actions')) {
|
switch ($request->input('bulk_actions')) {
|
||||||
case 'labels':
|
case 'labels':
|
||||||
$this->authorize('view', Asset::class);
|
$this->authorize('view', Asset::class);
|
||||||
|
$assets_found = Asset::find($asset_ids);
|
||||||
|
|
||||||
|
if ($assets_found->isEmpty()){
|
||||||
|
return redirect()->back();
|
||||||
|
}
|
||||||
|
|
||||||
return (new Label)
|
return (new Label)
|
||||||
->with('assets', Asset::find($asset_ids))
|
->with('assets', $assets_found)
|
||||||
->with('settings', Setting::getSettings())
|
->with('settings', Setting::getSettings())
|
||||||
->with('bulkedit', true)
|
->with('bulkedit', true)
|
||||||
->with('count', 0);
|
->with('count', 0);
|
||||||
|
|
|
@ -40,10 +40,6 @@ class Label implements View
|
||||||
$offset = $this->data->get('offset');
|
$offset = $this->data->get('offset');
|
||||||
$template = $this->data->get('template');
|
$template = $this->data->get('template');
|
||||||
|
|
||||||
if ($assets->isEmpty()){
|
|
||||||
return redirect()->back();
|
|
||||||
}
|
|
||||||
|
|
||||||
// If disabled, pass to legacy view
|
// If disabled, pass to legacy view
|
||||||
if ((!$settings->label2_enable) && (!$template)) {
|
if ((!$settings->label2_enable) && (!$template)) {
|
||||||
return view('hardware/labels')
|
return view('hardware/labels')
|
||||||
|
|
Loading…
Reference in a new issue