[Laravel] 取用特定view檔案 (get specific view file)

繁體中文:

Route::get('/users', function()
{
  $users = User::all();
  
  //以下三種方式都是可使用的方式,功能一樣,不同寫法。users.index會抓取app/views/users/index.blade.php
  //return View::make("users.index")->with("users", $users);
  //return View::make("users.index")->withUsers($users);
  return View::make("users.index", ["users" => $users]);
});

English Version:

Route::get('/users', function()
{
  $users = User::all();
  
  // These three method are the same.
  //return View::make("users.index")->with("users", $users);
  //return View::make("users.index")->withUsers($users);
  return View::make("users.index", ["users" => $users]);
});