Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php use BookStack\Uploads\Image; use Illuminate\Database\Migrations\Migration; use Illu..

Decoded Output download

<?php

use BookStack\Uploads\Image;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('images', function (Blueprint $table) {
            $table->string('path', 400);
            $table->string('type')->index();
        });

        Image::all()->each(function ($image) {
            $image->path = $image->url;
            $image->type = 'gallery';
            $image->save();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('images', function (Blueprint $table) {
            $table->dropColumn('type');
            $table->dropColumn('path');
        });
    }
};
 ?>

Did this file decode correctly?

Original Code

<?php

use BookStack\Uploads\Image;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('images', function (Blueprint $table) {
            $table->string('path', 400);
            $table->string('type')->index();
        });

        Image::all()->each(function ($image) {
            $image->path = $image->url;
            $image->type = 'gallery';
            $image->save();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('images', function (Blueprint $table) {
            $table->dropColumn('type');
            $table->dropColumn('path');
        });
    }
};

Function Calls

None

Variables

None

Stats

MD5 c6b6331d78a568b9112e9f3fb96420ae
Eval Count 0
Decode Time 111 ms