lundi 19 mars 2018

Form action is not working with Laravel resource Controller. It is returning me in the same page

I am really confused. When I return just "ok" from my controller store function, it is returning "ok" but When I'm going to store the request, it is not working. It is returning the same page. Here is my form:

<form role="form" action="" method="post" enctype="multipart/form-data">
 
 <input type="text" name="title" id="title" value="" class="form-control">
 <textarea id="mytextarea" name="mytextarea" class="form-control"></textarea>

Here is my Controller:

 public function store(Request $request)
{
    // return "ok";
    $this->validate($request,[
        'title'=>'required',
        ]);
    $idea = new Idea;
    $idea->title = $request->title;
    $idea->content = $request->mytextarea;
    $idea->save();
    return redirect(route('idea.index'))->with('message','Post has been Created successfully');
}

Here is my Route:

Route::resource('idea','User\IdeaController');

NB: I'm using TinyMCE editor for textarea



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2potfAc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire