Sindbad~EG File Manager

Current Path : /proc/self/cwd/common/Database/migrations/
Upload File :
Current File : //proc/self/cwd/common/Database/migrations/2018_08_15_132225_move_uploads_into_subfolders.php

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class MoveUploadsIntoSubfolders extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        $drive = Storage::drive(config('common.site.uploads_disk'));

        foreach ($drive->files() as $fileName) {
            $pathinfo = pathinfo($fileName);
            if ( ! isset($pathinfo['extension']) && ! str_contains($fileName, '.')) {
                $drive->createDir("$fileName-temp");
                $drive->move($fileName, "$fileName-temp/$fileName");
                $drive->rename("$fileName-temp", $fileName);
            }
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists