0
0
Laravelframework~5 mins

Public disk and symbolic links in Laravel - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the 'public' disk in Laravel?
The 'public' disk in Laravel is used to store files that should be publicly accessible, like images or documents, typically stored in the storage/app/public directory and linked to public/storage.
Click to reveal answer
beginner
What command creates a symbolic link from public/storage to storage/app/public in Laravel?
The command php artisan storage:link creates a symbolic link so that files stored in storage/app/public are accessible from the web via public/storage.
Click to reveal answer
intermediate
Why do we use symbolic links for the public disk in Laravel?
Symbolic links let Laravel serve files stored outside the public folder securely by linking them inside the public directory, making them accessible via URLs without exposing the whole storage folder.
Click to reveal answer
beginner
Where are files stored when using the 'public' disk in Laravel by default?
Files are stored in the storage/app/public directory by default when using the 'public' disk in Laravel.
Click to reveal answer
beginner
What happens if you don't run php artisan storage:link after storing files on the public disk?
If you don't run php artisan storage:link, files in storage/app/public won't be accessible from the web because the symbolic link public/storage won't exist.
Click to reveal answer
What does the php artisan storage:link command do in Laravel?
ACreates a symbolic link from <code>public/storage</code> to <code>storage/app/public</code>
BDeletes all files in the public disk
CCopies files from <code>storage/app/public</code> to <code>public/storage</code>
DCreates a backup of the storage folder
Where are files stored when using Laravel's 'public' disk by default?
A<code>storage/app/public</code>
B<code>public/storage</code>
C<code>resources/public</code>
D<code>storage/public</code>
Why is a symbolic link used for the public disk in Laravel?
ATo encrypt files in storage
BTo copy files automatically
CTo make files accessible via the web without exposing the entire storage folder
DTo delete old files
What happens if you try to access files stored on the public disk without creating the symbolic link?
AFiles will be deleted automatically
BFiles won't be accessible via the web
CFiles will be copied to the public folder
DFiles will be accessible without any issue
Which Laravel filesystem disk is typically linked to public/storage?
As3
Blocal
Cftp
Dpublic
Explain how Laravel uses the public disk and symbolic links to serve files publicly.
Think about where files are stored and how they become accessible via the web.
You got /4 concepts.
    Describe what would happen if the symbolic link for the public disk is missing and how to fix it.
    Consider the role of the symbolic link in file accessibility.
    You got /4 concepts.