diff --git a/app/Http/Controllers/Users/UsersController.php b/app/Http/Controllers/Users/UsersController.php index ddef9e3b30..155024106c 100755 --- a/app/Http/Controllers/Users/UsersController.php +++ b/app/Http/Controllers/Users/UsersController.php @@ -617,7 +617,27 @@ class UsersController extends Controller } return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', compact('id'))); + } + public function printAllThings() + { + $this->authorize('view', User::class); + + $users = User::query() + ->with([ + 'assets', + 'accessories', + 'consumables', + 'licenses', + ]) + ->withTrashed() + ->get(); + + // @todo: more authorization + + return view('users.print') + ->with('users', $users) + ->with('settings', Setting::getSettings()); } /** diff --git a/routes/web/users.php b/routes/web/users.php index e55541a937..76c867519b 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -104,6 +104,8 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () { ] )->name('users.print'); + Route::get('print-all-things', [Users\UsersController::class, 'printAllThings'])->name('users.print-all-things'); + Route::post( '{userId}/email', [ @@ -153,4 +155,4 @@ Route::resource('users', Users\UsersController::class, [ 'middleware' => ['auth'], 'parameters' => ['user' => 'user_id'], 'except' => ['update'] -]); \ No newline at end of file +]);