last day (15 days later) » 
06:00 - 09:0009:00 - 11:00

09:01
with $users = DB::table('users')
->join('privacy_settings','user.id', '=', 'privacy_settings.user_id')
->where('privacy_settings.city', 1)
->get();
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user.id' in 'on clause' (SQL: select * from users inner join privacy_settings on user.id = privacy_settings.user_id where privacy_settings.city = 1)
09:20
is your user table called user or users?
in your phpmyadmin, whats the name of the table?
users
it should be users.id?
Cannot use object of type stdClass as array
on which line?
$privacy = PrivancySetting::where('user_id', $user['id'])->first();
09:22
did you remove the foreach loop?
the query which i sent to you is to fetch users that have 1 as their city on privacy settings
should i remove this?
$temparr = [];
$buffer = 0;

foreach($users as $user){
$arr = [];
$privacy = PrivancySetting::where('user_id', $user['id'])->first();
$city = $privacy['city'];
if($city == 0){
$buffer = 0;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}else{
$buffer = 1;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}
}
well if you don't need it you can
ok so
my page loaded
let have a search
if isn't working, i will make in blade
nah, still same values
anyway
i will make this in view
do you have any idea of how can i remove that blank space ?:)
if i have 3 contacts, and the seconds is hiding
09:26
hmmm that's odd, cause the query should be what you need
yeah..
to remove the blank space? they're all in <div> right? just hide the div?
<div style=display:none>
haha
i will try ;)
please write
$temparr = [];
$buffer = 0;

foreach($users as $user){
$arr = [];
$privacy = PrivancySetting::where('user_id', $user['id'])->first();
$city = $privacy['city'];
if($city == 0){
$buffer = 0;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}else{
$buffer = 1;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}
}
in the comments
no, that is in your view
to accept your answer
09:28
oh
xD
hmmmmm
wait :D
fuck, now the search isn't working :((
like, i write name
in city field
and doesn't search by what i wrote in field
remove the query xD go back to your $users = User::with();
now i have the old function
$users = User::with('country','industry','organization_type','career_path','career_path.industry','career_path.department','career_path.functions','role')->get();



$temparr = [];
$buffer = 0;

