title: Laravel how to save HTML to database and then retrieve it
body: <p>This question was already asked, however, I still didn't get anything working properly.</p>
  
  <p>I am trying to create a functionality in my Admin Panel on my Laravel App that allow user to paste ad codes that then will be rendered in specific parts of the laravel app.</p>
  
  <p>I already have my view:</p>
  
  <pre><code>&lt;form action="{{ route('update.ads', $ads-&gt;id) }}" method="POST" class="form-horizontal"&gt;
                  {{ csrf_field() }}
          &lt;div class="form-group"&gt;
              &lt;label class="control-label col-sm-12" &gt;Ad1 (Interstitial or popup on Homepage)&lt;/label&gt;
              &lt;div class="col-sm-10"&gt;
                  &lt;input type="text" name="ad1" id="ad1" class="form-control" value="{{ $ads-&gt;ad1 }}"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;label class="control-label col-sm-12" &gt;Ad2 (Video Page - Banner Desktop)&lt;/label&gt;
              &lt;div class="col-sm-10"&gt;
                  &lt;input type="text" name="ad2" id="ad2" class="form-control" value="{{ $ads-&gt;ad2 }}"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;label class="control-label col-sm-12" &gt;Ad3 (Video Page - Banner Mobile)&lt;/label&gt;
              &lt;div class="col-sm-10"&gt;
                  &lt;input type="text" name="ad3" id="ad3" class="form-control" value="{{ $ads-&gt;ad3 }}"&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
          &lt;div class="form-group"&gt;
              &lt;div class="col-sm-offset-2 col-sm-10"&gt;
                  &lt;input type="submit" class="btn btn-info" value="Update" /&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I have my controller:</p>
  
  <pre><code>public function updateAds($id, Request $request){
  
      $this-&gt;validate($request, [
          'ad1',
          'ad2',
          'ad3'
      ]);
  
  
      $adsData = $request-&gt;only(["ad1","ad2","ad3"]);
  
      $adsData['ad1'] = htmlentities($adsData['ad1']);
      $adsData['ad2'] = htmlentities($adsData['ad2']);
      $adsData['ad3'] = htmlentities($adsData['ad3']);
  
      Ad::find($id)-&gt;update($adsData);
  
      Session::flash('success_msg', 'Ads updated successfully!');
  
      return redirect()-&gt;route('admin.ads');
  }
  </code></pre>
  
  <p>Data is saved, but then when i try to retrieve it on my pages, no matter what code i write, the content will always be text. It is never rendered as code.</p>
  
  <p>Here is what i have tried in terms of output:</p>
  
  <pre><code>{{ addslashes(htmlspecialchars_decode($ads-&gt;ad1)) }}
  
  {{ htmlspecialchars_decode($ads-&gt;ad1) }}
  </code></pre>
  
  <p>Thank you all for your help!
  Regards,
  Tiago</p>