本文整理汇总了PHP中Illuminate\Filesystem\Filesystem::makeDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::makeDirectory方法的具体用法?PHP Filesystem::makeDirectory怎么用?PHP Filesystem::makeDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Filesystem\Filesystem
的用法示例。
在下文中一共展示了Filesystem::makeDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createTmpDir
private function createTmpDir($dir)
{
if (!$this->filesystem->exists($dir)) {
$this->filesystem->makeDirectory($dir, 0755, true);
}
return true;
}
示例2: createMissingController
/**
* @param Request $request
* @return mixed
* @throws \Exception
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function createMissingController(Request $request)
{
$namespace = $request->namespace;
$controller = $request->controller;
$module = $request->module;
//Get controllers folder
$controllersDir = $this->getMainControllerPath();
//Get controller path for new controller
$newControllerDir = $this->getControllerPath($namespace, $module);
//Get controller namespace
$controllerNamespace = $this->getMainControllerNamespace();
//Get namespace for the new controller
$newControllerNamespace = $this->getControllerNamespace($namespace, $module);
//Get the file
$file = $this->getFileLocation($namespace, $module, $controller);
$controllerClass = studly_case($controller . 'Controller');
//Check if file exists
$fileExists = $this->fileExists($file);
//Check if is dir
if (!$this->fs->isDirectory($newControllerDir)) {
$this->fs->makeDirectory($newControllerDir, 0755, true, true);
}
//If file doesnt exist, create the file
if (!$fileExists) {
$template = $this->builder->setNamespace($newControllerNamespace)->setTemplate($this->fs->get($this->config['templates']['controller']))->setClassName(studly_case($controllerClass))->setUses(Request::class)->buildController();
//Store the file
$this->fs->put($file, $template);
//Call the created controller
return app($newControllerNamespace . '\\' . $controllerClass)->index();
}
throw new \Exception('File exists! I don\'t want to override it!');
}
示例3: createDirectory
protected function createDirectory()
{
$directory = $this->getDirectory();
if (!$this->files->isDirectory($directory)) {
$this->files->makeDirectory($directory, 0755, true);
}
}
示例4: makeDirectory
/**
* Build the directory for the view if necessary.
*
* @param $path
*/
private function makeDirectory($path)
{
$dir = dirname($path);
if (!$this->files->isDirectory($dir)) {
$this->files->makeDirectory($dir, 0777, true, true);
}
}
示例5: 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;
}
示例6: makeDirectory
protected function makeDirectory($path)
{
if (!($status = $this->files->makeDirectory($path))) {
return $this->files->makeDirectory(dirname($path), 0777, true, true);
}
return $status;
}
示例7: makeDir
/**
* Make directory.
*
* @param string $directory
* @return void
*/
protected function makeDir($directory)
{
if (!$this->files->isDirectory($directory)) {
$this->info('Creating directory ' . $directory);
$this->files->makeDirectory($directory, 0777, true);
}
}
示例8: setUp
public function setUp()
{
$this->loader = new FileLoader($this->files = new Filesystem());
$this->group = md5(time() . uniqid());
$this->namespace = md5(time() . uniqid());
$this->environment = md5(time() . uniqid());
$path = DIR_APPLICATION . '/config/';
$this->loader->addNamespace($this->namespace, $path . $this->namespace);
$paths = array("generated_overrides/{$this->group}.php" => array('non-namespaced' => true, 'override' => true, 'second' => false), "{$this->group}.php" => array('non-namespaced' => true, 'main_group' => true, 'second' => true, 'last' => false), "{$this->environment}.{$this->group}.php" => array('non-namespaced' => true, 'environment' => true, 'last' => true), "generated_overrides/{$this->namespace}/{$this->group}.php" => array('namespaced' => true, 'override' => true, 'second' => false), "{$this->namespace}/{$this->group}.php" => array('namespaced' => true, 'main_group' => true, 'second' => true, 'last' => false), "{$this->namespace}/{$this->environment}.{$this->group}.php" => array('namespaced' => true, 'environment' => true, 'last' => true));
foreach ($paths as $relative_path => $array) {
$split = explode('/', $relative_path);
$current_path = $path;
array_pop($split);
foreach ($split as $directory) {
$dir = "{$current_path}/{$directory}";
if (!$this->files->exists($dir)) {
$this->files->makeDirectory($dir);
$this->to_remove[] = $dir;
}
$current_path = $dir;
}
$this->to_remove[] = $path . $relative_path;
$this->files->put($path . $relative_path, id(new Renderer($array))->render());
}
}
示例9: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$model = ucfirst($this->argument('model'));
$path = $this->option('path');
if (empty($path)) {
$path = database_path(config('smart-seeder.seedDir'));
} else {
$path = base_path($path);
}
$env = $this->option('env');
if (!empty($env)) {
$path .= "/{$env}";
}
if (!$this->files->exists($path)) {
// mode 0755 is based on the default mode Laravel use.
$this->files->makeDirectory($path, 755, true);
}
$created = date('Y_m_d_His');
$path .= "/seed_{$created}_{$model}Seeder.php";
$fs = $this->files->get(__DIR__ . '/stubs/DatabaseSeeder.stub');
$namespace = rtrim($this->getAppNamespace(), '\\');
$stub = str_replace('{{seeder}}', "seed_{$created}_" . $model . 'Seeder', $fs);
$stub = str_replace('{{namespace}}', " namespace {$namespace};", $stub);
$stub = str_replace('{{model}}', $model, $stub);
$this->files->put($path, $stub);
$message = "Seed created for {$model}";
if (!empty($env)) {
$message .= " in environment: {$env}";
}
$this->line($message);
}
示例10: makeDir
/**
* Make directory.
*
* @param string $directory
* @return void
*/
protected function makeDir($directory)
{
if (!$this->files->isDirectory($this->getPath($directory))) {
$this->info('Createing directory ' . $this->getPath($directory));
$this->files->makeDirectory($this->getPath($directory), 0777, true);
}
}
示例11: makeDirectory
/**
* Create the directory for the controller.
*
* @param string $controller
* @param string $path
* @return void
*/
protected function makeDirectory($controller, $path)
{
$directory = $this->getDirectory($controller);
if (!$this->files->isDirectory($full = $path . '/' . $directory)) {
$this->files->makeDirectory($full, 0777, true);
}
}
示例12: makeDir
/**
* Create dir if does not exists !
*
* @param $directory
* @return bool
*/
public function makeDir($directory)
{
if (!$this->filesystem->isDirectory($directory)) {
return $this->filesystem->makeDirectory($directory);
}
return false;
}
示例13: checkCacheDirectory
/**
* Check/Create cache directory
*/
private function checkCacheDirectory()
{
if ($this->cachePath) {
if (!$this->files->isDirectory($this->cachePath)) {
$this->files->makeDirectory($this->cachePath);
}
}
}
示例14: createDirectory
/**
* Create directory for anonymizers.
*
* @param string $dir
*/
protected function createDirectory($dir)
{
if ($this->files->isDirectory($dir)) {
$this->error("Directory {$dir} already exists");
return;
}
$this->files->makeDirectory($dir);
}
示例15: createFolders
/**
* Creates the module directory and other folders.
*/
protected function createFolders()
{
$path = base_path('Modules/' . $this->name);
$this->filesystem->makeDirectory($path);
foreach ($this->foldersToGenerate as $folder) {
$this->filesystem->makeDirectory($path . '/' . $folder);
}
}