foreach($users as $user){
$arr = [];
$privacy = PrivancySetting::where('user_id', $user['id'])->first();
$city = $privacy['city'];
if($city == 0){
$buffer = 0;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}else{
$buffer = 1;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
ye
stick to that if you wanna filter in your view
what s meaning stick ?xD
remove or?
09:33
nono, stick means keep it, so use that if you wanna filter in the view xD
ahhh
hm
if i add get() to my query, the search isn;t working but at dd($temparr) i have the results from privacy settings
but if i remove that get, the search is working, but at dd i have []
wtf
wat the fuck lol
exactly wtf
i have this at the start of my code $data['users'] = User::all();
isn;t the same with $users = User::with('country','industry','organization_type','career_path','career_path.industry','career_path.department','career_path.functions','role')->get(); ?
nope it's diff
ok waht you can do is this
remove the get from your user::with
and make a new instance
$users2 = User::all();
then in the foreach make it foreach($users2 as $user)
ok, let me check
same lol
why i get all this values
is so weird
09:40
but how.....
aSFASSFASF
this is confusing
maybe because
in controller i have foreach user2 as user
and in my view
i hae another foreach
user as user ?
you cant user user as user
you have to use users as user
users as user *
sorry
that loop shouldnt matter
ok in the view, dd(users)
what do you get
in view or controller?
09:42
voiew
Builder {#614 â–¼
#query: Builder {#826 â–¶}
#model: User {#827 â–¶}
#eagerLoad: array:8 [â–¶]
#macros: array:5 [â–¶]
#onDelete: Closure {#817 â–¶}
#passthru: array:11 [â–¶]
#scopes: array:1 [â–¶]
#removedScopes: []
}
which one to open?
ok so it is responding the data
neither, the data is there
ah oki
dd temparr in your view
array:262 [â–¼
0 => array:2 [â–¼
"id" => 1
"perm" => 0
]
1 => array:2 [â–¶]
2 => array:2 [â–¶]
3 => array:2 [â–¶]
4 => array:2 [â–¶]
5 => array:2 [â–¶]
6 => array:2 [â–¶]
7 => array:2 [â–¶]
8 => array:2 [â–¶]
9 => array:2 [â–¶]
10 => array:2 [â–¶]
11 => array:2 [â–¶]
12 => array:2 [â–¶]
13 => array:2 [â–¶]
14 => array:2 [â–¶]
15 => array:2 [â–¶]
16 => array:2 [â–¶]
17 => array:2 [â–¶]
09:44
so it is there
then what's the issue now hahah
:(
a lot of issues
you saying
just*
sorry
ok what's the issue with the thing we are discussing now
just the search isn't working
and i dont know why
like, let me show you
09:47
so the search was working before? do you ahve the function for the search?
oh, sure, it worked before
so it stopped working after the loop solution or the query i passed to you
yep
so
with this :
$users = User::with('country','industry','organization_type','career_path','career_path.industry','career_path.department','career_path.functions','role');



$temparr = [];
$buffer = 0;

foreach($users as $user){
$arr = [];
$privacy = PrivancySetting::where('user_id', $user['id'])->first();
$city = $privacy['city'];
if($city == 0){
$buffer = 0;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
array_push($temparr, $arr);
}else{
$buffer = 1;
$arr['id'] = $user['id'];
$arr['perm'] = $buffer;
search is worrking, but at dd temparr
i have []
but if i add this with get $users = User::with('country','industry','organization_type','career_path','career_path.industry','career_path.department','career_path.functions','role')->get();
dd($temparr) is working
but when i search i get all values
from dd($temparr)
oh yeah, its supposed to work like that, cause this is your search function, so if you dont search, it does not inject your $users withoout a get()
what i fill on every input still has same results
09:52
huh
sorry, when I fill an input with some value, it searching but I got same results
and i think that is the results from #temparr
or something like that
$temparr
dont use get()
and dd in the view
dd($temparr) in your view
what do you get
this
array:262 [â–¼
0 => array:2 [â–¼
"id" => 1
"perm" => 0
]
1 => array:2 [â–¶]
2 => array:2 [â–¶]
3 => array:2 [â–¶]
4 => array:2 [â–¶]
5 => array:2 [â–¶]
6 => array:2 [â–¶]
7 => array:2 [â–¶]
8 => array:2 [â–¶]
9 => array:2 [â–¶]
10 => array:2 [â–¶]
11 => array:2 [â–¶]
12 => array:2 [â–¶]
13 => array:2 [â–¶]
14 => array:2 [â–¶]
15 => array:2 [â–¶]
16 => array:2 [â–¶]
17 => array:2 [â–¶]
yea, so you do get the values, then there should not be any issues Oo
let me show you something
with $private = DB::table('privacy_settings')->get();
dd($private);
i got array:297 [â–¼
0 => {#950 â–¼
+"id": "142"
+"user_id": "191"
+"email": "1"
+"website": "1"
+"phone": "1"
+"address": "1"
+"city": "1"
+"current_job": "1"
+"job_history": "1"
+"education_history": "1"
+"career_solutions": "1"
+"profile_updates": "0"
+"contacts_list": "1"
+"groups": "1"
}
1 => {#949 â–¶}
2 => {#948 â–¶}
3 => {#947 â–¶}
4 => {#946 â–¶}
5 => {#945 â–¶}
6 => {#944 â–¶}
7 => {#943 â–¶}
8 => {#942 â–¶}
9 => {#941 â–¶}
10 => {#940 â–¶}
11 => {#939 â–¶}
12 => {#938 â–¶}
13 => {#937 â–¶}
14 => {#936 â–¶}
15 => {#935 â–¶}
so, here i have user_id and value from city
can we use that in view?
instead of $temparr ?
to get only user_id and city values
09:57
yeah you definitely can use this
so pass $private to your view
and loop it like @foreach($users as $user)@foreach($private as $p) @if($p['user_id'] == $user['id'] @if($p['city'] == 1) show else hide
basically
Cannot use object of type stdClass as array
line 550
what is line 550
is from another code lmao
so the problem is in view
at this
@foreach($private as $p)
@if($p['user_id'] == $user['id'])
@if($p['city'] == 1)
sal
@else
{{ $user['username'] }} </a></h3><p>
@endif
@endif
@endforeach
maybe should be $p->user_id ?
10:02
ahhh
that is one way
$private = (array) $private;
you can do that in your controller as well
hmm
with : @foreach($private as $p)
{{ $p->id }}
{{ $user['username'] }} </a></h3><p>

@endforeach
yea you could do that
i made an example for id
and it's look like that
looks
the foreach is on the username for example
thats a lot of loops, you need to cancel your looping xD
so, should i delete that foreach?
i m sorry that i disturb you with that problem :))
and for your time :(
10:09
no worries
no dont delete the foreach, filter what you need properly
@foreach($users as $user)
@foreach($private as $p)
{{ $p->city }}
@endforeach
now, i get the values from city
but i get all values
should i add an where
in controller?
use
@if($user->id == $p->user_id)
{{ $p->city }}
@endif
uhhhhhh
:D:D:D:D
niceeee
so i have this
@foreach($private as $p)
@if($user['id'] == $p->user_id)
{{ $p->city }}
@endif
@endforeach
to add ... if $p->city != 1, show the div
should i add under the first if?
10:14
yeap!
haha
exactly what i said haha
so it works?
yep
thank you so much man...
you saved me:))
no worries
so, write this on the answer
10:16
anyways im going home now
$private = DB::table('privacy_settings')->get();
$private = (array) $private;
if you got any other question, just email me @ [email protected]
@foreach($private as $p)
@if($user['id'] == $p->user_id)
@if($p->city != 1) and this
yes, i will save it !
that answer should not be written, as it is not relevant to the question you posted XD
thank you so much man
okay
10:17
as your view isnt present on the question
i will accept that answer
done :)
thank you man
cheers no worries!
oh
one more little question
No of search results: 6
this is a variable which is counting the users
now i have 1 displayed
not 6, the rest of 5 is hiding
$data['usersCount'] = $users->count();
this is the variable, can i add where != $private == 1 ?
err no you need a separate query for that
umm im about to leave my office now as it is 930 pm where i am, so i wanna grab a beer and crash, maybe later on email i can help you out
ok thank you
no problem
thank you :) cheers !
06:00 - 09:0009:00 - 11:00

last day (15 days later) »