Skip to content

Instantly share code, notes, and snippets.

@dcrystalj
Created March 25, 2013 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcrystalj/5238278 to your computer and use it in GitHub Desktop.
Save dcrystalj/5238278 to your computer and use it in GitHub Desktop.
former simple form example
<?php
//view get_test.php
Former::text('name')->class('myclass')->autofocus(),
Former::text('surname')->class('myclass'),
Former::password('password'),
Former::actions()->submit('Submit'),
Former::close();
---------------------
// controller from laravel 3 not 4 !!!!
class Test_Controller extends Base_Controller {
public static $rules = array( 'name' => 'required|size:5|alpha',);
public function action_index()
{
return View::make('test.get_index');
}
public function action_test()
{
return View::make('test.get_test')->with('rules',self::$rules);
}
public function action_post($test)
{
$validation = Validator::make(Input::all(), self::$rules);
if($validation->fails()){
Input::flash();
return Redirect::back()->with_errors($validation)->with_input();
}
return View::make('test.get_index');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment