Are you sure that the other query is getting results?

|
Eagle257 2022-09-02 17:44:22
In single query
Dani 2022-09-02 17:45:05
Eagle257 2022-09-02 17:44:10
Anyone one know how to join two wherehas condition

show your code

Dani 2022-09-02 17:45:56
DesolatorMagno 2022-09-02 17:10:13
Una duda, cuando necesita comprobar si algo es false, que hacen, comparan con false o niegan?

if($value === false)
if(! $value)

Es que usar negación cuando son mas de 1 condición tiende a confundirme, asi que tiendo a evitarlo siempre.

yo uso la negación siempre

DesolatorMagno 2022-09-02 17:47:01
Dani 2022-09-02 17:45:56
yo uso la negación siempre

Thanks 👍, i just figured out that i wrote in the wrong Laravel group.

Eagle257 2022-09-02 17:48:04
Dani 2022-09-02 17:45:05
show your code

laravel_discuss-136614.jpg

Dani 2022-09-02 17:52:27
what data do you want to get and from what tables
Dani 2022-09-02 17:52:50
Eagle257 2022-09-02 17:48:04
laravel_discuss-136614.jpg

type a basic schema here to help you

Eagle257 2022-09-02 17:55:43
$query->whereHas(‘profilekeyskill’, function($q) use($search,$query){
$key = JobSkill::where(‘job_skill’,’like’, ‘%’ . $search . ‘%’)->first();

if($key != null)
{
// dd(‘coming’);
$q->where(‘keyskill’, $key->id);

} else{

$query->whereHas(‘profileSummary’, function($q) use($search){
$q->where(‘latestdesg’,’like’, ‘%’ . $search . ‘%’);
});

Eagle257 2022-09-02 17:56:20
I need these $q two query values in single query
Dani 2022-09-02 17:59:44
Eagle257 2022-09-02 17:55:43
laravel_discuss-136614.jpg
$query->whereHas(‘profilekeyskill’, function($q) use($search,$query){
$key = JobSkill::where(‘job_skill’,’like’, ‘%’ . $search . ‘%’)->first();

if($key != null)
{
// dd(‘coming’);
$q->where(‘keyskill’, $key->id);

} else{

$query->whereHas(‘profileSummary’, function($q) use($search){
$q->where(‘latestdesg’,’like’, ‘%’ . $search . ‘%’);
});

you could use the “OrWhereHas” method from eloquent

DesolatorMagno 2022-09-02 18:00:29
$model->whereHas()->orWhereHas();
Eagle257 2022-09-02 18:01:20
Dani 2022-09-02 17:59:44
laravel_discuss-136614.jpg
you could use the “OrWhereHas” method from eloquent

Yes i tried but if i use orwherehas only one query will be ork

Dani 2022-09-02 18:01:47
Eagle257 2022-09-02 18:01:20
laravel_discuss-136614.jpg
Yes i tried but if i use orwherehas only one query will be ork

Are you sure that the other query is getting results?

Dani 2022-09-02 18:02:01
after to verify that, try this:
Dani 2022-09-02 18:02:13
one second
Eagle257 2022-09-02 18:02:46
Yes if i comment 1st query second query will be work if i comment 2nd query 1st query will be work
Dani 2022-09-02 18:03:06
ok i know what is happening, i’ll send you the code gime one second
Eagle257 2022-09-02 18:03:18
Both queries are not working same i need both queries values join
DesolatorMagno 2022-09-02 18:04:40
Yes, orWhereHas is when you you want one, or the other, is not goin to do both, but that was what you are getting from the code you showed.
DesolatorMagno 2022-09-02 18:06:08
where is a condition, if you use 2 where, it will required both, if you use Or, it will require at least one of them.
dileepmaurya87 2022-09-02 18:09:10
Can anyone help me to get count of lost customers month wise
Dani 2022-09-02 18:11:22
Eagle257 2022-09-02 18:03:18
laravel_discuss-136614.jpg
Both queries are not working same i need both queries values join

$query->where(function($q) use($search){

$q->whereHas(‘profilekeyskill’, function($q) use($search){
$key = JobSkill::where(‘job_skill’,’like’, ‘%’ . $search . ‘%’)->first() })
->orWhereHas(‘profileSummary’, function($q) use($search){
$q->where(‘latestdesg’,’like’, ‘%’ . $search . ‘%’);

});

Dani 2022-09-02 18:11:36
try this
AkshayKrBairwa 2022-09-02 18:17:09
laravel_discuss-136635.jpg
Why this error coming ?
rahul8180 2022-09-02 18:21:37
teEVILJOKER 2022-09-02 12:43:09
laravel_discuss-136555.jpg

Issue in params

Eagle257 2022-09-02 18:21:52
Dani 2022-09-02 18:11:22
laravel_discuss-136555.jpg
$query->where(function($q) use($search){

$q->whereHas(‘profilekeyskill’, function($q) use($search){
$key = JobSkill::where(‘job_skill’,’like’, ‘%’ . $search . ‘%’)->first() })
->orWhereHas(‘profileSummary’, function($q) use($search){
$q->where(‘latestdesg’,’like’, ‘%’ . $search . ‘%’);

});

I modified something but super it’s working now thanks for your code thanks for helping 👌

Dani 2022-09-02 18:25:58
Eagle257 2022-09-02 18:21:52
laravel_discuss-136555.jpg
I modified something but super it’s working now thanks for your code thanks for helping 👌

so good

Dani 2022-09-02 18:27:13
In this case is necessary to put together the where has inside a where function
Dani 2022-09-02 18:27:24
*whereHas
Denno_IT 2022-09-02 18:43:54
laravel_discuss-136641.jpg
i have called my controller into the view using this method but i receive the error of “unexpected end of file” what does this mean please?
Siberfx 2022-09-02 19:03:03
Forgotten maybe @endforeach?
rlawjddn00 2022-09-02 20:01:53
Can anyone tell me what is search method in laravel collection easily
Sai Prakash 2022-09-02 20:02:55
I have one doubt
Sai Prakash 2022-09-02 20:03:13
Can anyone help me
Sai Prakash 2022-09-02 20:04:01
I have doubt in laravel
|