3131use Illuminate \Support \Facades \DB ;
3232use Illuminate \Support \Facades \Log ;
3333use Illuminate \Support \Facades \Redirect ;
34- use Illuminate \Support \Facades \Redis ;
34+ use Illuminate \Support \Facades \Redis as RedisFacade ;
3535use Illuminate \Support \Str ;
3636use Illuminate \View \View ;
3737
3838use PDO ;
39+ use Redis ;
3940use RedisException ;
4041use stdClass ;
4142
@@ -55,12 +56,12 @@ class MainController extends Controller{
5556
5657 const blockedListUrl = 'https://api.odysee.com/file/list_blocked?with_claim_id=true ' ;
5758
58- protected $ redis ;
59- protected $ rpcurl ;
59+ protected ? Redis $ redis ;
60+ protected string $ rpcUrl ;
6061
6162 public function __construct (){
62- $ this ->redis = Redis ::connection ()->client ();
63- $ this ->rpcurl = config ('lbry.rpc_url ' );
63+ $ this ->redis = RedisFacade ::connection ()->client ();
64+ $ this ->rpcUrl = config ('lbry.rpc_url ' );
6465 try {
6566 $ this ->redis ->info ('mem ' );
6667 } catch (RedisException ) {
@@ -127,8 +128,8 @@ protected function _getLatestPrice(): string{
127128 */
128129 public function index (): JsonResponse |Response |View {
129130 $ lbcUsdPrice = $ this ->_getLatestPrice ();
130- $ blocks = Block::query ()->select (['chainwork ' , 'confirmations ' , 'difficulty ' , 'hash ' , 'height ' , 'block_time ' , 'block_size ' ,'tx_count ' ])->orderByDesc ('height ' )->limit (6 )->get ();
131- $ claims = Claim::query ()->leftJoin ('claim AS c ' ,'c.claim_id ' ,'= ' ,'claim.publisher_id ' )->orderByDesc ('claim.created_at ' )->limit (5 )->get ();
131+ $ blocks = Block::query ()->select (['chainwork ' ,'confirmations ' ,'difficulty ' ,'hash ' ,'height ' ,'block_time ' ,'block_size ' ,'tx_count ' ])->orderByDesc ('height ' )->limit (6 )->get ();
132+ $ claims = Claim::query ()->leftJoin ('claim AS c ' ,'c.claim_id ' ,'= ' ,'claim.publisher_id ' )->addSelect ( ' claim.* ' )-> addSelect ( ' c.name AS publisher ' )-> orderByDesc ('claim.created_at ' )->limit (5 )->get ();
132133 $ hashRate = $ this ->_formatHashRate ($ this ->_gethashrate ());
133134
134135 return self ::generateResponse ('main.index ' ,[
@@ -1003,7 +1004,7 @@ public static function curl_get($url): string|bool{
10031004 private function _gethashrate (): mixed {
10041005 $ req = ['method ' => 'getnetworkhashps ' , 'params ' => [],'id ' =>rand ()];
10051006 try {
1006- $ res = json_decode (self ::curl_json_post ($ this ->rpcurl , json_encode ($ req )));
1007+ $ res = json_decode (self ::curl_json_post ($ this ->rpcUrl , json_encode ($ req )));
10071008 if (!isset ($ res ->result )) {
10081009 return 0 ;
10091010 }
@@ -1078,7 +1079,7 @@ private function _gettxoutsetinfo(): mixed{
10781079
10791080 $ req = ['method ' => 'gettxoutsetinfo ' , 'params ' => [],'id ' =>rand ()];
10801081 try {
1081- $ response = self ::curl_json_post ($ this ->rpcurl , json_encode ($ req ));
1082+ $ response = self ::curl_json_post ($ this ->rpcUrl , json_encode ($ req ));
10821083 $ res = json_decode ($ response );
10831084 if (!isset ($ res ->result )) {
10841085 return null ;
0 commit comments