I have a problem with my form in laravel, So my project structure is:
controllers/
administration/
NewsController.php
in NewsController I have a method call : postCreate():
public function postCreate(){
$validator = Validator::make(Input::all(), \News::$rules);
if($validator->passes()){
$news = new \News();
$news->title = Input::get('title');
$news->content = Input::get('content');
$news->author = Input::get('author');
$news->type = Input::get('type');
$image = Input::file('file');
$filename = time().".".$image->getClientOriginalExtension();
$path = public_path('content/images/' . $filename);
Image::make($image->getRealPath())->resize(468,249)->save($path);
$news->image = 'content/images/'.$filename;
$news->save();
return Redirect::to('/administration/news/add')
->with('message','Succes');
}
return Redirect::to('/administration/news/add')
->with('message','Error')
->withErrors($validator)
->withInput();
}
My form have action :
{{ Form::open(array('url'=>'administration/news/create', 'files'=>true)) }}
{{ Form::close() }}
My route:
Route::post('/administration/news/create', array('uses'=>'App\Controllers\Administration \NewsController@postCreate'));
But when I submit I get an error:
Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException
I don't understand where is my problem.