0
0
Laravelframework~10 mins

Local disk storage 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 store a file on the local disk using Laravel's Storage facade.

Laravel
Storage::disk('[1]')->put('example.txt', 'Hello World');
Drag options to blanks, or click blank then click option'
Alocal
Bpublic
Cs3
Dftp
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'public' instead of 'local' for local disk storage.
Using cloud disks like 's3' when local storage is intended.
2fill in blank
medium

Complete the code to check if a file exists on the local disk.

Laravel
if (Storage::disk('local')->[1]('example.txt')) {
    // File exists
}
Drag options to blanks, or click blank then click option'
Ahas
Bexists
Ccontains
Dfind
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'has' which is not a method for checking files.
Using 'contains' which is for string operations.
3fill in blank
hard

Fix the error in the code to retrieve the contents of a file from local disk storage.

Laravel
$contents = Storage::disk('local')->[1]('example.txt');
Drag options to blanks, or click blank then click option'
AgetContents
Bread
Cget
Dfetch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'getContents' which is not a Laravel Storage method.
Using 'read' which does not exist in this context.
4fill in blank
hard

Fill both blanks to delete a file from the local disk storage.

Laravel
Storage::[1]('[2]');
Drag options to blanks, or click blank then click option'
Adelete
Bexample.txt
Cremove
Dlocal
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'remove' which is not a Laravel Storage method.
Using disk name instead of filename as second argument.
5fill in blank
hard

Fill all three blanks to copy a file from one location to another on the local disk.

Laravel
Storage::disk('[1]')->[2]('old.txt', '[3]');
Drag options to blanks, or click blank then click option'
Alocal
Bcopy
Cnew.txt
Dpublic
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'public' disk instead of 'local' for local storage.
Using 'move' instead of 'copy' which deletes the original.