title: Initialize function to run once only
body: <p>I'm inside a Laravel controller. I only want the <code>init()</code> method to fire <em>once</em>. What actually happens is, it fires every time I run the controller/methods via a browser?</p>
  <pre><code>class MyController extends Controller
  {
   public function __construct()
   {
      static $init_called = false;
      if(!$init_called){
          $init_called = true;
          $this-&gt;init();
      }
   }
  
   public function init()
   {
    // initialize code here, execute 'once' only
   }
  
   public function routeOne(){}
  
   public function routeTwo(){}
  }
  </code></pre>