Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form Data inputs is missing in update api controller. #54774

Closed
aidilrx04 opened this issue Feb 24, 2025 · 2 comments
Closed

Form Data inputs is missing in update api controller. #54774

aidilrx04 opened this issue Feb 24, 2025 · 2 comments

Comments

@aidilrx04
Copy link

aidilrx04 commented Feb 24, 2025

Laravel Version

11.31

PHP Version

8.2.12

Database Driver & Version

10.4.32-MariaDB

Description

The input form data is missing when tried to access from request in update of an api controller. However, the same thing does work perfectly fine inside a store method.

I've tried looking online and found no one mentioned this issue before.

Steps To Reproduce

  1. Create new project
  2. Install sanctum
  3. Create api controller(php artisan make:controller TestController --api)
  4. Simply return the request->all() inside update and store

Image

  1. Create route for that controller in api.php(Route::apiResource('tests', TestController::class))
  2. Send post/put request to the route
  3. See result
    Result from POST request to store method
    Image

Result from PUT request to update method, "test_data" field should be present as above
Image

@aidilrx04 aidilrx04 changed the title Form Data inputs in update api controller. Form Data inputs is missing in update api controller. Feb 24, 2025
@macropay-solutions
Copy link

macropay-solutions commented Feb 24, 2025

This is a known php issue
https://stackoverflow.com/a/50691997

Try to send data as x-www-form-urlencoded or json from postman, or if you need html form then you will see in the link a way to do it.

@aidilrx04
Copy link
Author

Alright, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants