Laravel Basic
Laravel Form
Laravel Database
Laravel Advance
By default, migrations are stored in database/migrations/.You can organize them into subfolders for better structure:
database/migrations/
├── 2024_01_01_000000_create_users_table.php ├── blog/ │ └── 2024_02_01_000000_create_posts_table.php ├── shop/ │ └── 2024_02_02_000000_create_products_table.php
You can create these folders manually two folders blog and shop.Generate migrations into them using:
php artisan make:migration create_posts_table --path=database/migrations/blog
This generates a file in database/migrations/blog/:
public function up(): void { Schema::create('posts', function (Blueprint $table) { $table->id(); $table->string('title'); $table->text('content'); $table->timestamps(); }); } public function down(): void { Schema::dropIfExists('posts'); }
Running Migrations:
php artisan migrate --path=database/migrations/blog
Rollback Comment
php artisan migrate:rollback --path=database/migrations/blog