简体   繁体   中英

How to store multiple checkbox items in a single fields of users table so that if i want to search specific items i can do that in laravel?

I want to store it in single field

And when i search for single item it will find it out from that field

You can store it as json or array.

like this

["nursery", "U.K.G.(Upper Kinder Garten)", "STD Two"]

In get query, you can have them by using LIKE in your query.

return Model::where('your_column_name', 'LIKE', '%" . $request->value . "%')->get();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM