【发布时间】:2019-06-21 11:05:05
【问题描述】:
我希望能够从数据库中获取数据。
我需要名为role_users 的表,列role_id
和表functions,列function。
这是我的观点:
@foreach($contact_users as $contact)
<a href="{{ url('') }}/{{ $contact->username }}">{{ $contact->username }}</a></h3>
<p>
<strong><i class="icon-real-estate-020 u-line-icon-pro"></i> : </strong><a href="#">{{ $contact->country }}</a><br>
<strong><i class="icon-screen-tablet fa-" aria-hidden="true"></i> : </strong><a href="#">{{ $contact->industry }}</a><br>
<strong><i class="icon-frame fa-" aria-hidden="true"></i> : </strong><a href="#">{{ $contact->organization_type }}</a><br>
@endforeach
这是我的控制器:
$data['contact_users'] = DB::table('contacts')
->join('users' , 'users.id', '=', 'contacts.contact_id')
->join('industries' , 'industries.id', '=', 'users.industry_id')
->join('countries' , 'countries.id', '=', 'users.country_id')
->join('organization_types' , 'organization_types.id', '=', 'users.organization_type_id')
->select('users.*','industries.industry','countries.country','organization_types.organization_type')
->where('contacts.contact_id','!=',$id)
->where('users.deleted_at','=',NULL)
->whereIn('contacts.user_id', $contact_id)
->whereNotIn('contacts.contact_id', $contact_id)
->whereNotIn('contacts.contact_id', $inviter_id)
->groupBy('contact_id')
->take(4)
->get();
我想在organization_type下面添加功能。谢谢。
【问题讨论】: