title: Does Laravel has Rails' before_filters to bind variables into controller methods?
body: <p>I'm extremely newbie on Ruby on Rails. Started learning both Ruby and Ruby on Rails just few hours ago and trying to adapt it's DRY principles into my own Laravel codes.</p>
  
  <p>This is how my RoR looks like:</p>
  
  <pre><code>class WeddingController &lt; ApplicationController
  
      before_filter :get_wedding
  
      def get_wedding
          /*
             If Wedding.find(2) returns false, redirect homepage
             Else, bind @wedding into all methods for use
          */
      end
  
      def edit
          @wedding //this method has access to @wedding, which contains Wedding.find(2) data.
      end
  
      def update
          //Same as above method
      end
  
      def destroy
          //Same as above method, can do things like @wedding.destroy
      end
  end
  </code></pre>
  
  <p>This is how my Laravel looks like</p>
  
  <pre><code>class Wedding_Controller extends Base_Controller {
  
  public function edit($id)
  {
      if(Wedding::find($id) === false)
         return Redirect::to('/);
  
      //Edit code
  }
  
  public function update($id)
  {
      if(Wedding::find($id) === false)
         return Redirect::to('/);
  
      //Update code
  }
  
  public function destroy($id)
  {
      if(Wedding::find($id) === false)
         return Redirect::to('/);
  
      //Destroy code
  }
  }
  </code></pre>
  
  <ol>
  <li>How can I DRY <code>if(Wedding::find($id) === false)</code> checks to be like my RoR code?</li>
  <li>If <code>Wedding::find($id) returns actual Wedding data</code>, how can I inject it as <code>$wedding variable</code> in all specified methods? (Not looking for anything using class scope, if possible.)</li>
  </ol>
  
  <p>Thanks alot!</p>
  
  <p>Ps. For people who doesn't understand my RoR script; basically it does this.</p>
  
  <pre><code>Before any method call on this controller, execute get_wedding method first. 
  If get_wedding can't find the wedding in database, let it redirect to homepage.
  If get_wedding finds the wedding in database, inject returned value as @wedding variable to all methods so they can make use of it. (e.g destroy method calling @wedding.destroy() directly.)
  </code></pre>