laravel无法在app / http / controller / productController.php中创建函数

Look at the image. I create changeName function inside the controller but it does not work.

My route :

Route::resource('products','ProductController');

why?

I tried to check all the syntax and it is correct.

enter image description here

enter image description here

By the first image you posted I suppose you mean it doesn't appear on the routes, is that right? If so, it's because you need to define the route on the the routes/web.php file. For example like that :

Route::get('/changeName', 'ProductController@changeName');