I trouble to pass eloquent methods as a parameter.
Here is my method,
public function getPayment($paymentId, $eloquentMethod)
{
if (!empty($orderId)) {
return DB::connection('my_db')->table('payment')->{$eloquentMethod}();
}
return null;
}
It is working properly if i pass $this->getPayment('1', 'get')
But it is not working if i pass $this->getPayment('1', 'pluck("payment_id")')
Thanks in advance.
$eloquentMethod = 'get'?$eloquentMethod = 'get'and then usereturn DB::connection('my_db')->table('payment')->{$eloquentMethod}();pluck('id')