title: define simple function to use in all view (laravel4.2)
body: <p>i have a getCategory function in my controller:</p>
  
  <pre><code>  function getCategory($id){
                  $category=UserBlogCategory::find($id);
                  return $category-&gt;name;
              }
  </code></pre>
  
  <p>and i want to use to my view:</p>
  
  <pre><code>echo getCategory($user_blog-&gt;category_id);
  </code></pre>
  
  <p>and i get this error:
  Call to undefined function getCategory()</p>
  
  <p>i already put getCategory in view and it was worked, but i want to use myfunction in any part of my project.</p>