When I give a name to my endpoint defined in my plugin's routes.php and try to access the endpoint by browser, it throws an error showing like;
Function name must be a string
/path/to/my/src/vendor/laravel/framework/src/Illuminate/Routing/Route.php line 197
I followed the October document and it looks something like below in plugins/me/myplugin/routes.php
;
Route::get(
'api/v1/my/endpoint',
['as' => 'myEndpoint', 'Me\MyPlugin\Http\MyEndpoint@show']
);
On the other hand, getting the URL by the name is fine with the both ways below.
$url = Url::route('myEndpoint');
or
$url = route('myEndpoint');
Then, I tried the way described in Laravel 5.5 document, like below;
Route::get(
'api/v1/my/endpoint',
'Me\MyPlugin\Http\MyEndpoint@show'
)->name('myEndpoint');
Now, accessing the endpoint by browser is fine, but, getting the URL by the name gives an error.
Route [myEndpoint] not defined.
/path/to/my/src/vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php line 305
Am I doing something wrong?