How can I order by name in case for example two users have the same book quantity in raw sql?

|
Dkhicher 2021-09-13 19:18:22
Some editor no actually understand that your Auth::user() has any method that exist in User model thats why you getting error in login method or not in register method
sbruder 2021-09-13 19:23:43
sbruder 2021-09-13 18:29:12
I’m dealing with a particular behaviour that I cannot explain. in a DB::listen() I’m doing a Redis::incr(‘QUERY_COUNT’);. When retrieving it, I’m getting ‘1’ no matter what. Doing Redis::incr() in a tinker console it works as it should. That DB:listen() is working because I also log all queries and they are getting into logs.

I found the issue: Laravel adds the app name as a prefix to redis keys and my app and the artisan command line where getting different app names (different .env files).

SHUBHAM PANCHAL 2021-09-13 20:08:16
Habib_Mhamadi 2021-09-13 13:16:46
You need to use relationships

But how? Any Example..

Habib_Mhamadi 2021-09-13 20:40:08
SHUBHAM PANCHAL 2021-09-13 20:08:16
But how? Any Example..

Another way is:

$userPans = DB::table(‘users’)->get();

foreach($userPans as $user) {
$user->pans = DB::table(‘user_workouts’)->where(‘user_id’, $user->id)->get()->toArray();
}

return $userPans->toArray();

Habib_Mhamadi 2021-09-13 20:40:20
Try this 👆
SHUBHAM PANCHAL 2021-09-13 20:42:33
Habib_Mhamadi 2021-09-13 20:40:08
Another way is:

$userPans = DB::table(‘users’)->get();

foreach($userPans as $user) {
$user->pans = DB::table(‘user_workouts’)->where(‘user_id’, $user->id)->get()->toArray();
}

return $userPans->toArray();

Okay Sir,
Thanks 😊

flyingdragons 2021-09-13 23:04:11
Hi is there any other API’s which can validate my transactions made by MetaMask. other than EtherScan API

Or there are any MetaMask API’s via which I can validate if my transactions

RahiMSuleymaN 2021-09-13 23:25:02
laravel_discuss-94396.jpg
Hi everyone,MathML not working in Chrome
RahiMSuleymaN 2021-09-13 23:25:52
laravel_discuss-94397.jpg
How can solve it.Thanks in advanced
RahiMSuleymaN 2021-09-13 23:26:13
RahiMSuleymaN 2021-09-13 23:25:52
How can solve it.Thanks in advanced

It is chrome

RahiMSuleymaN 2021-09-13 23:28:51
laravel_discuss-94399.jpg
I can solved it with extention.How can I solve it another way?
Hazar_Orabi 2021-09-14 01:53:01
Please
Hazar_Orabi 2021-09-14 01:53:11
laravel_discuss-94411.jpg
How do i solve this error
mr_roz 2021-09-14 02:01:18
Hey guys, I’m looking for a good course for ( api Laravel 8)
Can help me anyone?
el_osva 2021-09-14 02:36:46
Hello. how can I order by name in case for example two users have the same book quantity in raw sql?
Hos6man 2021-09-14 02:42:23
Hi there Guys can you tell me some course and class about the livewire?
Soumen954 2021-09-14 04:36:39
How to get live long access token in Facebook graph api Anyone have any idea please help me
Soumen954 2021-09-14 04:37:02
Soumen954 2021-09-14 04:36:39
How to get live long access token in Facebook graph api Anyone have any idea please help me

In group

Habib_Mhamadi 2021-09-14 06:10:57
el_osva 2021-09-14 02:36:46
Hello. how can I order by name in case for example two users have the same book quantity in raw sql?

Please show us your table structures first.

el_osva 2021-09-14 06:24:48
Habib_Mhamadi 2021-09-14 06:10:57
Please show us your table structures first.

– People (id name age)
– Book (id title owner_id references people id, author_id references people id)

I have to get the name and how many books have each person an order by amount desc and in case of two or more people have the same book quantity order them by name asc

In Raw Sql

