[Laravel] create form and save data

app/controllers/UsersController.php

  // 會使用users/create.blade.php這個view檔,來建立表單
  public function create(){
    return View::make("users/create");
  }
  // 儲存資料
  public function store(){
    $user = new User;
    $user->username = Input::get("username");
    $user->password = Hash::make( Input::get("password") );
    $user->save();
    
    //return Redirect::to("/users");  // use url method
    return Redirect::route('users.index');  // use route name
    
    //return Input::all();  // get post data
    //return Input::get("username");  // get post username data
  }

app/views/users/create.blade.php

@extends("layouts.default")
@section('content')
  <h1>Create New User</h1>
  
  {{ Form::open(["route" => "users.store"]) }}
    <div>
      {{ Form::label("username", 'Username: ') }}
      {{-- {{ Form::input("text", "username") }} --}}
      {{-- Form::checkbox("username") --}}
      {{ Form::text("username") }}
      
    </div>
    <div>
      {{ Form::label("password", 'Password: ') }}
      {{-- {{ Form::input("password", "username") }} --}}
      {{ Form::password("password") }}
    </div>
    
    <div>
      {{ Form::submit("Create User") }}
    </div>
    
  {{ Form::close() }}
@stop