FreeHostia Forums https://forum.freehostia.com/ |
|
Laravel get JSON array from database https://forum.freehostia.com/viewtopic.php?f=7&t=66345 |
Page 1 of 1 |
Author: | Grehnan09 [ Fri Oct 07, 2022 5:09 am ] |
Post subject: | Laravel get JSON array from database |
What is the best way in Laravel to store an array in your database? And how do I get the same array with a query? I have a variable that's an array in an array: $colors = array(array('green'), array('yellow', 'white')); When I store $colors, my database (column type = json) save it as: [["green"], ["yellow", "white"]] But when I try to get it from a query, I couldn't get the same array as $colors. My query: $colors = DB::table('colors') ->where('id', '1') ->value('arraycolors'); I hope someone can help how to query an array. Thanks a lot! |
Author: | Miles [ Sat Oct 08, 2022 4:18 pm ] |
Post subject: | Re: Laravel get JSON array from database |
Hello Search online for Laravel-specific forums for your requests. We do not offer script development or debugging and the forum is intended only for our system services. Thank you for your understanding on this matter. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |