
Laravel Workshop: Routes, Migrations, Models, and Mild Panic
Welcome to Web Dev → Laravel — the Fyrbloc place for Laravel builds, bugs, questions, fixes, deployments, packages, queues, APIs, dashboards, SaaS ideas, admin panels, and that moment when you realise the problem was not Laravel.
It was cache.
Again.
Laravel is one of the most useful PHP frameworks for building real web apps quickly. It gives you routing, controllers, models, migrations, queues, mail, jobs, validation, auth, Blade, APIs, storage, and enough artisan commands to make you feel powerful and slightly dangerous.
This section is for builders using Laravel to make things.
Small apps.
Big apps.
Practice apps.
SaaS ideas.
Dashboards.
APIs.
Admin tools.
Side projects that started as “simple” and now have roles, billing, uploads, settings, and a roadmap.
Classic Laravel behaviour.

What belongs here?
Use Web Dev → Laravel for topics like:
- Laravel setup
- Routes
- Controllers
- Models
- Migrations
- Seeders
- Factories
- Blade templates
- Eloquent queries
- Middleware
- Validation
- Authentication
- Authorization
- Policies
- Gates
- Queues
- Jobs
- Events
- Listeners
- Mail
- Notifications
- File storage
- Uploads
- APIs
- Sanctum
- Passport
- Livewire
- Inertia
- Filament
- Nova
- Cashier
- Horizon
- Scheduler
- Cron jobs
- Deployment
- Performance
- Caching
- Debugging
- Composer conflicts
- Environment config
- “Why is this still using the old value?” moments
If it is Laravel-related, post it here.
If it is general PHP, use Web Dev → PHP.
If it is server-specific, include your server details too.
Laravel is friendly.
Servers are sometimes emotionally unavailable.
Laravel help template
Copy this when asking for help:
What I am building:
Laravel version:
PHP version:
Database:
Hosting/server:
What I am trying to do:
What happened:
What I expected:
Exact error:
What I already tried:
Relevant code:
Screenshot/link:
Example:
What I am building:
A small booking app.
Laravel version:
12.x
PHP version:
8.4
Database:
MySQL
Hosting/server:
CloudPanel / Nginx
What I am trying to do:
Save a booking form to the database.
What happened:
The form submits, but no record is created.
What I expected:
A new booking should appear in the bookings table.
Exact error:
SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a default value
What I already tried:
Checked migration, model fillable fields, and controller store method.
Relevant code:
Added below with secrets removed.
Screenshot/link:
Added if useful.
That is a useful Laravel help request.
It gives people something to work with.
Much better than:
Laravel not saving.
That sentence has entered the fog dimension.

Good Laravel post topics
Routes and controllers
Good questions:
My route returns 404 even though it exists.
My controller method is not being called.
Route model binding is not finding the record.
Useful command:
php artisan route:list
If a route is not working, include:
Route definition
Controller method
URL you visited
route:list output
Error shown
Laravel cannot help if the route is hiding in a different file like a tiny framework goblin.
Migrations and database
Good questions:
Migration fails when adding a foreign key.
Column exists locally but not on production.
Seeder runs but data does not appear.
Useful commands:
php artisan migrate
php artisan migrate:status
php artisan migrate:fresh --seed
Be careful with:
php artisan migrate:fresh
That deletes and recreates tables.
Useful locally.
Dangerous on production.
Do not casually drop your production database unless your goal is instant character development.
Eloquent and models
Good questions:
My model is not saving a field.
Relationship returns empty results.
Mass assignment error after form submit.
Common checks:
Is the table name correct?
Is the model namespace correct?
Is fillable/guarded set correctly?
Is the relationship method correct?
Is the foreign key correct?
Is the record actually in the database?
Example:
protected $fillable = [
'title',
'description',
'status',
];
If the field is not fillable, Laravel may simply refuse to save it.
Laravel is polite.
But firm.

