PHP code example of eyf / laravel-exodus

1. Go to this page and download the library: Download eyf/laravel-exodus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

eyf / laravel-exodus example snippets



// database/migrations/2020_05_05_085245_create_post_user_pivot_table.php

class CreatePostUserPivotTable extends Migration
{
    public function up()
    {
        Schema::create("post_user", function (Blueprint $table) {
            $table
                ->foreignId("post_id")
                ->index()
                ->constrained();
            $table
                ->foreignId("user_id")
                ->index()
                ->constrained();
            $table->primary(["post_id", "user_id"]);
        });
    }

    public function down()
    {
        Schema::dropIfExists("post_user");
    }
}
bash
php artisan exodus

Created Migration: 2020_05_05_100005_create_posts_table
bash
php artisan migrate
bash
php artisan exodus --force