Blank Page After Submitting Form in Laravel

Promgrma

I want to add a record to my DB using Laravel but after submitting a form I get a blank screen and no logs. Here's my code:

public function store(Request $request)
    {
        foreach(Auth::user()->test as $data) {
                if($request->name == $data->name) {
                    return back()->with('wrong', trans('settings.isset.name')); 
                }
                else {
                    $this->validate($request, [
                        'name' => 'required',
                    ]);

                    $name = Name::store($request);

                    return back()->with('message', trans('settings.add.name')); 
                }
            }
    }

And there is, of course, a normal working form. Before when I didn't have foreach it was working, but not it isn't.

Jirka Vrba

I think that this can be caused when Auth::user()->test is empty. Therefore code inside the foreach loop is not executed and nothing is returned.

You could try putting the return statement to the end of function.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Spring security returns login page after submitting form

Laravel: blank page after login and then checking for roles

How to get the sucess message in the same page after submitting the contact form?

How to redirect confirmation page after submitting form in Laravel?

how to keep values in textfields after submitting a form in laravel 5.2

Page Source is not reflecting the changes after submitting a form through selenium

How to redirect to another HTML page after submitting a form?

Form clears after submitting

After submitting simple_form i get a blank page in show view

form in php not redirecting to page after submitting

React direct to a "thank you" page after submitting a form

Scraping web page that is only accesible after submitting aspx form

Laravel error after submitting form by hitting the Enter key

Laravel form submitting goes to another page

Redirect to contacts page after submitting form in laravel 4

I have a blank page after submitting a php mysqli update form,

Stop page from redirecting after submitting google form through AJAX

Blank page after Redirect::to() in Laravel 4.2

Laravel file validation after submitting form via jquery submit();

Rails - page is not loading after submitting form through ajax

localStorage page does not display after submitting form

Laravel submitting form gets page expired

redirect to another page after submitting a form

How to get the success message in the same page after submitting the form?

PHPMAILER, how to redirect to the thank you page after submitting the form?

After submitting form its showing success message on different page

"redirect" function of django is not and after submitting the form, user remains on same page

Getting blank page on submitting form

The page is getting reset on submitting form after a while in HTML, javascript