Skip to content

Commit 1706ea0

Browse files
committed
fix deprecated Guzzle stream_for
1 parent b96e670 commit 1706ea0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Media.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace Plank\Mediable;
55

66
use Carbon\Carbon;
7+
use GuzzleHttp\Psr7\Utils;
78
use Illuminate\Contracts\Filesystem\Filesystem;
89
use Illuminate\Database\Eloquent\Builder;
910
use Illuminate\Database\Eloquent\Collection;
@@ -397,9 +398,11 @@ public function contents(): string
397398
*/
398399
public function stream()
399400
{
400-
return \GuzzleHttp\Psr7\stream_for(
401-
$this->storage()->readStream($this->getDiskPath())
402-
);
401+
$stream = $this->storage()->readStream($this->getDiskPath());
402+
if (method_exists(Utils::class, 'streamFor')) {
403+
return Utils::streamFor($stream);
404+
}
405+
return \GuzzleHttp\Psr7\stream_for($stream);
403406
}
404407

405408
/**

0 commit comments

Comments
 (0)