Created
March 25, 2013 16:12
-
-
Save dcrystalj/5238278 to your computer and use it in GitHub Desktop.
former simple form example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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