Change controller to assume a collection. (This is dumb, but whatever)

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-10-03 16:19:27 +01:00
parent 3c0f4181ae
commit 7461c3e0ca

View file

@ -194,14 +194,14 @@ class ProfileController extends Controller
*/ */
public function printInventory() : View public function printInventory() : View
{ {
$show_user = auth()->user(); $show_users = User::where('id',auth()->user()->id)->get();
return view('users/print') return view('users/print')
->with('assets', auth()->user()->assets) ->with('assets', auth()->user()->assets())
->with('licenses', $show_user->licenses()->get()) ->with('licenses', auth()->user()->licenses()->get())
->with('accessories', $show_user->accessories()->get()) ->with('accessories', auth()->user()->accessories()->get())
->with('consumables', $show_user->consumables()->get()) ->with('consumables', auth()->user()->consumables()->get())
->with('show_user', $show_user) ->with('users', $show_users)
->with('settings', Setting::getSettings()); ->with('settings', Setting::getSettings());
} }
@ -222,7 +222,12 @@ class ProfileController extends Controller
return redirect()->back()->with('error', trans('admin/users/message.user_has_no_email')); return redirect()->back()->with('error', trans('admin/users/message.user_has_no_email'));
} }
try {
$user->notify((new CurrentInventory($user))); $user->notify((new CurrentInventory($user)));
} catch (\Exception $e) {
\Log::error($e);
}
return redirect()->back()->with('success', trans('admin/users/general.user_notified')); return redirect()->back()->with('success', trans('admin/users/general.user_notified'));
} }
} }