test content
Blog
-
Laravel 12 – Requests
test content
-

Laravel 12 – Middleware
Introduction
Middleware provide a convenient mechanism for inspecting and filtering HTTP requests entering your application. For example, Laravel includes a middleware that verifies the user of your application is authenticated. If the user is not authenticated, the middleware will redirect the user to your application’s login screen. However, if the user is authenticated, the middleware will allow the request to proceed further into the application.
Defining Middleware
To create a new middleware, use the
make:middlewareArtisan command:php artisan make:middleware EnsureTokenIsValid -

Laravel 12 – Routing
Basic Routing
The most basic Laravel routes accept a URI and a closure, providing a very simple and expressive method of defining routes and behavior without complicated routing configuration files:
use Illuminate\Support\Facades\Route; Route::get('/greeting', function () { return 'Hello World'; }); -

Laravel 12 – Membuat Aplikasi Laravel
Membuat Aplikasi
Jika Anda sudah menginstal PHP dan Composer, Anda dapat menginstal penginstal Laravel melalui Composer:
composer global require laravel/installerDatabases dan Migrations
Jika Anda lebih suka menggunakan driver basis data lain seperti MySQL atau PostgreSQL, Anda dapat memperbarui berkas konfigurasi .env agar menggunakan basis data yang sesuai. Misalnya, jika Anda ingin menggunakan MySQL, perbarui variabel DB_* pada berkas konfigurasi .env Anda seperti ini:
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=root DB_PASSWORD=php artisan migrate