You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.1 KiB
46 lines
1.1 KiB
7 years ago
|
<?php
|
||
|
|
||
|
namespace Glmdev\Meta;
|
||
|
|
||
|
use Closure;
|
||
|
use Illuminate\Support\Str;
|
||
|
use InvalidArgumentException;
|
||
|
use Illuminate\Filesystem\Filesystem;
|
||
|
|
||
|
class MetaMigrationCreator extends \Illuminate\Database\Migrations\MigrationCreator
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* Get the migration stub file.
|
||
|
*
|
||
|
* @param string $table
|
||
|
* @param bool $create
|
||
|
* @return string
|
||
|
*/
|
||
|
protected function getStub($table, $create)
|
||
|
{
|
||
|
if (is_null($table)) {
|
||
|
return $this->files->get($this->getStubPath().'/migration.stub');
|
||
|
}
|
||
|
|
||
|
// We also have stubs for creating new tables and modifying existing tables
|
||
|
// to save the developer some typing when they are creating a new tables
|
||
|
// or modifying existing tables. We'll grab the appropriate stub here.
|
||
|
else {
|
||
|
$stub = $create ? 'create.stub' : 'update.stub';
|
||
|
|
||
|
return $this->files->get($this->getStubPath()."/{$stub}");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the path to the stubs.
|
||
|
*
|
||
|
* @return string
|
||
|
*/
|
||
|
public function getStubPath()
|
||
|
{
|
||
|
return __DIR__.'/stubs';
|
||
|
}
|
||
|
}
|