예제 #1
0
 /**
  * Execute the console command.
  *
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function fire()
 {
     $files = $this->creator->getFilesystem();
     $name = 'create_eloquent_log_table';
     $path = $this->creator->create($name, $this->getMigrationPath());
     $file = pathinfo($path, PATHINFO_FILENAME);
     $files->put($path, $files->get(__DIR__ . '/stubs/database.stub'));
     $this->line("<info>Created Migration:</info> {$file}");
     $this->composer->dumpAutoloads();
 }
예제 #2
0
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // It's possible for the developer to specify the tables to modify in this
     // schema operation. The developer may also specify if this table needs
     // to be freshly created so we can create the appropriate migrations.
     $name = $this->input->getArgument('name');
     $table = $this->input->getOption('table');
     $create = $this->input->getOption('create');
     // Now we're ready to get the path where these migrations should be placed
     // on disk. This may be specified via the package option on the command
     // and we will verify that option to determine the appropriate paths.
     $path = $this->getMigrationPath();
     $this->creator->create($name, $path, $table, $create);
     $this->info('Migration created successfully!');
 }
예제 #3
0
 /**
  * Write the migration file to disk.
  *
  * @param  string  $name
  * @param  string  $table
  * @param  bool    $create
  * @return string
  */
 protected function writeMigration($name, $table, $create)
 {
     $path = $this->getMigrationPath();
     $file = pathinfo($this->creator->create($name, $path, $table, $create), PATHINFO_FILENAME);
     $this->line("<info>Created Migration:</info> {$file}");
     return $file;
 }
 /**
  * @inheritdoc
  */
 public static function run($request, $response, $args)
 {
     global $argv;
     $container = static::getApp()->getContainer();
     $pathResolver = $container['pathResolver'];
     $filesystem = new Filesystem();
     $creator = new MigrationCreator($filesystem);
     $definition = new InputDefinition();
     $definition->addArgument(new InputArgument('name', InputArgument::REQUIRED));
     $definition->addOption(new InputOption('table', 't', InputOption::VALUE_OPTIONAL));
     $input = new ArgvInput(array_slice($argv, 1), $definition);
     $output = new ConsoleOutput();
     $path = $pathResolver->getAlias('@db/migrations');
     $name = $input->getArgument('name');
     $table = $input->getOption('table');
     $file = pathinfo($creator->create($name, $path, $table), PATHINFO_FILENAME);
     \dump($file);
 }
 /**
  * Write the migration file to disk.
  *
  * @param $nameMigration
  * @param $table
  * @param $create
  * @param $pathDatabaseMigrationFolder
  * @return string
  */
 protected function writeMigration($nameMigration, $table, $create, $pathDatabaseMigrationFolder)
 {
     /*
      * stap 5 : namemigration = Create_Folders_Table - table =
      * - create =
      * - pathDatabaseMigrationsFolder = D:\laragon\www\laravel-webshop-filip-boilerplate\
      * packages/FilipWebShop/Test2/src/Database/Migrations
      */
     $this->info("stap 5 : namemigration = " . $nameMigration . " - table = " . $table . " - create = " . $create . ' - pathDatabaseMigrationsFolder = ' . $pathDatabaseMigrationFolder);
     $file = pathinfo($this->creator->create($nameMigration, $pathDatabaseMigrationFolder, $table, $create), PATHINFO_FILENAME);
     $this->line("<info>Created Migration:</info> {$file}");
 }
 /**
  * Get the migration stub file.
  *
  * @param  string $table
  * @param  bool   $create
  * @return string
  */
 protected function getStub($table, $create)
 {
     if ($this->input->getOption('fields')) {
         return $this->files->get($this->getStubPath() . '/fields.stub');
     }
     if ($this->input->getOption('stream')) {
         return $this->files->get($this->getStubPath() . '/stream.stub');
     }
     if (is_null($table)) {
         return $this->files->get($this->getStubPath() . '/blank.stub');
     }
     return parent::getStub($table, $create);
 }
예제 #7
0
 /**
  * Get the migration stub file.
  *
  * @param  string  $table
  * @param  bool    $create
  * @return string
  */
 protected function getStub($table, $create)
 {
     if (is_null($table)) {
         if ($this->module) {
             return $this->files->get(__DIR__ . '/stubs/blank.stub');
         }
         return parent::getStub($table, $create);
     } else {
         $stub = $create ? 'create.stub' : 'update.stub';
         if ($this->module) {
             return $this->files->get(__DIR__ . "/stubs/{$stub}");
         }
         return parent::getStub($table, $create);
     }
 }
예제 #8
0
 /**
  * Create a new migration creator instance.
  *
  * @param  \Illuminate\Filesystem\Filesystem         $filesystem
  * @param  \Illuminate\Contracts\Container\Container $container
  * @return void
  */
 public function __construct(Filesystem $filesystem, ContainerContract $container)
 {
     parent::__construct($filesystem);
     $this->setContainer($container);
 }
예제 #9
0
 /**
  * Write the migration file to disk.
  *
  * @param  string  $name
  * @param  string  $table
  * @param  bool    $create
  * @return string
  */
 protected function writeMigration($name, $contents)
 {
     $path = $this->getMigrationPath();
     $file = pathinfo($this->creator->overrideCreate($name, $path, $contents), PATHINFO_FILENAME);
     $this->line("<info>Created Migration:</info> {$file}");
 }
 /**
  * Populate the place-holders in the migration stub.
  *
  * @param  string $name
  * @param  string $stub
  * @param  string $table
  * @return string
  */
 protected function populateStub($name, $stub, $table)
 {
     $stub = parent::populateStub($name, $stub, $table);
     return str_replace('{{column}}', $this->column, $stub);
 }
 protected function populateStub($name, $stub, $table)
 {
     $stub = str_replace('DummyKey', str_singular($table), parent::populateStub($name, $stub, $table));
     return $stub;
 }
예제 #12
0
 /**
  * MigrationCreator constructor.
  *
  * @param \Notadd\Foundation\Application    $application
  * @param \Illuminate\Filesystem\Filesystem $filesystem
  */
 public function __construct(Application $application, Filesystem $filesystem)
 {
     parent::__construct($filesystem);
     $this->application = $application;
 }