Dinesh Uprety
@dineshuprety ·
Public
Migrate storage with a read-through disk
PHPLaravel 13 API example based on official Laravel documentation. Source: https://laravel.com/docs/13.x/filesystem#scoped-read-only-and-read-through-filesystems
PHP
CodeSnap // free canvas
Migrate storage with a read-through disk
<?php
// config/filesystems.php
'assets' => [
'driver' => 'read-through',
'primary' => 'r2',
'fallback' => 'legacy-s3',
'throw_on_promotion_failure' => false,
],
// A fallback read is promoted to the primary disk.
$logo = Storage::disk('assets')->get('logos/app.svg');
// Further reading: https://laravel.com/docs/13.x/filesystem#scoped-read-only-and-read-through-filesystems