Access column name into another relational query function
I have a scenario where I need to check the column from two different table (code snippets below) into the additional query. But payment_methods.last_activated is not accessible into the closure. My requirements are to fetch all payment methods as well as all the payment which has been made with that method after it has been activated. How can I do it? Below code is not working.
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'payment_methods.last_activated' in 'where clause' (Connection: mysql, SQL: select * from `payments` where `payments`.`payment_method_id` in (3, 4) and `status` = success and `processed_at` >= `payment_methods`.`last_activated`)