0
0
Laravelframework~10 mins

Public disk and symbolic links in Laravel - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a symbolic link for the public disk in Laravel.

Laravel
php artisan storage:[1]
Drag options to blanks, or click blank then click option'
Alink
Bmake
Ccreate
Dinstall
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'make' or 'create' instead of 'link' causes the command to fail.
Forgetting to run this command after configuring the public disk.
2fill in blank
medium

Complete the code to define the public disk in Laravel's config/filesystems.php.

Laravel
'public' => [
    'driver' => 'local',
    'root' => storage_path('app/[1]'),
    'url' => env('APP_URL').'/storage',
    'visibility' => 'public',
],
Drag options to blanks, or click blank then click option'
Aapp
Bstorage
Cpublic
Dfiles
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'storage' or 'app' instead of 'public' causes files to be stored in the wrong place.
Not matching this folder with the symbolic link target.
3fill in blank
hard

Fix the error in the code to store a file on the public disk.

Laravel
Storage::disk('[1]')->put('example.txt', 'Hello World');
Drag options to blanks, or click blank then click option'
Alocal
Bprivate
Cdefault
Dpublic
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'local' stores files in storage/app but not publicly accessible.
Using 'private' or 'default' disks that may not exist or have wrong permissions.
4fill in blank
hard

Fill both blanks to generate a URL for a file stored on the public disk.

Laravel
$url = Storage::disk('[1]')->[2]('example.txt');
Drag options to blanks, or click blank then click option'
Apublic
Burl
Cpath
Dlocal
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'path' instead of 'url' returns the server path, not a web URL.
Using 'local' disk returns a path not accessible publicly.
5fill in blank
hard

Fill all three blanks to check if a file exists on the public disk and delete it if it does.

Laravel
if (Storage::disk('[1]')->[2]('example.txt')) {
    Storage::disk('[3]')->delete('example.txt');
}
Drag options to blanks, or click blank then click option'
Apublic
Bexists
Clocal
Dmissing
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'missing' instead of 'exists' reverses the logic.
Using different disks for check and delete causes unexpected behavior.