routes.php
Route::get('/',array('uses'=>'student@index'));
Route::get('/view',array('uses'=>'student@view'));
Route::post('/save',array('uses'=>'student@save'));
This is the code and I am working on form and when I submit the form, it shows this error:
MethodNotAllowedHttpException in RouteCollection.php line 201:
student.php
class student extends Controller {
public function index()
{
//return 'hello world';
return \View::make('student.index');
}
public function view()
{
return \View::make('student.view');
}
public function save()
{
//return \View::make('student.view');
$validation= array(
'first_name'=>'required',
'email'=>'required'
);
$v1=validator::make(Input::all(),$validation);
if( $v1->fails())
{
return Redirect::to('view')->withErrors($v1);
}
else
{ $poststudent=Input::all();
$data = array('first_name'=>$poststudent['first_name'],
'last_name'=>$poststudent['last_name'],
'email'=>$poststudent['email'],
'interested'=>$poststudent['interested'],
'skills'=>$poststudent['skills']);
$check=0;
$check=DB::table('students')->insert($data);
if($check > 0)
{
return Redirect::to('/');
}
else
{
return Redirect::to('/view');
}
}
}
}
Form is like this:
<form action="<?=URL::to('/save')?>" methed="POST">
<div class="form-group">
<label for= "first_name"> FIRST NAME </label>
<input name="FIRST NAME" type="text" value="" class="form-control" id="first name"/>
</div>
I am stuck here.