Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Oct 3, 2023
2 parents 4f309ba + e0c5ca9 commit e6e3dc3
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/Commands/MigrationGeneratorCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Orchestra\Canvas\Core\Commands;

use Orchestra\Canvas\Core\Concerns\MigrationGenerator;

class MigrationGeneratorCommand extends \Illuminate\Console\MigrationGeneratorCommand

Check failure on line 7 in src/Commands/MigrationGeneratorCommand.php

View workflow job for this annotation

GitHub Actions / PHP8.2 on ubuntu-latest (highest)

Non-abstract class Orchestra\Canvas\Core\Commands\MigrationGeneratorCommand contains abstract method migrationStubFile() from class Illuminate\Console\MigrationGeneratorCommand.

Check failure on line 7 in src/Commands/MigrationGeneratorCommand.php

View workflow job for this annotation

GitHub Actions / PHP8.2 on ubuntu-latest (highest)

Non-abstract class Orchestra\Canvas\Core\Commands\MigrationGeneratorCommand contains abstract method migrationTableName() from class Illuminate\Console\MigrationGeneratorCommand.
{
use MigrationGenerator;

/**
* Create a new notifications table command instance.
*
* @param \Illuminate\Filesystem\Filesystem $files
* @return void
*/
public function __construct(Filesystem $files)

Check failure on line 17 in src/Commands/MigrationGeneratorCommand.php

View workflow job for this annotation

GitHub Actions / PHP8.2 on ubuntu-latest (highest)

PHPDoc tag @param for parameter $files with type Illuminate\Filesystem\Filesystem is not subtype of native type Orchestra\Canvas\Core\Commands\Filesystem.

Check failure on line 17 in src/Commands/MigrationGeneratorCommand.php

View workflow job for this annotation

GitHub Actions / PHP8.2 on ubuntu-latest (highest)

Parameter $files of method Orchestra\Canvas\Core\Commands\MigrationGeneratorCommand::__construct() has invalid type Orchestra\Canvas\Core\Commands\Filesystem.
{
parent::__construct($files);

Check failure on line 19 in src/Commands/MigrationGeneratorCommand.php

View workflow job for this annotation

GitHub Actions / PHP8.2 on ubuntu-latest (highest)

Parameter #1 $files of method Illuminate\Console\MigrationGeneratorCommand::__construct() expects Illuminate\Filesystem\Filesystem, Orchestra\Canvas\Core\Commands\Filesystem given.

$this->addGeneratorPresetOptions();
}

/**
* Create a base migration file for the table.
*
* @param string $table
* @return string
*/
protected function createBaseMigration($table)
{
return $this->createBaseMigrationUsingCanvas($table);
}

/**
* Determine whether a migration for the table already exists.
*
* @param string $table
* @return bool
*/
protected function migrationExists($table)
{
return $this->migrationExistsUsingCanvas($table);
}
}
10 changes: 10 additions & 0 deletions src/Concerns/MigrationGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@ protected function createBaseMigrationUsingCanvas(string $table): string
"create_{$table}_table", $this->generatorPreset()->migrationPath()
);
}

/**
* Determine whether a migration for the table already exists.
*/
protected function migrationExistsUsingCanvas(string $table): bool
{
return \count($this->files->glob(
$this->laravel->joinPaths($this->generatorPreset()->migrationPath(), '*_*_*_*_create_'.$table.'_table.php')
)) !== 0;
}
}

0 comments on commit e6e3dc3

Please sign in to comment.