title: "Fatal error: Class 'DB' not found" from public php file
body: <p>I have just started using Laravel and I would like to be able to access the DB class from within a php file of which is located within the public folder. </p>
  
  <p>I get the <strong>error</strong> </p>
  
  <blockquote>
    <p>"Fatal error: Class 'DB' not found"</p>
  </blockquote>
  
  <p>. The php file is accessed by an AJAX require therefore there is no routing to this file</p>
  
  <p>How do I allow my php file to access this class and similar classes to this that are available in Laravel?</p>
  
  <p>File Path: </p>
  
  <p><strong>public/php/ajaxLogin.php</strong></p>
  
  <pre><code>function getPrimaryAdd($user) {
      $result = DB::table('users')
          -&gt;join('address', 'user_address.address_id', '=', 'address.address_id')
          -&gt;select('address.address_id', 'longitude', 'latitude')
          -&gt;where('user_id', $user)
          -&gt;limit(1);
  }
  </code></pre>