Home > OS >  Route is working when referred but when I go to that provided link it will not find the controller f
Route is working when referred but when I go to that provided link it will not find the controller f

Time:12-10

I have added a custom function to save pictures and added the route as well and when I reference the route it does work but when visiting it gives error that the function can not be found with reflectionexception error ReflectionException

Function () does not exist

Controller

/**
*    show the form for uploading profile picture 
*    
*   @return \Illuminate\Http\Response 
*/
public function changePicture()
{

    return view('usersinformation.profilepicture');
}

route -- web.php

Route::get('usersinformation/changePicture',[usersinformationController::class, 'changePicture'])->name('usersinformation.changePicture');
Route::post('usersinformation/savePicture', 'usersinformationController@savePicture');

CodePudding user response:

you should add this line to above of web.php file.

use App\Http\Controllers\usersinformationController;

(if your controller is in default path) but if your controller path is different you should modify and add your path to the code.

CodePudding user response:

the issue resolved by adding below route.

Route::get('usersinformation/saveePicture', [
'as' => 'usersinformation.savePicture',
'uses' => 'usersinformationController@savePicture'

]);

  • Related