title: Adding a backslash to the end of a PHP string
body: <p>I'm attempting to do a basic query in Laravel by querying a table that holds polymorphic relationships. The table has a column called <code>record_type</code> which holds values such as <code>App\MedicationError</code> and <code>App\PressureUlcer</code>. </p>
  
  <p>I want to run a query similar to this:</p>
  
  <pre><code>`Action::where('record_type','App\MedicationError')`
  </code></pre>
  
  <p>I have a set of variables containing strings like <code>MedicationError</code> and <code>PressureUlcer</code>.</p>
  
  <p>How would I go about prefixing those strings with <code>App\</code>?</p>
  
  <p>The reason I am having difficulty myself is I cannot work out how to add a backslash to the end of my <code>'App'</code> string. This is what I am trying at the moment:</p>
  
  <pre><code>$type = 'App\\ '.studly_case($record-&gt;type);
  </code></pre>
  
  <p>But it returns  <code>App\\ RiskAssessmentUpdate</code>. If I remove the space from the end the backslash obviously escapes the single quote. <code>trim('App\\ ')</code> doesn't help either.</p>
  
  <p>I feel like I'm missing a really obvious (regex?) solution here. Any help would be appreciated.</p>