il affiche un erreur quand j'appue sur submit pour ajouter a la base
je croit avec Form::open()
ou
le routage, et j'arrive pas a le trouvé
au niveau de controller:
page
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 public function postCreate(){ Author::create(array( 'name'=>Input::get('name'), 'bio'=>Input::get('bio') )); return Redirect::route('authors') ->with('message','author was created successfully'); }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 <h1>Add new author</h1> {{ Form::open(array('url' => 'authors/create', 'method' => 'POST')) }} <p> {{ Form::label('name', 'Name:') }}</br> {{ Form::input('name', 'text') }} </p> <p> {{ Form::label('bio', 'Biography:') }}</br> {{ Form::textarea('bio') }} </p> <p>{{ Form::submit('Add author') }}</p> {{ Form::close() }}
root:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 Route::post('authors/create', array('uses'=>'AuthorsController@postCreate'));
Partager