包含空格的自定义列名称 Laravel 4
Custom Column Names having spaces Laravel 4
我想使用具有 spaces.How 的自定义列名称,我可以使用 Laravel 4 编写查询吗?
我试过了
$org = Org::select('name as Organization Name')->where('id',$user->orgId);
$org = Org::select('name as "Organization Name"')->where('id',$user->orgId);
$org = Org::select('name as `Organization Name`')->where('id',$user->orgId);
$org = Org::select('name as (Organization Name)')->where('id',$user->orgId);
$org = Org::select('name as {Organization Name}')->where('id',$user->orgId);
没有找到解决方案..
您尝试过使用原始格式吗?
Org::select(DB::raw('name as `Organization Name`, status'))->where('id',$user->orgId);
我想使用具有 spaces.How 的自定义列名称,我可以使用 Laravel 4 编写查询吗? 我试过了
$org = Org::select('name as Organization Name')->where('id',$user->orgId);
$org = Org::select('name as "Organization Name"')->where('id',$user->orgId);
$org = Org::select('name as `Organization Name`')->where('id',$user->orgId);
$org = Org::select('name as (Organization Name)')->where('id',$user->orgId);
$org = Org::select('name as {Organization Name}')->where('id',$user->orgId);
没有找到解决方案..
您尝试过使用原始格式吗?
Org::select(DB::raw('name as `Organization Name`, status'))->where('id',$user->orgId);