Created
February 20, 2024 10:29
-
-
Save sonichandni/3eed51880ea03c5fb9a347209eda7ffe to your computer and use it in GitHub Desktop.
Laravel get store and get file from url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put file content | |
$client = new \GuzzleHttp\Client(); | |
$response = $client->request('GET', $url); | |
$contents = $response->getBody()->getContents(); | |
$fileName = $id . '_' . time() . '.pdf'; | |
$path = 'public/bol/' . $fileName; | |
Storage::put($path, $contents); | |
// Get file content | |
$getUrl = asset("storage/bol/$fileName"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment