/** * Execute the console command. * * @return void */ public function fire() { $fullPath = $this->createBaseMigration(); $this->files->put($fullPath, $this->getMigrationStub()); $this->info('Migration created successfully!'); $this->call('dump-autoload'); }
/** * Execute the console command. * * @return void */ public function fire() { $fullPath = $this->createBaseMigration(); $this->files->put($fullPath, $this->files->get(__DIR__ . DS . 'stubs' . DS . 'database.stub')); $this->info('Migration created successfully!'); $this->call('dump-autoload'); }
/** * Execute the console command. * * @return void */ public function fire() { $path = $this->nova['path.storage'] . DS . 'Logs' . DS . 'error.log'; $this->files->put($path, "\n"); // $path = $this->nova['path.storage'] . DS . 'Logs' . DS . 'messages.log'; $this->files->put($path, "\n"); // $this->info('The Application logs was cleared!'); }
/** * Write the completed stub to disk. * * @param string $stub * @param string $controller * @param string $path * @return void */ protected function writeFile($stub, $controller, $path) { if (str_contains($controller, '\\')) { $this->makeDirectory($controller, $path); } $controller = str_replace('\\', DS, $controller); if (!$this->files->exists($fullPath = $path . DS . $controller . '.php')) { return $this->files->put($fullPath, $stub); } }
/** * 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) { $path = $this->getPath($name, $path); // First we will get the stub file for the migration, which serves as a type // of template for the migration. Once we have those we will populate the // various place-holders, save the file, and run the post create event. $stub = $this->getStub($table, $create); $this->files->put($path, $this->populateStub($name, $stub, $table)); $this->firePostCreateHooks(); return $path; }
/** * generate the console command. * * @return mixed */ protected function generate() { foreach ($this->listFiles as $key => $file) { $filePath = $this->makeFilePath($this->listFolders[$key], $this->container['name']); $this->resolveByPath($filePath); $file = $this->formatContent($file); $find = basename($filePath); $filePath = strrev(preg_replace(strrev("/{$find}/"), '', strrev($filePath), 1)); $filePath = $filePath . $file; if ($this->files->exists($filePath)) { return $this->error($this->type . ' already exists!'); } $this->makeDirectory($filePath); foreach ($this->signOption as $option) { if ($this->option($option)) { $stubFile = $this->listStubs[$option][$key]; $this->resolveByOption($this->option($option)); break; } } if (!isset($stubFile)) { $stubFile = $this->listStubs['default'][$key]; } $this->files->put($filePath, $this->getStubContent($stubFile)); } return $this->info($this->type . ' created successfully.'); }
/** * Generate .gitkeep files within generated folders. */ protected function generateGitkeep() { $slug = $this->container['slug']; $modulePath = $this->getModulePath($slug); foreach ($this->moduleFolders as $folder) { $path = $modulePath . $folder; // $files = $this->files->glob($path . '/*'); if (!empty($files)) { continue; } $gitkeep = $path . '/.gitkeep'; $this->files->put($gitkeep, ''); } }
/** * Store an item in the cache for a given number of minutes. * * @param string $key * @param mixed $value * @param int $minutes * @return void */ public function put($key, $value, $minutes) { $value = $this->expiration($minutes) . serialize($value); $this->createCacheDirectory($path = $this->path($key)); $this->files->put($path, $value); }
/** * Write the service manifest file to disk. * * @param array $manifest * @return array */ public function writeManifest($manifest) { $content = "<?php\n\nreturn " . var_export($manifest, true) . ";\n"; $this->files->put($this->manifestPath, $content); return array_merge(array('when' => array()), $manifest); }
/** * Write the service manifest file to disk. * * @param array $manifest * @return array */ public function writeManifest($manifest) { $path = $this->manifestPath . '/services.json'; $this->files->put($path, json_encode($manifest, JSON_PRETTY_PRINT)); return $manifest; }
/** * {@inheritDoc} */ public function write($sessionId, $data) { $this->files->put($this->path . DS . $sessionId, $data, true); }