How to use withErrors with Exception error messages in Laravel

0 votes

Assume that I have this Exception Message

catch (Cartalyst\Sentry\Users\LoginRequiredException $e)
{
     echo 'Login field is required.';
}

How can I pass this message Login field is required using withErrors()?

return Redirect::to('admin/users/create')->withInput()->withErrors();
Oct 28, 2020 in Laravel by kartik
• 37,520 points
4,838 views

1 answer to this question.

0 votes

Hello @kartik,

Try this:

return Redirect::to('admin/users/create')
       ->withInput()
       ->withErrors(array('message' => 'Login field is required.'));

Thank You!!

answered Oct 28, 2020 by Niroj
• 82,840 points

Related Questions In Laravel

0 votes
1 answer

How to pass CSRF token with ajax request in Laravel?

Hey, In between head, tag put <meta name="csrf-token" ...READ MORE

answered Mar 24, 2020 in Laravel by Dey
39,800 views
0 votes
1 answer

How to make a constant and use globally in laravel?

Hii, You can create a constants.php page in config folder ...READ MORE

answered Mar 24, 2020 in Laravel by Niroj
• 82,840 points
4,065 views
0 votes
1 answer

Error:login in Laravel. How to solve?

Hey, First check if your model login has a field password in ...READ MORE

answered Mar 26, 2020 in Laravel by Niroj
• 82,840 points
7,728 views
+1 vote
3 answers

Error: Exception file_put_contents failed to open stream: No such file or directory in Laravel?

Hello, You should typically run the php artisan config:cache command ...READ MORE

answered Mar 31, 2020 in Laravel by Niroj
• 82,840 points
48,827 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,021 views
0 votes
1 answer

What is redirection in Laravel?

Named route is used to give specific ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
2,999 views
0 votes
1 answer

How to install Laravel via composer?

Hello, This is simple you just need to ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
2,922 views
+1 vote
1 answer

What are named routes in Laravel and How can specify route names for controller actions?

Hey @kartik, Named routing is another amazing feature of ...READ MORE

answered Mar 23, 2020 in Laravel by Niroj
• 82,840 points
44,748 views
0 votes
1 answer

How to use Stored Procedures in Laravel?

Hey, To create a Stored Procedure you can ...READ MORE

answered Mar 24, 2020 in Laravel by Niroj
• 82,840 points
4,986 views
0 votes
1 answer

How to use mail() in laravel?

Hello, Laravel provides a powerful and clean API ...READ MORE

answered Mar 24, 2020 in Laravel by Niroj
• 82,840 points
942 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP