title: Laravel 4 : Passing data from database to view
body: <p>I wish to make a select box containing some categories of items. This select box should have the data from database.
  so first i created my blade </p>
  
  <p>admin.blade.php :</p>
  
  <pre><code>    &lt;h2&gt;Add Category&lt;/h2&gt;
      {{ HTML::ul($errors-&gt;all(), array('class'=&gt;'errors')) }}
      {{ Form::open(array( 'url'=&gt;'admin/category/add', $title="Admin Control Panel")) }}
  
      &lt;p&gt;
      {{ Form::label('Category Name:') }}
      {{ Form::text('category_name', Input::old('category_name'))  }}
     &lt;/p&gt;
  
      &lt;p&gt;
      {{ Form::select('parent_category',  array('' =&gt; 'Select Category', '0 ' =&gt; 'Main Category',))  }}
      {{ Form::label('Parent Category:') }}   
     &lt;/p&gt;
  
  
      &lt;p&gt;
      {{ Form::submit('Submit', array('name' =&gt; 'save')) }}
      &lt;/p&gt;
      {{ Form::close() }}
  </code></pre>
  
  <p>and then i created my controller:</p>
  
  <pre><code>    class CategoryController extends BaseController  
      {
      public function add()
      {
      $category_list = CategoryModel::select();
      return View::make('admin')-&gt;with('category_list', $category_list);
      }
  </code></pre>
  
  <p>i need to display this array in my select box. but i don't know how to do that. please suggest a proper way!</p>
  
  <p>thanks!</p>