Beispiel #1
0
 /**
  * @param string $name
  */
 private function create($name = '')
 {
     $content = $this->migrate('stroge/create/migration.php.dist', ['name' => $name]);
     $fileName = $this->manager->createName($name);
     if (!$this->file->exists($fileName)) {
         $this->file->touch($fileName);
         $this->write(DATABASE . 'Migrations/', $fileName, $content);
     } else {
         $this->error(sprintf('%s isimli dosya zaten %s yolunda var', $name, $fileName));
     }
 }
Beispiel #2
0
 /**
  * Dosyayı oluşturur ve içeriği dosyaya aktarır
  *
  * @param string $src
  * @param string $fileName
  * @param string $content
  * @throws \Exception
  */
 private function create($src = '', $fileName = '', $content = '')
 {
     $file = Filesystem::getInstance();
     $path = $src . $fileName . '.php';
     // kaynak dosya yoksa oluşturuyoruz
     if (!$file->exists($src)) {
         $file->mkdir($src);
     }
     $file->chmod($src, 0777);
     // eğer dosya yoksa oluşturuyoruz
     if (!$file->exists($path)) {
         $file->touch($path);
         $file->chmod($path, 0777);
         if ($file->isWriteable($path)) {
             $file->write($path, $content);
             $this->info(sprintf('%s isimli dosya %s yolunda başarıyla oluşturuldu.', $fileName, $src));
         } else {
             $this->error(sprintf('%s isimli dosyaya veri işlenemedi, sebep: dosya yazılabilir değil', $path));
         }
     } else {
         $this->error(sprintf('%s isimli dosya %s yolunda oluşturulamadı, sebep: dosya zaten var', $fileName, $src));
     }
 }