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
Create or update model from request #309
Comments
Not entirely sure how this would work. This would need to be generic. I think the solution here is to just pass the dictionary from whatever object here like in your example: User.create(
request.only("first_name", "last_name", "email")
) The other option would be to set a generic method on the object like Best approach here is to just make a method on the model that converts the model to a dictionary. Closing but still open for ideas |
I am totally okay with this approach:
|
@girardinsamuel This feature would be similar with RequestForm from Laravel? |
@Marlysson not sure what it is exactly, but on a Laravel code I have seen this: |
I confirm it's working with existing masonite orm features |
I was wondering if there was a quicker way to create/update a model from request data
I have an an example here
https://github.com/girardinsamuel/pingcrm-masonite/blob/fix/3.0/app/http/controllers/UsersController.py#L86
where I want to create a user with data contained in request (which should be validated first). I would like to be able to write something like :
or
or
and right now I am a doing this
The text was updated successfully, but these errors were encountered: