0
  <select name="car_id[]">
    //for each of cars
     </select>

I need to store many id to one column, will it be possible to use this?

  table_car =  car_id | car_desc
  table_owner = id | name | car_id

now the table owner should store many car_id. How it is possible on laravel 5? I am new to this thank you.

kalawadei
  • 25
  • 1
  • 7
  • Why do you need to store many ID's to one column, you're unable to update the database schema? I would suggest reading up on Laravel 5 and Eloquent and structure the relationships correctly. – giolliano sulit Aug 07 '17 at 06:48
  • Read [Is storing a delimited list in a database column really that bad?](http://stackoverflow.com/questions/3653462/is-storing-a-delimited-list-in-a-database-column-really-that-bad), where you will see a lot of reasons why the answer to this question is **Absolutely yes!** – Zohar Peled Aug 07 '17 at 07:12
  • so the best practice will be using eloquent and save like one to many relationship? how can I be able to save id on other table while adding details on the other one? @giollianosulit – kalawadei Aug 08 '17 at 00:53
  • You'd need to structure your database so that yes you have one-to-many or one-to-one relationships and in the migrations specify the foreign key relations. (Very broad suggestion, but it gives you an idea) – giolliano sulit Aug 08 '17 at 05:19

1 Answers1

0

yes, you can do it, for this you can use impload() or serialize() functions of PHP. what they do ?, using these methods you can convert a array in string and you can save it in single column.

for this ,

'car_id' column should be VARCHAR type.. 

Best of luck.