本文整理汇总了PHP中Illuminate\Filesystem\FilesystemManager::disk方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesystemManager::disk方法的具体用法?PHP FilesystemManager::disk怎么用?PHP FilesystemManager::disk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Filesystem\FilesystemManager
的用法示例。
在下文中一共展示了FilesystemManager::disk方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrl
/**
* {@inheritdoc}
*/
public function getUrl()
{
if (!$this->isPubliclyAccessible()) {
throw MediaUrlException::cloudMediaNotPubliclyAccessible($this->media->disk);
}
return $this->filesystem->disk($this->media->disk)->url($this->media->getDiskPath());
}
示例2: __construct
public function __construct()
{
$this->manager = app('filesystem');
$this->storage_local = $this->manager->disk('local');
$this->storage_cloud = $this->manager->disk(config('filesystems.cloud'));
$this->storage_tmp = $this->manager->disk('tmp');
$this->setStorage();
}
示例3: handle
/**
* Handle the hook.
*
* @param \Docit\Core\Project $project
* @return void
*/
public function handle(Project $project)
{
if (!$project->config('enable_filesystem_hook')) {
$project->setFiles(new LocalFilesystem());
}
$disk = $project->config('default_filesystem_disk');
$settings = $project->config('filesystem_hook_settings');
if (!isset($settings[$disk])) {
return;
}
$files = $this->fsm->disk($disk);
if (isset($files)) {
$project->setFiles($files);
$project->setPath($project->getName());
}
}
示例4: listFiles
/**
* Generate a list of all files in the specified directory.
* @param atring $disk
* @param string $directory
* @param bool $recursive
* @return array
*/
protected function listFiles($disk, $directory = '', $recursive = true)
{
if ($recursive) {
return $this->filesystem->disk($disk)->allFiles($directory);
} else {
return $this->filesystem->disk($disk)->files($directory);
}
}
示例5: move
/**
* Move the file to a new location on disk.
*
* Will invoke the `save()` method on the model after the associated file has been moved to prevent synchronization errors
* @param \Plank\Mediable\Media $media
* @param string $directory directory relative to disk root
* @param string $name filename. Do not include extension
* @return void
* @throws \Plank\Mediable\Exceptions\MediaMoveException If attempting to change the file extension or a file with the same name already exists at the destination
*/
public function move(Media $media, $directory, $filename = null)
{
$storage = $this->filesystem->disk($media->disk);
if ($filename) {
$filename = $this->removeExtensionFromFilename($filename, $media->extension);
} else {
$filename = $media->filename;
}
$directory = trim($directory, '/');
$target_path = $directory . '/' . $filename . '.' . $media->extension;
if ($storage->has($target_path)) {
throw MediaMoveException::destinationExists($target_path);
}
$storage->move($media->getDiskPath(), $target_path);
$media->filename = $filename;
$media->directory = $directory;
$media->save();
}
示例6: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(Config $config, Storage $storage)
{
$conn = $config->get('laravel-db-commands.backup_db_conn');
$db = $config->get("database.connections.{$conn}");
$dump_dest = $config->get('laravel-db-commands.backup_dump_destination');
$backup_disk_name = $config->get('laravel-db-commands.backup_disk');
$backup_disk = $storage->disk($backup_disk_name);
$backup_name = $db['database'] . '-' . time() . '.sql.gz';
$tmp_file = "{$dump_dest}/{$backup_name}";
$this->dumpMysqlDatabase($db, $tmp_file);
$this->uploadDumpToDisk($backup_disk, $backup_name, $tmp_file);
}
示例7: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle(Config $config, Storage $storage)
{
$conn = $config->get('laravel-db-commands.backup_db_conn');
$db = $config->get("database.connections.{$conn}");
$dump_dest = $config->get('laravel-db-commands.backup_dump_destination');
$backup_disk = $config->get('laravel-db-commands.backup_disk');
$db_host = $db['host'];
$db_name = $db['database'];
$db_user = $db['username'];
$db_pass = $db['password'];
$backup_name = $db_name . '-' . time() . '.sql.gz';
$tmp_file = "{$dump_dest}/{$backup_name}";
$this->info("Generating Backup File");
$output = shell_exec("mysqldump -h {$db_host} -u {$db_user} -p{$db_pass} {$db_name} | gzip > {$tmp_file}");
$this->info($output);
$this->info("Uploading database to S3");
$s3 = $storage->disk($backup_disk);
$s3->put($backup_name, file_get_contents($tmp_file));
}
示例8: disk
/**
* Get a filesystem instance.
*
* @param string $name
* @return \Illuminate\Contracts\Filesystem\Filesystem
* @static
*/
public static function disk($name = null)
{
return \Illuminate\Filesystem\FilesystemManager::disk($name);
}
示例9: getDisk
/**
* returns disk filesystem
*
* @param string $name disk name
* @return \Illuminate\Contracts\Filesystem\Filesystem
*/
protected function getDisk($name)
{
return $this->filesystem->disk($name);
}
示例10: delete
/**
* Remover todos os convites.
* @return bool
*/
public function delete()
{
$this->storage->disk()->deleteDirectory('/invites');
return true;
}