phplaravellaravel-5.4

Laravel - HTML is being removed from POST request


I am probably missing something really obvious here so forgive me if that's the case.

I have a HTML Editor on a form and when I post the HTML to my controller the HTML is gone and therefore is not getting saved to the database.

Please see the image below.

enter image description here

Controller Function (this runs)

public function update(Request $request,Template $template){

  dd($request->all()); // code stops here 


    $template->subject = $request->input('subject');
    $template->body = clean($request->input('body'),'custom'); 
    $template->save();

    return response()->json(['message' => trans('messages.template').' '.trans('messages.saved'), 'status' => 'success']);
}

Solution

  • I found the issue. I had some code that stripped all HTML from in the form of Middleware.

    Hopefully this will help anyone learning/taking over someone's code. Look in the App\Http\kernal.php file to see if there is anything overriding your request data.