Best way is NOT to use Integer as a fieldname. It is bad praxis. But if you need, you should access the database with raw method:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
public function show()
{
$tests = DB::table('test')
->select("22 as twentytwo")
->get();
foreach($tests as $test){
Log::info($test->twentytwo);
}
}
<!-- end snippet -->
insert and update like this
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
$obj=new Modelname();
$myfield = 22;
$obj->$myfield="anything";
<!-- end snippet -->
Best way is NOT to use Integer as a fieldname. It is bad praxis.
But if you need, you should access the database with raw method:
public function show()
{
$tests = DB::table('test')
->select("22 as twentytwo")
->get();
foreach($tests as $test){
Log::info($test->twentytwo);
}
}