Cache: the usual suspect
Laravel cache can make old settings, routes, config, or views keep appearing after you changed them.
Useful commands:
php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
Sometimes also:
php artisan optimize:clear
If you changed .env and nothing updates, try:
php artisan config:clear
If you changed routes and nothing updates:
php artisan route:clear
If your Blade view looks old:
php artisan view:clear
Cache is useful.
Cache is also a professional liar wearing a performance badge.
Environment files and config
Laravel uses .env for important configuration.
Common .env areas:
APP_NAME
APP_ENV
APP_KEY
APP_DEBUG
APP_URL
DB_CONNECTION
DB_HOST
DB_PORT
DB_DATABASE
DB_USERNAME
DB_PASSWORD
MAIL_MAILER
MAIL_HOST
MAIL_PORT
MAIL_USERNAME
MAIL_PASSWORD
MAIL_ENCRYPTION
MAIL_FROM_ADDRESS
QUEUE_CONNECTION
CACHE_STORE
SESSION_DRIVER
FILESYSTEM_DISK
Never post your full .env publicly.
Safe example:
DB_DATABASE=my_app
DB_USERNAME=hidden
DB_PASSWORD=hidden
MAIL_USERNAME=hidden
MAIL_PASSWORD=hidden
Unsafe example:
Here is my real database password and mail password.
Do not feed the internet your keys.
The internet is already too confident.

Common Laravel errors
419 Page Expired
Usually related to CSRF/session issues.
Check:
CSRF token exists in form
Session driver is working
APP_URL is correct
Cookie domain is correct
HTTPS settings are correct
Storage permissions are okay
Blade form should include:
@csrf
Laravel is not being dramatic here.
It is protecting the form.
Possibly with too much mystery wording.
500 Server Error
Check logs:
tail -n 100 storage/logs/laravel.log
Also check:
php artisan about
The browser says 500.
The log usually says the actual truth.
The browser is just the town crier.
Class not found
Common causes:
Wrong namespace
Missing import
Composer autoload issue
File name mismatch
Package not installed
Cached old code
Try:
composer dump-autoload
php artisan optimize:clear
Then check the namespace and use statements.
PHP autoloading is powerful.
Also petty.
Permission errors
Common writable folders:
storage
bootstrap/cache
Typical server fix:
chmod -R 775 storage bootstrap/cache
Ownership matters too:
chown -R user:user storage bootstrap/cache
Use the correct server user.
Do not blindly paste user:user unless that is actually your user.
The terminal will do exactly what you say.
It will not ask if you are having a sensible day.
Laravel deployment checklist
Before asking about deployment, check:
APP_ENV=production
APP_DEBUG=false
APP_URL is correct
Database credentials are correct
APP_KEY is set
Storage permissions are correct
Migrations have run
Composer dependencies installed
Assets built if needed
Queue worker running if used
Scheduler cron configured if used
Mail settings tested
Useful deployment commands:
composer install --no-dev --optimize-autoloader
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
php artisan storage:link
php artisan queue:restart
Do not run production commands blindly.
Especially migrations.
A migration can be a clean upgrade.
Or a small database earthquake.
Read first.

Queues and jobs
Laravel queues are useful for slow tasks like:
Sending emails
Processing images
Handling uploads
Calling APIs
Generating files
Running background tasks
Sending notifications
Common checks:
QUEUE_CONNECTION is set
Queue worker is running
Failed jobs table exists
Job is being dispatched
Worker has been restarted after code change
Useful commands:
php artisan queue:work
php artisan queue:restart
php artisan queue:failed
If jobs are not running, include:
QUEUE_CONNECTION
How the worker is started
Error from queue worker
Job class
Dispatch code
Hosting/server setup
A queued job that never runs is not magic.
It is usually a worker problem.
Or a config problem.
Or both, because computers enjoy teamwork when annoying you.
Laravel scheduler
For scheduled tasks, check:
php artisan schedule:list
Cron usually needs something like:
* * * * * cd /path/to/project && php artisan schedule:run >> /dev/null 2>&1
If your scheduled task is not running, include:
schedule:list output
Cron command
Server user
Laravel version
Task code
Expected run time
Any logs
Do not assume the scheduler is broken.
Sometimes cron is not running.
Sometimes cron is running from the wrong folder.
Sometimes cron is a tiny ghost.
Authentication and users
Laravel auth questions may involve:
Login
Signup
Password reset
Email verification
Roles
Permissions
Policies
Guards
Sanctum
Sessions
Cookies
Remember me
Useful context:
Auth package used:
Breeze / Jetstream / Fortify / custom / Sanctum / Passport
What fails:
Login / signup / password reset / API auth
Exact error:
If login works locally but not production, check:
APP_URL
SESSION_DOMAIN
SESSION_DRIVER
HTTPS/cookie settings
Cache
Database
Mail settings for verification
Auth bugs are annoying because they feel personal.
They are usually config.
Mostly.

