title: Using $this when not in object context - in Laravel controller
body: <p>I am using Laravel and I have just moved my code that is working locally into Live and am getting the exception below within my 'User' controller:</p>
  
  <pre><code>Unhandled Exception
  Message:
  Using $this when not in object context
  </code></pre>
  
  <p>The strange thing is, that this IS a class and works locally fine so I don't expect the solution to be using the static notation. It's only when I promote this to Live that I get this error. Could it be that something in the Laravel core that is missing from Live that is not loading the controller class properly?</p>
  
  <p>Has anyone experienced this after promoting their code to Live? any ideas?</p>
  
  <p>UPDATED: snippet of code where error is occuring. remember this code works locally so i believe something is missing rather than this code needs to be changed to fix this issue.</p>
  
  <p>
  
  <pre><code>class User_Controller extends Base_Controller {
  
  ...
  
  public function action_register() {
     ...
      if ($user) {
          //Create the Contact
          DB::transaction(function() use ($user_id) {
              $org = $this-&gt;create_org($user_id); //failing on this line with exception. btw $user is created fine
              $this-&gt;create_contact($org-&gt;id);
              $this-&gt;create_address($org-&gt;id);
      });
  
      private function create_org($user_id) {
          $result = Org_type::where('name','=',$_POST['org_type'])-&gt;first();
  
          $org = Org::Create(
              array(
                  'name' =&gt; $_POST['org_name'],
                  'user_id' =&gt; $user_id,
                  'org_type_id' =&gt; $result-&gt;id,
              )
          );
          return $org;
      }
  </code></pre>
  
  <p>...</p>