Code:
$contributions =
auth()->user()->cooperative->contributions->where("amount", "<", 'amount * shares');
But this doesn't return required results. How can I multiply amount and shares, they are from same table and use their products.
Code:
$contributions =
auth()->user()->cooperative->contributions->where("amount", "<", 'amount * shares');
But this doesn't return required results. How can I multiply amount and shares, they are from same table and use their products.
Wrap your condition in braces and it should work fine. as below:
$contributions = auth()->user()->cooperative->contributions->where("amount", "<", '(amount * shares)');
Hope it helps you.