laravel how to access column with number name of a table?

后端 未结 12 1274
闹比i
闹比i 2020-12-18 19:11

I make a table with number 22 as the column name. How to access this column?

content:

I\'ve tryed thest

$obj = Tablename::f         


        
12条回答
  •  再見小時候
    2020-12-18 20:05

    if you always know the name is 22, you can do this.

     $myfield = 22;
     dd($obj->$myfield);
    

    I tested it and it returns the value in the 22 field correctly.

提交回复
热议问题