3

I have a form in a page (blade) which redirects to a route which is to call a function in a controller however it does not even go inside the function because even a simple dd(); cannot be executed. when in route, if I change to

Route::post('edit/profile', function(Request $request){
dd($request);
});

it works. I tried to change both route's function name and controller's function name to another name still doesn't recognize.

My current route

Route::post('edit/profile', 'Auth\LoginController@updateUser');

My form line

<form action="{{url('/edit/profile')}}" method="post">
{{ csrf_field() }}

My function inside LoginController

public function updateUser(Request $request)
{
    //insert code here
}
13
  • Do you get any errors? Commented Aug 2, 2017 at 14:41
  • no error just redirected to the same page where my form is at Commented Aug 2, 2017 at 14:41
  • 1
    Tried composer dump-autoload ? Commented Aug 2, 2017 at 14:45
  • yep, i tried view:clear, cache:clear, and composer dumpautoload Commented Aug 2, 2017 at 14:46
  • 1
    Yes after submit of form it just reload the page Commented Aug 2, 2017 at 15:29

1 Answer 1

4

I know it's late, but did you solve the problem? I've had a simmilar issue, inside auth group a route was not working. In my case, I had to put the route after the "Route::resource". So make sure if your are making a route that has a resource tagged, add the other routes before the Route::resource. For example:

Route::group(['middleware' => ['auth']], function() { 
   Route::resource('category', 'CategoryController');
   Route::get('category/order', 'CategoryController@order')->name('categoryOrder');
});

This won't work. Just put the 'category/order' route before the resource route like this:

Route::group(['middleware' => ['auth']], function() { 
   Route::get('category/order', 'CategoryController@order')->name('categoryOrder');
   Route::resource('category', 'CategoryController');
 });

This should work. Hope this helps someone.

Sign up to request clarification or add additional context in comments.

1 Comment

I am amazed and seriously I spent many hours behind this but couldn't find the issue. I still don't understand why it works this way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.