当前位置: 首页>>代码示例>>PHP>>正文


PHP Filesystem::put方法代码示例

本文整理汇总了PHP中Illuminate\Filesystem\Filesystem::put方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::put方法的具体用法?PHP Filesystem::put怎么用?PHP Filesystem::put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Filesystem\Filesystem的用法示例。


在下文中一共展示了Filesystem::put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 /**
  * Execute the console command.
  */
 public function fire()
 {
     $fullPath = $this->createBaseMigration();
     $this->files->put($fullPath, $this->files->get(__DIR__ . '/stubs/database.stub'));
     $this->info('Migration created successfully!  Don\'t forget to run "artisan migrate".');
     $this->composer->dumpAutoloads();
 }
开发者ID:kevin416,项目名称:admin,代码行数:10,代码来源:TaggableTableCommand.php

示例2: get

 public function get($path, array $data = array())
 {
     $filename = $this->files->name($path) . '.' . $this->files->extension($path);
     $compile_path = \Config::get('view.compiled') . DIRECTORY_SEPARATOR . $filename;
     $template_last_modified = $this->files->lastModified($path);
     $cache_last_modified = $this->files->isFile($compile_path) ? $this->files->lastModified($compile_path) : $template_last_modified;
     $view = $this->files->get($path);
     $app = app();
     // $m = new Mustache_Engine($app['config']->get('handlelars'));
     // Configuration
     $cache_disabled = false;
     $helpers = \Config::get('handlelars.helpers');
     // Precompile templates to view cache when necessary
     $compile = $template_last_modified >= $cache_last_modified || $cache_disabled;
     if ($compile) {
         $tpl = LightnCandy::compile($view, compact('helpers'));
         $this->files->put($compile_path, $tpl);
     }
     if (isset($data['__context']) && is_object($data['__context'])) {
         $data = $data['__context'];
     } else {
         $data = array_map(function ($item) {
             return is_object($item) && method_exists($item, 'toArray') ? $item->toArray() : $item;
         }, $data);
     }
     $renderer = $this->files->getRequire($compile_path);
     return $renderer($data);
 }
开发者ID:truemedia,项目名称:handlelars,代码行数:28,代码来源:MustacheEngine.php

示例3: 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());
     }
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:25,代码来源:FileLoaderTest.php

示例4: write

 /**
  * @param $name
  * @param $username
  * @param $password
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function write($name, $username, $password, $host)
 {
     $environmentFile = $this->finder->get($this->file);
     $replace = ["DB_HOST={$host}", "DB_PORT=3306", "DB_DATABASE={$name}", "DB_USERNAME={$username}", "DB_PASSWORD={$password}"];
     $newEnvironmentFile = str_replace($this->search, $replace, $environmentFile);
     $this->finder->put($this->file, $newEnvironmentFile);
 }
开发者ID:ahuggins,项目名称:utilities,代码行数:13,代码来源:EnvWriter.php

示例5: generate

 /**
  * @param $path
  * @param array $data
  */
 public function generate($path, array $data)
 {
     $this->setupDirectory($path);
     $html = $this->renderReport(['analyzedPath' => $data['path'], 'analysis' => $data['result']]);
     // Write report html to the file
     $this->filesystem->put($path . '/index.html', $html);
 }
开发者ID:kabirbaidhya,项目名称:Inspector,代码行数:11,代码来源:ReportGenerator.php

示例6: logInfo

 /**
  * write log
  * @param  string $logContent [logContent]
  * @param  string $logDirPath [filepath]
  */
 public function logInfo($logContent, $logDirPath)
 {
     $filesystem = new Filesystem();
     if (!$logContent || !$logDirPath) {
         return false;
     }
     if ($this->getMailLog()) {
         // log file all path
         $logPath = $logDirPath . $this->getLogName();
         if ($filesystem->exists($logPath)) {
             // everyDay new a file
             $content = $filesystem->get($logPath);
             if ($logTime = substr($content, 1, 10)) {
                 if (Carbon::now($this->local)->toDateString() == $logTime) {
                     $filesystem->append($logPath, $logContent . PHP_EOL);
                 } else {
                     $new_log_path = $logDirPath . $logTime . $this->getLogName();
                     if (!$filesystem->exists($new_log_path)) {
                         $filesystem->move($logPath, $new_log_path);
                     }
                     $filesystem->put($logPath, $logContent);
                 }
             }
         } else {
             $filesystem->put($logPath, $logContent);
         }
     }
 }
开发者ID:mrvokia,项目名称:mailhub,代码行数:33,代码来源:MailHubLogTrait.php

示例7: 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);
 }
开发者ID:mtahv3,项目名称:SmartSeeder,代码行数:36,代码来源:SeedMakeCommand.php

