Пример #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;
 }
 /**
  * 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}");
 }
 /**
  * @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);
 }
Пример #6
0
 /**
  * Create a new migration at the given path.
  *
  * @param  string  $name
  * @param  string  $path
  * @param  string  $table
  * @param  bool    $create
  * @return string
  */
 public function create($name, $path, $table = null, $create = false)
 {
     $this->makeDirectory($path);
     return parent::create($name, $path, $table, $create);
 }