Support the ongoing development of Laravel.io →
Input Database Forms
Last updated 7 months ago.
0

How are you storing these "interests" in your database? Have you set them up as a one-to-many or many-to-many relation?

Also, it would probably be best to specify exactly the fields you're populating in your model, instead of using Input::all(), to avoid injection exploits.

Last updated 7 months ago.
0

Hi, I am planning to store them as comma seperated values in a string.

Last updated 7 months ago.
0

If you're determined to use Input::all() you could set an event listener on your model and change the value of the array before saving... Change it to json, maybe, using json_encode().

http://laravel.com/docs/eloquent#model-events

Also, don't forget to protect the app from mass injection.

Last updated 7 months ago.
0

Yes, already protecting and accepting only certain fields with $protected

Last updated 7 months ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

lorvent lorvent Joined 12 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.