示例8: create

 /**
  * Create a new migration at the given path.
  *
  * @param  string $name
  * @param  string $path
  * @param $migrations
  * @return string
  */
 public function create($name, $path, $migrations)
 {
     $path = $this->getPath($name, $path);
     $ups = [];
     $downs = [];
     if (isset($migrations['create'])) {
         foreach ($migrations['create'] as $table => $data) {
             $ups[] = $this->populateStub('create', ['table' => $table, 'columns' => $this->format($data['cols'])]);
             $downs[] = $this->populateStub('drop', ['table' => $table]);
         }
     }
     if (isset($migrations['update'])) {
         foreach ($migrations['update'] as $table => $data) {
             $ups[] = $this->populateStub('update', ['table' => $table, 'columns' => isset($data['cols']) ? $this->format($data['cols']) : null, 'foreign_keys' => isset($data['fks']) ? $this->format($data['fks']) : null]);
             $downs[] = $this->populateStub('down', ['table' => $table, 'columns' => isset($data['cols']) ? $this->format($this->drop(array_keys($data['cols']), 'Column')) : null, 'foreign_keys' => isset($data['fks']) ? $this->format($this->drop(array_keys($data['fks']), 'Foreign')) : null]);
         }
     }
     $ups = array_filter($ups, 'strlen');
     $downs = array_filter($downs, 'strlen');
     if ($ups) {
         $this->files->put($path, $this->populateStub('blank', ['class' => studly_case($name), 'up' => $this->format($ups, ''), 'down' => $this->format(array_reverse($downs), '')]));
         return $path;
     }
     return false;
 }
开发者ID:master0mind,项目名称:Lavender,代码行数:33,代码来源:Creator.php

示例9: makeViews

 /**
  * Generate a fully fleshed out controller, if the user wishes.
  */
 public function makeViews()
 {
     $valid = false;
     $indexPath = $this->getPath($this->getClassName(), 'index');
     $this->makeDirectory($indexPath);
     $createPath = $this->getPath($this->getClassName(), 'create');
     $this->makeDirectory($createPath);
     $editPath = $this->getPath($this->getClassName(), 'edit');
     $this->makeDirectory($editPath);
     if (!$this->files->exists($indexPath)) {
         if ($this->files->put($indexPath, $this->compileViewStub('index'))) {
             $valid = true;
         }
     }
     if (!$this->files->exists($createPath)) {
         if ($this->files->put($createPath, $this->compileViewStub('create'))) {
             $valid = true;
         }
     }
     if (!$this->files->exists($editPath)) {
         if ($this->files->put($editPath, $this->compileViewStub('edit'))) {
             $valid = true;
         }
     }
     $masterPath = base_path() . '/resources/views/master.blade.php';
     $stub = $this->files->get(__DIR__ . '/../stubs/views/master.stub');
     if (!$this->files->exists($masterPath)) {
         if ($this->files->put($masterPath, $this->compileViewStub('master'))) {
             $valid = true;
         }
     }
     return $valid;
 }
开发者ID:ericcallan,项目名称:Laravel-5-Generators-Extended,代码行数:36,代码来源:ViewService.php

示例10: create

 /**
  * Create a new migration at the given path.
  *
  * @param  string  $class
  * @param  string  $table
  * @param  bool    $create
  * @return string
  */
 public function create($class, $table = null, $create = false)
 {
     $stub = $this->getStub($table, $create);
     $this->files->put($this->getPath($class), $this->populateStub($class, $stub, $table));
     $this->firePostCreateHooks();
     return $class;
 }
开发者ID:artesaos,项目名称:migrator,代码行数:15,代码来源:MigrationCreator.php

示例11: 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!');
 }
开发者ID:donny5300,项目名称:modulair-router,代码行数:38,代码来源:ControllerNotFoundExceptionController.php

示例12: exportToFile

 /**
  * @param $form
  * @param bool $file_name
  * @param array $date_range
  * @return string
  */
 public function exportToFile($form, $file_name = false, $date_range = [], $update_download_id = false)
 {
     $this->initialiseExport($form, $file_name, $date_range);
     $this->buildCsv($update_download_id);
     $this->filesystem->put($this->generateFileName(), $this->csv->__toString());
     return $this->generateFileName();
 }
开发者ID:coandacms,项目名称:coanda-web-forms,代码行数:13,代码来源:CsvExporter.php

示例13: 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;
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:27,代码来源:FileSaver.php

示例14: reset

 /**
  * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
  */
 public function reset()
 {
     Dotenv::makeMutable();
     $templateFile = $this->finder->get($this->template);
     $this->finder->put($this->file, $templateFile);
     Dotenv::makeImmutable();
 }
开发者ID:SocietyCMS,项目名称:Core,代码行数:10,代码来源:EnvFileWriter.php

示例15: fire

 /**
  * 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');
 }
开发者ID:ramal-ratne,项目名称:Laravel-5-MultiAuth,代码行数:12,代码来源:RemindersTableCommand.php


注:本文中的Illuminate\Filesystem\Filesystem::put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。