You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and dots ('.'), can be up to 35 characters long. Letters must be lowercase.
		
		
		
		
		
			
		
			
				
					
					
						
							25 lines
						
					
					
						
							690 B
						
					
					
				
			
		
		
	
	
							25 lines
						
					
					
						
							690 B
						
					
					
				<?php | 
						|
 | 
						|
namespace App\Utils; | 
						|
 | 
						|
use Carbon\Carbon; | 
						|
use Illuminate\Support\Facades\Storage; | 
						|
 | 
						|
class S3  | 
						|
{ | 
						|
    public static function encodeURI($str) | 
						|
    { | 
						|
        $revert = ['%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')', '%2F'=>'/']; | 
						|
        return strtr(rawurlencode($str), $revert); | 
						|
    } | 
						|
 | 
						|
    public static function signUrl($key){ | 
						|
        $client = ((object)Storage::disk("s3"))->getClient(); | 
						|
        $bucket = config("filesystems.disks.s3.bucket"); | 
						|
        $command = $client->getCommand('GetObject', [ | 
						|
            "Bucket" => $bucket, | 
						|
            "Key" => $key | 
						|
        ]); | 
						|
        return (string)$client->createPresignedRequest($command, Carbon::tomorrow())->getUri(); | 
						|
    } | 
						|
}
 | 
						|
 |