Skip to the workspace
Pebellslearn by building
Request–Response Flow and Project Folders  ›  Capstone Project

database, storage, tests and vendor

Database 15 mindatabase/ holds migrations, factories and seeders, storage/ holds files the app writes, tests/ holds feature and unit tests, and vendor/ holds Composer packages that you never edit or commit.

laravel / database, storage, tests and vendor

Explore each scene at your own pace.

01 · The rule

The rule

database, storage, tests and vendor

Four folders remain, and each answers a different question. Where is the shape of my data? Where does the app write files? Where do I prove it works? Where is everyone else's code? Mix them up and you end up committing gigabytes of packages or losing a member's uploaded photo.

The rule

database/ shapes data, storage/ collects output, tests/ proves it, vendor/ borrows.

database/

  • migrations/: PHP files that create and change tables, run with php artisan migrate.
  • factories/: recipes for fake rows, used in tests and seeding.
  • seeders/: code that fills tables with starting data, run with php artisan db:seed.
  • database.sqlite: the database file itself, when you use SQLite.

storage/: what the running app writes.

  • storage/app/: files your code saves. storage/app/public is for files the public should see, such as avatars.
  • storage/framework/: compiled views, cache files and sessions.
  • storage/logs/laravel.log: the log, and the first place to look when a page errors.

Uploaded files in storage/app/public are not reachable until you run:

php artisan storage:link

That creates a public/storage link, so storage/app/public/avatars/ana.jpg is served at /storage/avatars/ana.jpg.

tests/

  • tests/Feature/: tests that send requests through the app, such as "GET /books returns 200".
  • tests/Unit/: tests of one small class on its own.

Run them with php artisan test.

vendor/: every Composer package, including Laravel itself in vendor/laravel/framework. It is listed in .gitignore, and composer install rebuilds it from composer.lock.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.