/** * {@inheritDoc} */ public function gc($lifetime) { $files = Finder::create()->in($this->path)->files()->ignoreDotFiles(true)->date('<= now - ' . $lifetime . ' seconds'); foreach ($files as $file) { $this->files->delete($file->getRealPath()); } }
/** * 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'); }
/** * Find the given view in the list of paths. * * @param string $name * @param array $paths * @return string * * @throws \InvalidArgumentException */ protected function findViewFile($name) { foreach ($this->getPossibleViewFiles($name) as $file) { if ($this->files->exists($file)) { return $file; } } }
/** * 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() . DS . 'blank.stub'); } else { $stub = $create ? 'create.stub' : 'update.stub'; return $this->files->get($this->getStubPath() . DS . $stub); } }
/** * 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!'); }
/** * Execute the console command. * * @return void */ public function fire() { $destination = $this->getPath() . DS . 'Reminders.php'; if (!$this->files->exists($destination)) { $this->files->copy(__DIR__ . DS . 'stubs' . DS . 'controller.stub', $destination); $this->info('Password reminders controller created successfully!'); $this->comment("Route: Route::controller('password', 'RemindersController');"); } else { $this->error('Password reminders controller already exists!'); } }
/** * Get a module's manifest contents. * * @param string $slug * * @return Collection|null */ public function getManifest($slug) { if (is_null($slug)) { return; } $module = Str::slug($slug); $path = $this->getManifestPath($module); $contents = $this->files->get($path); $collection = collect(json_decode($contents, true)); return $collection; }
/** * Load the environment variables for the given environment. * * @param string $environment * @return array */ public function load($environment = null) { if ($environment == 'production') { $environment = null; } if (!$this->files->exists($path = $this->getFile($environment))) { return array(); } else { return $this->files->getRequire($path); } }
/** * Get stub content by key. * * @param int $key * * @return string */ protected function getStubContent($key) { $stub = $this->moduleStubs[$key]; $path = __DIR__ . DS . 'stubs' . DS . $stub . '.stub'; $content = $this->files->get($path); return $this->formatContent($content); }
/** * Remove all items from the cache. * * @return void */ public function flush() { if ($this->files->isDirectory($this->directory)) { foreach ($this->files->directories($this->directory) as $directory) { $this->files->deleteDirectory($directory); } } }
/** * Get all of the method stubs for the given options. * * @param array $options * @return array */ protected function getMethodStubs($options) { $stubs = array(); foreach ($this->getMethods($options) as $method) { $stubs[] = $this->files->get(__DIR__ . DS . 'stubs' . DS . $method . '.stub'); } return $stubs; }
/** * 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); }
/** * Get the contents of the reminder migration stub. * * @return string */ protected function getMigrationStub() { $stub = $this->files->get(__DIR__ . DS . 'stubs' . DS . 'reminders.stub'); return str_replace('password_reminders', $this->getTable(), $stub); }
/** * 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; }
/** * Get stub content by key. * * @param int $key * * @return string */ protected function getStubContent($stubName) { $stubPath = __DIR__ . DS . 'stubs' . DS; $content = $this->files->get($stubPath . $stubName); return $this->formatContent($content); }
/** * Require in all the migration files in a given path. * * @param string $path * @param array $files * @return void */ public function requireFiles($path, array $files) { foreach ($files as $file) { $this->files->requireOnce($path . '/' . $file . '.php'); } }
/** * Execute the console command. * * @return void */ public function fire() { $this->cache->flush(); $this->files->delete($this->nova['config']['app.manifest'] . DS . 'services.json'); $this->info('Application cache cleared!'); }