mercredi 1 août 2018

Laravel (1/1) NotFoundHttpException in RouteCollection.php line 179

I've encountered a problem submitting my form in laravel. My form structure looks this.

<form  class="form-group" action="" 
method="post" name="publish" enctype="multipart/form-data"  
onsubmit="return validateForm();">
   <input type="text" name="user">
   <textarea name="poem"></textarea>
   <input type="submit" value="save">
</form>

My web.php file has this route.

Route::post('/writepoem', ['uses'=>'PoemController@postCreatePoem','as'=>'writepoem']);

My PoemController.

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Poem;

class PoemController extends Controller
{ 
    public function postCreatePoem(Request $request)
    {   
        //validation
        $poem=new Poem();
        $poem->poem=$request['poem'];
        $poem->poem=$request['user'];



        //save poem
        $request->user()->poems()->save($poem);
        return redirect()->route('feed');
    }
}

On submitting my form I get this Exception.

(1/1) NotFoundHttpException

in RouteCollection.php line 179.

What could be the issue with routing?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire