Davor Posted September 29, 2021 Share Posted September 29, 2021 Hello, if I understand correctly this help doc: https://developers.whmcs.com/advanced/db-interaction/ that the WHMCS is deprecating the Select. Could someone help me with converting this "Capsule::select" to "Capsule::table"? Here is the code: $currency = Capsule::select(Capsule::raw('SELECT t3.rate FROM tblinvoices AS t1 LEFT JOIN tblclients AS t2 ON t1.userid = t2.id LEFT JOIN tblcurrencies AS t3 ON t2.currency = t3.id WHERE t1.id = "' . $vars['invoiceid'] . '" AND t3.default = "0" LIMIT 1'))[0]; 0 Quote Link to comment Share on other sites More sharing options...
steven99 Posted September 29, 2021 Share Posted September 29, 2021 Have a look at https://laravel.com/docs/8.x/queries#joins and search around for Eloquent joins. In that doc they refer to select_query, a function of its own, but I suppose that could still be using Capsule::select . 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted September 30, 2021 Share Posted September 30, 2021 15 hours ago, Davor said: Hello, if I understand correctly this help doc: https://developers.whmcs.com/advanced/db-interaction/ that the WHMCS is deprecating the Select. Could someone help me with converting this "Capsule::select" to "Capsule::table"? Here is the code: $currency = Capsule::select(Capsule::raw('SELECT t3.rate FROM tblinvoices AS t1 LEFT JOIN tblclients AS t2 ON t1.userid = t2.id LEFT JOIN tblcurrencies AS t3 ON t2.currency = t3.id WHERE t1.id = "' . $vars['invoiceid'] . '" AND t3.default = "0" LIMIT 1'))[0]; $currency = Capsule::table('tblinvoices') ->leftJoin('tblclients','tblinvoices.userid','=', 'tblclients.id') ->leftJoin('tblcurrencies','tblcurrencies.id ','=', 'tblclients.currency') ->where('tblinvoices.id', $vars['invoiceid']) ->where('tblcurrencies.default', 0) ->select('t3.rate') ->first(); $currency->rate; 0 Quote Link to comment Share on other sites More sharing options...
Davor Posted September 30, 2021 Author Share Posted September 30, 2021 wow, thanks @pRieStaKos will try it as I return to office. Once again thanks, Davor 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.