Skip to content

Commit

Permalink
Move the early return to the controller instead of the Label model
Browse files Browse the repository at this point in the history
  • Loading branch information
inietov committed Sep 5, 2023
1 parent 085a993 commit 91b1cc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 7 additions & 1 deletion app/Http/Controllers/Assets/BulkAssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,14 @@ public function edit(Request $request)
switch ($request->input('bulk_actions')) {
case 'labels':
$this->authorize('view', Asset::class);
$assets_found = Asset::find($asset_ids);

if ($assets_found->isEmpty()){
return redirect()->back();
}

return (new Label)
->with('assets', Asset::find($asset_ids))
->with('assets', $assets_found)
->with('settings', Setting::getSettings())
->with('bulkedit', true)
->with('count', 0);
Expand Down
4 changes: 0 additions & 4 deletions app/View/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public function render(callable $callback = null)
$assets = $this->data->get('assets');
$offset = $this->data->get('offset');
$template = $this->data->get('template');

if ($assets->isEmpty()){
return redirect()->back();
}

// If disabled, pass to legacy view
if ((!$settings->label2_enable) && (!$template)) {
Expand Down

0 comments on commit 91b1cc7

Please sign in to comment.