本文整理汇总了PHP中Illuminate\Filesystem\Filesystem::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::delete方法的具体用法?PHP Filesystem::delete怎么用?PHP Filesystem::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Filesystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* @param \Exolnet\Image\Imageable $image
* @return bool
*/
public function destroy(Imageable $image)
{
if ($this->filesystem->exists($image->getImagePath())) {
return $this->filesystem->delete($image->getImagePath());
}
return true;
}
示例2: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
foreach ($this->files->files(storage_path() . '/views') as $file) {
$this->files->delete($file);
}
$this->info('Views deleted from cache');
}
示例3: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->cache->flush();
$this->files->delete($this->laravel['config']['app.manifest'] . '/services.json');
$this->laravel['events']->fire('cache:cleared');
$this->info('Application cache cleared!');
}
示例4: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
foreach ($this->files->files(storage_path() . '/framework/sessions') as $file) {
$this->files->delete($file);
}
$this->info('Session files deleted from storage');
}
示例5: removeFiles
/**
* @param string $dir
*/
protected function removeFiles($dir)
{
$files = $this->filesystem->glob($dir . '/*');
foreach ($files as $file) {
$this->filesystem->delete($file);
}
}
示例6: gc
/**
* {@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());
}
}
示例7: save
public function save($item, $value, $environment, $group, $namespace = null)
{
$path = DIR_APPLICATION . '/config/generated_overrides';
if (!$this->files->exists($path)) {
$this->files->makeDirectory($path, 0777);
} elseif (!$this->files->isDirectory($path)) {
$this->files->delete($path);
$this->files->makeDirectory($path, 0777);
}
if ($namespace) {
$path = "{$path}/{$namespace}";
if (!$this->files->exists($path)) {
$this->files->makeDirectory($path, 0777);
} elseif (!$this->files->isDirectory($path)) {
$this->files->delete($path);
$this->files->makeDirectory($path, 0777);
}
}
$file = "{$path}/{$group}.php";
$current = array();
if ($this->files->exists($file)) {
$current = $this->files->getRequire($file);
}
array_set($current, $item, $value);
$renderer = new Renderer($current);
return $this->files->put($file, $renderer->render()) !== false;
}
示例8: it_should_create_a_file
/** @test */
public function it_should_create_a_file()
{
if ($this->finder->isFile("{$this->mediaPath}google-map_smallThumb.png")) {
$this->finder->delete("{$this->mediaPath}google-map_smallThumb.png");
}
$this->imagy->get("/google-map.png", 'smallThumb', true);
$this->assertTrue($this->finder->isFile("{$this->testbenchPublicPath}google-map_smallThumb.png"));
}
示例9: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$views = $this->files->glob($this->laravel['config']['view.compiled'] . '/*');
foreach ($views as $view) {
$this->files->delete($view);
}
$this->info('Compiled views cleared!');
}
示例10: handle
/**
* Execute the console command.
*
* @return void
*/
public function handle()
{
$files = new Filesystem();
$files->deleteDirectory(app_path('Http/Controllers/Auth'));
$files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php'));
$files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php'));
$this->info('Original Auth removed! Enjoy your fresh start.');
}
示例11: deleteFilesOlderThanMinutes
/**
* @param int $minutes
*
* @return \Illuminate\Support\Collection
*/
public function deleteFilesOlderThanMinutes(int $minutes) : Collection
{
$timeInPast = Carbon::now()->subMinutes($minutes);
return collect($this->filesystem->files($this->directory))->filter(function ($file) use($timeInPast) {
return Carbon::createFromTimestamp(filemtime($file))->lt($timeInPast);
})->each(function ($file) {
$this->filesystem->delete($file);
});
}
示例12: testSave
public function testSave()
{
$group = md5(uniqid());
$item = 'test.item';
$key = "{$group}.{$item}";
$this->repository->save($key, $group);
$this->assertEquals($group, $this->repository->get($key, false));
$this->files->delete(DIR_APPLICATION . "/config/generated_overrides/{$group}.php");
}
示例13: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->info("Starting to clear cache...");
if ($this->files->exists($path = EloquentCacheCommand::getCachedEloquentPath())) {
$this->files->delete($path);
$this->info("Cache cleared.");
} else {
$this->comment("No cache to clear.");
}
}
示例14: handle
/**
* Handle the command.
*
* @param GenerateEntryModel $command
*/
public function handle(GenerateEntryModel $command)
{
$stream = $command->getStream();
$data = $this->getTemplateData($stream);
$template = file_get_contents(__DIR__ . '/../../../resources/stubs/models/entry.stub');
$file = $this->getFilePath($stream);
$this->files->makeDirectory(dirname($file), 0777, true, true);
$this->files->delete($file);
$this->files->put($file, $this->parser->parse($template, $data));
}
示例15: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
if (!$this->confirmToProceed()) {
return;
}
$files = new Filesystem();
$files->deleteDirectory(app_path('Http/Controllers/Auth'));
$files->delete(base_path('database/migrations/2014_10_12_000000_create_users_table.php'));
$files->delete(base_path('database/migrations/2014_10_12_100000_create_password_resets_table.php'));
$this->info('Auth removed! Enjoy your fresh start.');
}