La Ravel
La Ravel
celebrated for its elegant syntax and developer-friendly features. This version
introduces several enhancements aimed at streamlining development workflows
and improving application performance.
Type Command
composer dump-autoload
This command scans the app/, vendor/, and composer.json files to regenerate
the autoload files. It is useful when adding new classes or updating class
names.
Component Description
Type Purpose
GET Retrieve data (e.g., show a page).
POST Submit data (e.g., form submission).
Type Purpose
PUT Update an existing resource.
PATCH Partially update a resource.
DELETE Remove a resource.
Ex-- Route::get('/user/{id}', function ($id) { return "User ID: " . $id; });
What is Middleware?
Middleware acts as a layer between the request and the response.
It can:
✔ Check if a user is authenticated.
✔ Log request details.
✔ Modify requests or responses.
✔ Restrict access based on conditions.
Creating Middleware :
To create a new middleware, run;
php artisan make:middleware CheckUserRole
If you're working with Laravel 11 in VS Code, installing the right extensions can
improve productivity. Here are the must-have extensions:
Prettier - Code Formatter – Formats code consistently across PHP, JS, and Blade
files.