lundi 17 décembre 2018

Laravel: simple form get request returns 500 error

I have this form that I want to submit which is in the view 'blog'. Now when I navigate to the view blog it says the error message oops something.. and I get an 500 error. I'm not able to find the error..

 <form action="" id="editForm" class="editForm">
                        @csrf
                        <input type="hidden" name="id" value="">
                        <input type="hidden" name="text" value="">
                        <button type="submit" class="btn-lg btn-dark">
                            <i class="fa fa-pencil" aria-hidden="true"></i>
                        </button>
                    </form>

My web.php route looks like this:

Route::get('editBlog/{id}/{text}','BlogController@edit')->name('editBlog');

And My Controller looks like this:

<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;


class BlogController extends Controller
{

   function edit($id,$text)
    {
        return view('edit', ['id' => $id, 'content' => $text]);
    }
}

The view edit exists and is in the right directory.

Thanks in advance!

EDIT: When I take out the code of the form, the view works fine.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire