Fixes Email List of All Assigned being "successful" when the user has no email

Added check in view to disable button if there is no email
Added translation for title on disabled button and for email check in controller
Fixed missing trans for user not found message
This commit is contained in:
mikeroq
2022-07-11 20:02:10 -05:00
parent bb091760af
commit 5efe45226d
3 changed files with 21 additions and 14 deletions
@@ -628,14 +628,16 @@ class UsersController extends Controller
{
$this->authorize('view', User::class);
if( User::where('id', $id)->first()->exists())
{
$user= User::where('id', $id)->first();
$user->notify((new CurrentInventory($user)));
return redirect()->back()->with('success', trans('admin/users/general.user_notified'));
}
if (!$user = User::find($id)) {
return redirect()->back()
->with('error', trans('admin/users/message.user_not_found', ['id' => $id]));
}
if (empty($user->email)) {
return redirect()->back()->with('error', trans('admin/users/message.user_has_no_email'));
}
return redirect()->back()->with('error', 'admin/accessories/message.user_does_not_exist');
$user->notify((new CurrentInventory($user)));
return redirect()->back()->with('success', trans('admin/users/general.user_notified'));
}
/**