本文整理匯總了PHP中Illuminate\Support\Facades\File::copyDirectory方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::copyDirectory方法的具體用法?PHP File::copyDirectory怎麽用?PHP File::copyDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\File
的用法示例。
在下文中一共展示了File::copyDirectory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
try {
$sourceDir = __DIR__ . "/../testing";
$destinationDir = "config/testing";
$testcase_main = "tests/TestCase.php";
if (File::exists($testcase_main)) {
$get_contents = __DIR__ . "/../BaseTestcase/Testcase.php";
if (File::exists($get_contents)) {
$success = File::copyDirectory($sourceDir, $destinationDir);
file_put_contents($testcase_main, file_get_contents($get_contents));
if ($success) {
$this->info("Testing directory for local database( Temporary Storage ) is successfully created");
} else {
$this->error("There was an error in creating local testing folder");
}
} else {
$this->error("No file in package directory");
}
} else {
$this->error("No file in tests directory");
}
} catch (\Exception $e) {
die("The base file doesn't exist");
}
}
示例2: fire
public function fire()
{
$name = strtolower($this->argument('name'));
$stubs = __DIR__ . '/stubs/view';
$path = base_path('resources/themes/gokyuzu/views/admin/' . $name);
File::copyDirectory($stubs, $path);
}
示例3: publishViews
/**
* Publish the views
*/
protected function publishViews()
{
$views = dirname(__FILE__) . '/../Views';
$location = base_path('resources/views/vendor/vault');
//Publishes the views to the resources path, since laravel checks for both, this lets the user alter them
return File::copyDirectory($views, $location);
}
示例4: fire
/**
* Execute the console command.
*
* @access public
* @return mixed
*/
public function fire()
{
$source = realpath(__DIR__ . '/../views');
$destination = app_path('views/bauhaus');
File::copyDirectory($source, $destination);
$this->info(sprintf('Views exported to `%s`', $destination));
}
示例5: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// Start the progress bar
$bar = $this->helper->barSetup($this->output->createProgressBar(7));
$bar->start();
// Common variables
$vendor = strtolower($this->argument('vendor'));
$name = strtolower($this->argument('name'));
$path = getcwd() . '/packages/';
$fullPath = $path . $vendor . '/' . $name;
$cVendor = studly_case($vendor);
$cName = studly_case($name);
$requirement = '"psr-4": {
"' . $cVendor . '\\\\' . $cName . '\\\\": "packages/' . $vendor . '/' . $name . '/src",';
$appConfigLine = 'App\\Providers\\RouteServiceProvider::class,
' . $cVendor . '\\' . $cName . '\\' . 'ServiceProvider::class,';
// Start creating the package
$this->info('Creating package ' . $vendor . '\\' . $name . '...');
if (!$this->option('force')) {
$this->helper->checkExistingPackage($path, $vendor, $name);
}
$bar->advance();
// Create the package directory
$this->info('Creating packages directory...');
$this->helper->makeDir($path);
$bar->advance();
// Create the vendor directory
$this->info('Creating vendor...');
$this->helper->makeDir($path . $vendor);
$bar->advance();
// Copying package skeleton
$this->info('Copying package skeleton...');
File::copyDirectory(__DIR__ . '/../skeleton', $fullPath);
foreach (File::allFiles($fullPath) as $file) {
$search = [':vendor_name', ':VendorName', ':package_name', ':PackageName'];
$replace = [$vendor, $cVendor, $name, $cName];
$newfile = substr($file, 0, -5);
$this->helper->replaceAndSave($file, $search, $replace, $newfile, $deleteOldFile = true);
}
$bar->advance();
// Add it to composer.json
$this->info('Adding package to composer and app...');
$this->helper->replaceAndSave(getcwd() . '/composer.json', '"psr-4": {', $requirement);
//And add it to the providers array in config/app.php
$this->helper->replaceAndSave(getcwd() . '/config/app.php', 'App\\Providers\\RouteServiceProvider::class,', $appConfigLine);
$bar->advance();
// Finished creating the package, end of the progress bar
$bar->finish();
$this->info('Package created successfully!');
$this->output->newLine(2);
$bar = null;
}
示例6: handle
public function handle()
{
if (($table = $this->option('table')) === null) {
$tables = $this->DBHelper->listTables();
$table = $this->choice('Choose table:', $tables, null);
}
$columns = collect($this->DBHelper->listColumns($table));
$this->transformer->setColumns($columns);
$namespace = config('thunderclap.namespace');
$moduleName = str_replace('_', '', title_case($table));
$containerPath = config('thunderclap.target_dir', base_path('modules'));
$modulePath = $containerPath . DIRECTORY_SEPARATOR . $moduleName;
// 1. check existing module
if (is_dir($modulePath)) {
$overwrite = $this->confirm("Folder {$modulePath} already exist, do you want to overwrite it?");
if ($overwrite) {
File::deleteDirectory($modulePath);
} else {
return false;
}
}
// 2. create modules directory
$this->info('Creating modules directory...');
$this->packerHelper->makeDir($containerPath);
$this->packerHelper->makeDir($modulePath);
// 3. copy module skeleton
$stubs = __DIR__ . '/../../stubs';
$this->info('Copying module skeleton into ' . $modulePath);
File::copyDirectory($stubs, $modulePath);
$templates = ['module-name' => str_replace('_', '-', $table), 'route-prefix' => config('thunderclap.routes.prefix')];
// 4. rename file and replace common string
$search = [':Namespace:', ':module_name:', ':module-name:', ':module name:', ':Module Name:', ':moduleName:', ':ModuleName:', ':FILLABLE:', ':TRANSFORMER_FIELDS:', ':VALIDATION_RULES:', ':LANG_FIELDS:', ':TABLE_HEADERS:', ':TABLE_FIELDS:', ':DETAIL_FIELDS:', ':FORM_CREATE_FIELDS:', ':FORM_EDIT_FIELDS:', ':VIEW_EXTENDS:', ':route-prefix:', ':route-middleware:', ':route-url-prefix:'];
$replace = [$namespace, snake_case($table), $templates['module-name'], str_replace('_', ' ', strtolower($table)), ucwords(str_replace('_', ' ', $table)), str_replace('_', '', camel_case($table)), str_replace('_', '', title_case($table)), $this->transformer->toFillableFields(), $this->transformer->toTransformerFields(), $this->transformer->toValidationRules(), $this->transformer->toLangFields(), $this->transformer->toTableHeaders(), $this->transformer->toTableFields(), $this->transformer->toDetailFields(), $this->transformer->toFormCreateFields(), $this->transformer->toFormUpdateFields(), config('thunderclap.view.extends'), $templates['route-prefix'], $this->toArrayElement(config('thunderclap.routes.middleware')), $this->getRouteUrlPrefix($templates['route-prefix'], $templates['module-name'])];
foreach (File::allFiles($modulePath) as $file) {
if (is_file($file)) {
$newFile = $deleteOriginal = false;
if (Str::endsWith($file, '.stub')) {
$newFile = Str::substr($file, 0, -5);
$deleteOriginal = true;
}
$this->packerHelper->replaceAndSave($file, $search, $replace, $newFile, $deleteOriginal);
}
}
$this->warn('Add following service provider to config/app.php ====> ' . $namespace . '\\' . ucwords(str_replace('_', ' ', $table)) . '\\ServiceProvider::class,');
}
示例7: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->info('Hello Migration.');
$packages = config('build.universe.packages');
if (count($packages) == 0) {
$this->error('No packages found in unverse config.');
return;
}
$paths = ServiceProvider::pathsToPublish();
foreach ($paths as $sourceDir => $destinationDir) {
if (substr($destinationDir, -10) == 'migrations') {
if (File::copyDirectory($sourceDir, $destinationDir)) {
$this->info("copied {$sourceDir}");
}
}
}
$this->info('Done.');
}
示例8: fire
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$from = $this->argument('from_locale');
$to = $this->argument('to_locale');
$Lari18n = Lari18n::getInstance();
$data = $Lari18n->retrieveI18nData();
$languages = $data['languages'];
$languagesPath = $data['paths']['lang'];
// check
if (!in_array($from, $languages)) {
$this->error('There is no locale [' . $from . ']');
}
if (in_array($to, $languages)) {
$this->error('The [' . $to . '] locale already exist');
}
// Create the new language directory
File::copyDirectory($languagesPath . '/' . $from, $languagesPath . '/' . $to);
$files = File::allFiles($languagesPath . '/' . $to);
$Lari18n->reinitialiseFiles($files, $to);
$this->info('The [' . $to . '] translation directory as been created from [' . $from . '] translations files');
}
示例9: fire
public static function fire(SetupCommand $setupCommand)
{
$run = new self();
File::copyDirectory(__DIR__ . '/../deployment', base_path() . '/deployment');
$setupCommand->info("Deployment folder made");
}
示例10: generateAssetsDirectory
/**
* Generates the assets directory
* by copying the files from the template directory to a public diretory
*
* @param string $content
* @return void
*/
private function generateAssetsDirectory()
{
$destinationPath = public_path() . '/assets/docs/' . $this->dotPrefix;
// create assets directory
File::makeDirectory($destinationPath, $mode = 0777, true, true);
$targetPath = Config::get('apidocs.assets_path');
$directories = ['css', 'img', 'js'];
foreach ($directories as $directory) {
$target = $targetPath . '/' . $directory;
$dest = $destinationPath . '/' . $directory;
File::copyDirectory($target, $dest);
}
}
示例11: installFrontend
protected function installFrontend()
{
File::copyDirectory($this->stubs('app/Http/Controllers/Frontend'), app_path('Http/Controllers/Frontend'));
File::copyDirectory($this->stubs('resources/views/frontend'), base_path('resources/views/frontend'));
}
示例12: setupFolder
protected function setupFolder(SetupCommand $setupCommand)
{
File::copyDirectory(__DIR__ . '/../server_config', base_path() . '/server_config');
$setupCommand->info("Server Config /server_config folder made");
}
示例13: setUpVue
/**
* Configure Vue.
*
* @return void
*/
protected function setUpVue()
{
$this->describeMethod('Setup Vue');
File::copyDirectory("{$this->packagePath}/vue/components", "{$this->vuePath}/components");
$this->reportStep('copy vue files to app', 'SUCCESS');
$report = VueAssembler::web()->addComponent('navbar', './components/NavbarComponent.vue');
$report = VueAssembler::web()->addComponent('flash-alert', './components/FlashAlert.vue');
$this->reportStep('require NavbarComponent in web.js', $report);
}
示例14: copyModelStubs
/**
* Copy all model files from the stub
*
* @return void
*/
protected function copyModelStubs()
{
File::copyDirectory($this->getStubsFolder() . '/models', $this->getModelDestinationFolder());
$this->reportStep('copy all model stubs', 'SUCCESS');
}
示例15: copyLessFolders
/**
* Copy Less folders
*/
protected function copyLessFolders()
{
foreach ($this->lessSources as $source => $destination) {
$this->line('<info>LESS:</info> ' . base_path($destination));
File::copyDirectory(base_path($source), base_path($destination));
}
}