title: How to work with Views without using PHP's "compact" function in LARAVEL
body: <p>I'm working on laravel to fetch data from database and store that data or array of data into the variable like $tasks store data of tasks table from database up till everything is fine but during processing the $task variable it is necessary to use "compact" function ?</p>
  
  <p>And can anyone explain this</p>
  
  <pre><code>Route::get('/test', function () {
  
  $data   =   [
                  'name'  =&gt;  'Vrushal',
                  'last'  =&gt;  'Raut',
                  'tasks' =&gt;  [
                                  'Programming',
                                  'UI/UX Developement',
                                  'Cloud Expert'
                              ]
              ];
              //return view('templates/test', compact($data)); //NOT WORKING
              //return view('templates/test', $data); // ITS WORKING
              return View::make('templates/test',$data); // ITS WORKING
  }); 
  </code></pre>
  
  <p>As well as with Database plz explain this</p>
  
  <pre><code>Route::get('/tasks', function(){
  
  $tasks  =   DB::table('tasks')-&gt;get();
  
  return view('templates/tasks', compact('tasks')); // ITS WORKING
  //return View::make('templates/test',$tasks); // NOT WORKING
  });
  </code></pre>
  
  <p>Thanks in Advance!</p>