public static function getKarmanote() { $test_id = Adminoption::Where('option_name', '=', 'Test User Emails')->first(); $test_user_id = $getfintrorecords = array(); if (!empty($test_id)) { $test_user_id = explode(',', $test_id->option_value); } $giver = $receiver = $conn = ''; $getKarmanote = KarmaHelper::getrandomnotes($test_user_id); if (!empty($getKarmanote)) { $getfintrorecords = KarmaHelper::getfintrorecords($test_user_id, $getKarmanote); } foreach ($getfintrorecords as $key => $value) { $value->user_idreceiver = User::find($value->user_idreceiver); if (!empty($value->user_idgiver)) { $value->user_idgiver = User::find($value->user_idgiver)->toArray(); } else { $value->user_idgiver = Connection::find($value->connection_idgiver)->toArray(); } } return $getfintrorecords; }