Allow printing all users

This commit is contained in:
Marcus Moore 2024-09-19 17:27:25 -07:00
parent 2d2d5bdc7e
commit 5128fd49e6
No known key found for this signature in database
2 changed files with 23 additions and 1 deletions

View file

@ -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());
}
/**

View file

@ -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']
]);
]);