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 in Laravel by kartik
• 35,300 points
32 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 by Niroj
• 76,540 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 in Laravel by Dey
3,633 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 in Laravel by Niroj
• 76,540 points
135 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 in Laravel by Niroj
• 76,540 points
807 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 in Laravel by Niroj
• 76,540 points
6,869 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 in Laravel by Niroj
• 76,540 points
3,435 views
0 votes
1 answer

What is redirection in Laravel?

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

answered Mar 18 in Laravel by Niroj
• 76,540 points
411 views
0 votes
1 answer

How to install Laravel via composer?

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

answered Mar 23 in Laravel by Niroj
• 76,540 points
281 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 in Laravel by Niroj
• 76,540 points
4,140 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 in Laravel by Niroj
• 76,540 points
1,275 views
0 votes
1 answer

How to use mail() in laravel?

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

answered Mar 24 in Laravel by Niroj
• 76,540 points
107 views