I just have a very simple product category creation form in laravel , like so:
{{ Form::open(array('url'=>'admin/category/create')) }}
<p>
{{ Form::label('name') }}
{{ Form::text('name') }}
</p>
{{ Form::submit('Create Category' , array('class'=>'secondary-cart-btn')) }}
{{ Form::close() }}
For the create method i have the following code:
public function postCreate() {
$validator = Validator::make(Input::all() , Category::$rules);
if($validator->passes()) {
$category = new Category;
$category->name = Input::get('name');
$category->save();
return Redirect::to('admin/categories/index')
->with('message' , 'Category created');
}
return Redirect::to('admin/categories/index')
->with('message' , 'something went wrong')
->withError($validator)
->withInput();
}
Now when i click on the submit button, i get the following error:
C:\xampp\htdocs\ecomm\bootstrap\compiled.php
if (!is_null($route)) { return $route->bind($request); } $others = $this->checkForAlternateVerbs($request); if (count($others) > 0) { return $this->getOtherMethodsRoute($request, $others); } throw new NotFoundHttpException(); } protected function checkForAlternateVerbs($request)
You can see the error more visvually HERE.
What am i doing wrong ?
return 'true';
after $validator->passes(); If it's returning the word TRUE? – aldrin27