-
-
Notifications
You must be signed in to change notification settings - Fork 247
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Describe the bug
When using the Laravel Query Builder I get the balance as 0 , But when I switch to Laravel Eloquent ORM I get the correct balance 5000.
$student = User::find(1);
$wallet = $student->createWallet([
'name' => 'Student wallet',
'slug' => 'MyUniqueSlug',
'meta' => ['is_active' => true]
]);
$wallet->deposit(5000);
Now this query will return the correct wallet but with the balance 0:
$students = DB::table('users')
->join('wallets', function ($join){
$join->on('wallets.holder_id', 'users.id')
->where('wallets.holder_type', User::class)
->where('wallets.slug', 'MyUniqueSlug');
;
})
But this query will return the correct wallet with the correct balance 5000
$students = Student::query()
->withWhere('wallets', function ($query) {
$query->where('wallets.slug' , 'MyUniqueSlug',);
})
->get();
I can confirm that the transactions was created.
To Reproduce
Steps to reproduce the behavior:
- Create a user wallet
- Deposit 5000
- Query the wallet with both ORM and Query Builder
- You should see different balances.
Server:
- php version: 8.3
- database: 8.0.3
- wallet version 10.1.6
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested