Мне нужно получить значение из table - privacy_settings
, column - city
, основываясь на user_id
, которое на мой взгляд {{ $user['id'] }}
из таблицы users
, столбец id
.
Здесьмой контроллер:
public function findUser($role = null,$search = null,$name = null,$country = null,$city = null,$industry = null,$department = null,$function_name = null,$timeframe =null,$language_skills = null,$organization_type = null,$contact_level = null,$page = null)
{
// if($page == "")
// {
// return redirect('find-user/'.Input::get('role').'/'.Input::get('search').'/1');
// }
// return $role;
// if($page == "")
// {
// $page = 1;
// }
$data = $this->data;
$data['users'] = User::all();
$page = Input::get('page'); // Get the current page or default to 1, this is what you miss!
$perPage = 12;
$offset = ($page * $perPage) - $perPage;
$data['role'] = Input::get('role');
$search = Input::get('search');
$name = Input::get('name');
$country = Input::get('country');
$city = Input::get('city');
$industry = Input::get('industry');
$language_skills = Input::get('language_skills');
$department = Input::get('department');
$function_name = Input::get('function_name');
$company = Input::get('company');
$timeframe = Input::get('timeframe');
$organization_type = Input::get('organization_type');
$contact_level = Input::get('contact_level');
$data['search'] = $search;
// DB::enableQueryLog();
$users = User::with('country','industry','organization_type','career_path','career_path.industry','career_path.department','career_path.functions','role');
$private = DB::table('privacy_settings')->get();
Как я могу это сделать? Я думаю, это должно быть что-то вроде $private = DB::table('privacy_settings')->where('id', '=', 'city')->get();
, но это не работает.
Итак, теперь я получаю идентификатор пользователя с {{ $user['id'] }}
, из таблицы Users
, столбец id
. В таблице privacy_settings
у меня есть столбец user_id
с идентификатором пользователей и city
с двумя значениями: 0 для общего доступа и 1 для частного. Мне нужно получить эти значения на основе каждого user_id