Habib_Mhamadi 2021-09-14 06:36:20
Select ppl.id, ppl.name, count(bk.id) as books from people ppl inner join books bk on bk.owner_id = ppl.id order by count(bk.id) desc, ppl.name group by ppl.id;
Habib_Mhamadi 2021-09-14 06:37:34
There u go 👆
el_osva 2021-09-14 06:38:54
Habib_Mhamadi 2021-09-14 06:36:20
Select ppl.id, ppl.name, count(bk.id) as books from people ppl inner join books bk on bk.owner_id = ppl.id order by count(bk.id) desc, ppl.name group by ppl.id;

Ok thank you I had an structure similar but I was confuse trying to resolve the last part. Thank you very much

Habib_Mhamadi 2021-09-14 06:39:07
el_osva 2021-09-14 06:38:54
Ok thank you I had an structure similar but I was confuse trying to resolve the last part. Thank you very much

Welcome

el_osva 2021-09-14 06:39:23
Habib_Mhamadi 2021-09-14 06:39:07
Welcome

Thank you again

el_osva 2021-09-14 06:53:59
Habib_Mhamadi 2021-09-14 06:36:20
Select ppl.id, ppl.name, count(bk.id) as books from people ppl inner join books bk on bk.owner_id = ppl.id order by count(bk.id) desc, ppl.name group by ppl.id;

I was watching your code again and I realized that you order by book quantity ok and group by name but I have to check if two or more users have the same book quantity and if exists order those who have the same quantity of book by name also

Habib_Mhamadi 2021-09-14 07:10:19
el_osva 2021-09-14 06:53:59
I was watching your code again and I realized that you order by book quantity ok and group by name but I have to check if two or more users have the same book quantity and if exists order those who have the same quantity of book by name also

Yes it’s exactly doing this

Habib_Mhamadi 2021-09-14 07:11:28
Habib_Mhamadi 2021-09-14 06:36:20
Select ppl.id, ppl.name, count(bk.id) as books from people ppl inner join books bk on bk.owner_id = ppl.id order by count(bk.id) desc, ppl.name group by ppl.id;

See, at first order by book amount desc, if equal than order by owner name.

Habib_Mhamadi 2021-09-14 07:12:21
I considered the owner name. So if you mean book name instead, then change it to bk.name.
el_osva 2021-09-14 07:13:21
Habib_Mhamadi 2021-09-14 07:12:21
I considered the owner name. So if you mean book name instead, then change it to bk.name.

No is the owner thank you so much I had taht doubt

Billygotclout 2021-09-14 07:56:44
Please who has implemented Africa’sTalking Api in laravel
christ 2021-09-14 08:44:04
API update by id?
Sunil Negi 2021-09-14 08:50:05
i. Generate 16-digit random number (session key). Say RANDOMNO.
RANDOMNO = 1111222233334444
ii. Encrypt RANDOMNO using RSA/ECB/PKCS1Padding and encode using Base64. Say
ENCR_KEY.
ENCR_KEY = B64Encode(RSA/ECB/PKCS1Encryption(RANDOMNO,ICICIPubKey.cer))
iii. Perform AES/CBC/PKCS5Padding encryption on request payload using RANDOMNO as
key and iv- initialization vector. Say ENCR_DATA.
ENCR_DATA = B64Encode(AES/CBC/PKCS5Padding(REQUEST_DATA, RANDOMNO, IV))
Sunil Negi 2021-09-14 08:50:17
Sunil Negi 2021-09-14 08:50:05
i. Generate 16-digit random number (session key). Say RANDOMNO.
RANDOMNO = 1111222233334444
ii. Encrypt RANDOMNO using RSA/ECB/PKCS1Padding and encode using Base64. Say
ENCR_KEY.
ENCR_KEY = B64Encode(RSA/ECB/PKCS1Encryption(RANDOMNO,ICICIPubKey.cer))
iii. Perform AES/CBC/PKCS5Padding encryption on request payload using RANDOMNO as
key and iv- initialization vector. Say ENCR_DATA.
ENCR_DATA = B64Encode(AES/CBC/PKCS5Padding(REQUEST_DATA, RANDOMNO, IV))

Anyone know how do this in php

M 2021-09-14 09:02:01
Csrf token how to regenarate?
|