You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To prevent unnecessary responses regarding assigning an empty array to the 'scoped' value in the options of apiResources, I'm leaving the 'scoped' method below. It seems that when accessed through 'apiResource', it's used without parameters, accepting an empty array. However, I might be mistaken. I apologize in advance for this.
namespaceIlluminate\Routing;
class PendingResourceRegistration
{
/** * Indicate that the resource routes should be scoped using the given binding fields. * * @param array $fields * @return \Illuminate\Routing\PendingResourceRegistration */publicfunctionscoped(array$fields = [])
{
$this->options['bindingFields'] = $fields;
return$this;
}
}
Steps To Reproduce
1. Create a simple posts and comments relationship in your Laravel project.
2. Create a nested route as posts.comments using the apiResource method in your routes. Don't forget to add the 'scoped' method as well.
3. Attempt to retrieve a specific comment belonging to a post via Postman. Then try to fetch an unassociated comment.
4. Now, create a nested route as posts.comments using the apiResources method in your routes. Also, pass an empty array to the 'scoped' option in the options parameter.
Can you first please try one of the support channels below? If you can actually identify this as a bug, feel free to open up a new issue with a link to the original one and we'll gladly help you out.
Laravel Version
10.41.0
PHP Version
8.2.12
Database Driver & Version
mariadb Ver 15.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper | Linux shahmal1yev 6.5.0-kali3-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.6-1kali1 (2023-10-09) x86_64 GNU/Linux
Description
I'm not entirely sure if this is a genuine bug, but I wanted to report it anyway. Perhaps I'm doing something wrong. But the situation is as follows:
It works correctly this way. Trials are conducted as follows:
Example 1
Postman Request:
Postman Output:
Postman Request:
Note: The company actually exists.
Example 2
Postman Request 1:
Postman Request 2:
To prevent unnecessary responses regarding assigning an empty array to the 'scoped' value in the options of apiResources, I'm leaving the 'scoped' method below. It seems that when accessed through 'apiResource', it's used without parameters, accepting an empty array. However, I might be mistaken. I apologize in advance for this.
Steps To Reproduce
1. Create a simple posts and comments relationship in your Laravel project.
2. Create a nested route as posts.comments using the apiResource method in your routes. Don't forget to add the 'scoped' method as well.
3. Attempt to retrieve a specific comment belonging to a post via Postman. Then try to fetch an unassociated comment.
4. Now, create a nested route as posts.comments using the apiResources method in your routes. Also, pass an empty array to the 'scoped' option in the options parameter.
5. Repeat step 3 and examine the situation.
The text was updated successfully, but these errors were encountered: