1
votes

I have an issue in my laravel 5.2 project. The main page has a form which post to the following URL myapp.com/check So i created a route for this like:

Route::post('/check', 'StatusController@index')->name('StatusPost');

When i open the home page, the form action URL is like:

http://myapp.com/check/

Here is the form code:

{!! Form::open(array('url' => route('StatusPost'), 'method' => 'post')) !!}
......
{!! Form::close() !!}

The problem is that laravel did not recognize the http://myapp.com/check/, if i remove the slash at the end, it works correctly.

EDIT

Route.php file:

Route::get('/', 'HomepageController@index')->name('home');

Route::get('/about', function () {
    return View::make('pages.about');
});

Route::get('/terms', function () {
    return View::make('pages.terms');
});

Route::get('/help', function () {
    return View::make('pages.help');
});

Route::get('/privacy', function () {
    return View::make('pages.privacy');
});


Route::post('/check', 'StatusController@index')->name('StatusPost');


Route::get('/{product}', 'StatusController@index')->where('product', '(.*)')->name('productStatus');

Any help to resolve this issue?

Thanks

2
can you show us your routes file?Wreigh
@WreighChristianSantos i added the content of route file, thankskarim
the error is MethodNotAllowed or a 404?Wreigh
@WreighChristianSantos no, it redirect to productStatus route, Route::get('/{product}', ...karim
try switching these lines Route::post('/check') and Route::get('/{product}')Wreigh

2 Answers

0
votes

Route you is a Route::resource -> StatusController ?

0
votes

Both of your Routes Route::post('/check') and Route::get('/{product}') use the same Controller function index