我正在尝试合并不同的列名,如"phone"one_answers";telephone">
我还想对"first_name"以及"firstname"等
在我的表中,我有与电话和其他电话的行。下面是我获取数据的行:
$landing_datas = AppLandingData::whereIn('landing_id', $landinds_ids)->orderBy('updated_at', 'desc');
我怎样才能达到我想要做的呢?
如果您想将它们合并到数据库中的一个列中,请按照M Khalid Junaid的描述进行操作。
还可以定义一个访问器来连接两个数字
public function getPhoneNumberAttribute(): string
{
return "{$this->phone}, {$this->telephone}";
}
然后你可以通过$model->phone_number
访问它
当然,这只适用于你想要在Laravel中正确显示它们,而不能解决将它们放在多列中的问题。