0

I have a mysql table with dozens of columns. There are set of VARCHAR columns (s1, s2, s...) to store string values, INT columns (n1, n2, n...) to store integer values, and so on...

Depending on the type of the data to be stored in this table, I should pick the columns for the CRUD operations.

That is, if I need to query the table to fetch the records belonging to type 'X', then I should know that the columns being used to store data related to type 'X' are, say, s1, s3, s4 and n3, and so on...

If I want to store data belonging to type 'X', then the table columns to be used (s1, s3, s4 and n3) in insert statement has to be determined as well.

(I hope I am clear enough for you to understand my requirement)

Lakmal Premaratne
  • 1,159
  • 7
  • 18
  • 34
  • What I want is column alias functionality. That is, if I 'assign' `order_id` to be `s1` column, then if I do `$object->order_id`, it actually refers `s1` column of the actual database table. But I want all the CRUD operations be supported as well. – Lakmal Premaratne Aug 09 '17 at 19:01
  • Accessors and Mutators could be used. ref: https://stackoverflow.com/questions/17174837/laravel-4-eloquent-column-alias – Lakmal Premaratne Aug 09 '17 at 19:28

0 Answers0