APIs and Sanctum
For API issues, include:
Route
Controller
Request method
Headers
Auth method
Token/cookie setup
Response code
Error body
Frontend/client used
Common API problems:
401 Unauthorized
403 Forbidden
419 CSRF/session
404 wrong route
422 validation failed
CORS issue
Token not sent
Wrong guard
Useful command:
php artisan route:list
For validation errors, check the response body.
Laravel usually tells you what failed.
Sometimes very clearly.
Sometimes in a way that makes you question your request payload and your life choices.
Blade and frontend
Laravel frontend topics can include:
Blade templates
Components
Layouts
Vite
Tailwind
Alpine
Livewire
Inertia
Vue
React
Asset builds
CSS not updating
JS not loading
Useful commands:
npm install
npm run dev
npm run build
If assets are not updating, include:
Vite config
Blade asset call
npm command output
Browser console error
Production/dev mode
Also hard refresh:
CTRL + F5
Because sometimes the browser is the villain.
A quiet villain.
But still.
Good Laravel post titles
Use clear titles like:
Laravel 12 form submits but record is not saved
Route returns 404 after adding controller method
419 Page Expired on login form after deployment
Queue jobs not running on CloudPanel server
Laravel mail works locally but fails on production
Migration foreign key error with users table
Avoid:
Laravel help
Broken
Question
Need fix
Clear title = better replies.
Vague title = everyone asks basic questions first.
Save the warm-up round.

Good replies in Laravel threads
Helpful replies:
Check whether the field is in $fillable on the model.
Run php artisan route:list and confirm the route method and URI.
This looks like config cache. Try php artisan config:clear.
If the queue worker was already running, restart it after deploying new code.
A 419 usually means CSRF/session/cookie config, not a random Laravel crash.
Less useful replies:
Use another framework.
Laravel is bad.
Just rebuild it.
This is easy.
No.
Help with the problem.
Framework arguments can sit outside and think about what they have done.
Laravel help checklist
Before posting, check:
Did I include Laravel version?
Did I include PHP version?
Did I include the exact error?
Did I include the route/controller/model if relevant?
Did I say what changed recently?
Did I say what I already tried?
Did I remove secrets from .env/code/logs?
Did I include screenshots only if safe?
Did I ask a clear question?
That is enough.
A clear Laravel post gets better help.
A vague Laravel post gets:
What version?
What error?
What code?
What did you try?
All valid questions.
But avoidable if you include them first.
Quick Laravel starter prompt
Use this:
Laravel issue:
Version:
PHP:
Database:
Server:
What I expected:
What happened:
Error:
Code/log:
What I tried:
Private info removed:
Yes
Example:
Laravel issue:
Password reset email is not sending.
Version:
Laravel 12
PHP:
8.4
Database:
MySQL
Server:
CloudPanel / Nginx
What I expected:
User receives reset email.
What happened:
No email arrives.
Error:
SMTP authentication failed.
Code/log:
Added below with secrets removed.
What I tried:
Checked .env mail settings, cleared config cache, tested SMTP details.
Private info removed:
Yes
That is useful.
Clean.
Debuggable.
Not a mystery ritual.
Final note
Laravel is excellent for building real apps quickly, but it rewards clear structure.
Routes.
Controllers.
Models.
Migrations.
Views.
Queues.
Config.
Cache.
When something breaks, bring the exact error, the relevant code, and what changed recently.
Hide secrets.
Clear cache when appropriate.
Do not blame Laravel until you have checked your .env.
Build. Route. Migrate. Debug. Ship.