本文整理匯總了PHP中Illuminate\Support\Facades\File::copy方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::copy方法的具體用法?PHP File::copy怎麽用?PHP File::copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\File
的用法示例。
在下文中一共展示了File::copy方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fire
public function fire()
{
$stubs = __DIR__ . '/stubs/lang.stub';
$name = strtolower($this->argument('name'));
$path = base_path('resources/lang/tr/admin/' . $name . '.php');
File::copy($stubs, $path);
}
示例2: download
public function download($id)
{
$file = File::findOrFail($id);
$pathToFile = 'get_link_to_download/' . md5($file->name . time());
FileHelpers::copy(storage_path('app') . '/' . $file->local_name, $pathToFile);
return response()->download($pathToFile, $file->name, ['Content-Type'])->deleteFileAfterSend(true);
}
示例3: testPublishedSeeds
/**
* Publish seeds for testing
*/
public function testPublishedSeeds()
{
$source = __DIR__ . '/../src/Database/seeds/CountriesTableSeeder.php';
$destination = database_path('seeds/CountriesTableSeeder.php');
File::copy($source, $destination);
$success = File::exists($destination);
$this->assertTrue($success);
}
示例4: performConversion
/**
* Perform the conversion.
*
* @param \Spatie\MediaLibrary\Media $media
* @param Conversion $conversion
* @param string $copiedOriginalFile
*
* @return string
*/
public function performConversion(Media $media, Conversion $conversion, string $copiedOriginalFile)
{
$conversionTempFile = pathinfo($copiedOriginalFile, PATHINFO_DIRNAME) . '/' . string()->random(16) . $conversion->getName() . '.' . $media->extension;
File::copy($copiedOriginalFile, $conversionTempFile);
foreach ($conversion->getManipulations() as $manipulation) {
GlideImage::create($conversionTempFile)->modify($manipulation)->save($conversionTempFile);
}
return $conversionTempFile;
}
示例5: performConversion
/**
* Perform the conversion.
*
* @param \Spatie\MediaLibrary\Media $media
* @param Conversion $conversion
* @param string $copiedOriginalFile
*
* @return string
*/
public function performConversion(Media $media, Conversion $conversion, $copiedOriginalFile)
{
$conversionTempFile = pathinfo($copiedOriginalFile, PATHINFO_DIRNAME) . '/' . string()->random(16) . $conversion->getName() . '.' . $media->extension;
File::copy($copiedOriginalFile, $conversionTempFile);
foreach ($conversion->getManipulations() as $manipulation) {
(new GlideImage())->load($conversionTempFile, $manipulation)->useAbsoluteSourceFilePath()->save($conversionTempFile);
}
return $conversionTempFile;
}
示例6: setupBower
protected function setupBower(SetupCommand $setupCommand)
{
File::copy(base_path() . '/deployment/stubs/.bowerrc', base_path() . '/.bowerrc');
File::copy(base_path() . '/deployment/stubs/bower.json', base_path() . '/bower.json');
File::copy(base_path() . '/deployment/stubs/package.json', base_path() . '/package.json');
$setupCommand->info("Added bower and bower.json.");
exec('npm install');
exec('bower install');
}
示例7: store
/**
* Store the compiled stub.
*
* @param $modelName
* @param \stdClass $scaffolderConfig
* @param $compiled
* @param \Scaffolder\Support\FileToCompile $fileToCompile
*
* @return string
*/
protected function store($modelName, stdClass $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
{
$path = PathParser::parse($scaffolderConfig->paths->migrations) . $this->date->format('Y_m_d_His') . '_create_' . strtolower($modelName) . 's_table.php';
// Store in cache
if ($fileToCompile->cached) {
File::copy(base_path('scaffolder-config/cache/migration_' . $fileToCompile->hash . self::CACHE_EXT), $path);
} else {
File::put(base_path('scaffolder-config/cache/migration_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
File::copy(base_path('scaffolder-config/cache/migration_' . $fileToCompile->hash . self::CACHE_EXT), $path);
}
return $path;
}
示例8: _saveModel
protected function _saveModel($model, $filename)
{
$fullDestinationPath = $model->getFullPathToFolder();
$imageSize = @getimagesize($fullDestinationPath . '/' . $filename);
if (is_array($imageSize)) {
File::copy($fullDestinationPath . '/' . $filename, $fullDestinationPath . '/original_' . $filename);
$size = array('width' => $imageSize[0], 'height' => $imageSize[1]);
$model->size = $size;
$model->origin_size = $size;
}
$model->uploader_id = Auth::user()->id;
}
示例9: store
/**
* Store the compiled stub.
*
* @param $modelName
* @param $scaffolderConfig
* @param $compiled
* @param FileToCompile $fileToCompile
*
* @return string
*/
protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
{
$path = PathParser::parse($scaffolderConfig->paths->models) . $modelName . '.php';
// Store in cache
if ($fileToCompile->cached) {
File::copy(base_path('scaffolder-config/cache/model_' . $fileToCompile->hash . self::CACHE_EXT), $path);
} else {
File::put(base_path('scaffolder-config/cache/model_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
File::copy(base_path('scaffolder-config/cache/model_' . $fileToCompile->hash . self::CACHE_EXT), $path);
}
return $path;
}
示例10: copy_zip
private function copy_zip()
{
$src = $this->zip_path . '.zip';
$dst = config('tools.package_path') . $this->fontname . '/src/resources/assets/font/fontello.zip';
if (File::exists(config('tools.package_path') . $this->fontname)) {
if (File::copy($src, $dst)) {
$this->info("copied: {$src} => {$dst}.");
} else {
$this->info("failed: {$src} => {$dst}.");
}
}
}
示例11: store
/**
* Store the compiled stub.
*
* @param $modelName
* @param $scaffolderConfig
* @param $compiled
* @param FileToCompile $fileToCompile
*
* @return string
*/
protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
{
$path = PathParser::parse($scaffolderConfig->paths->views) . strtolower($modelName) . '/create.blade.php';
// Store in cache
if ($fileToCompile->cached) {
File::copy(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $path);
} else {
File::put(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
File::copy(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $path);
}
return $path;
}
示例12: store
/**
* Store the compiled stub.
*
* @param $modelName
* @param \stdClass $scaffolderConfig
* @param $compiled
* @param \Scaffolder\Support\FileToCompile $fileToCompile
*
* @return string
*/
protected function store($modelName, stdClass $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
{
$path = base_path('../' . strtolower(str_replace(' ', '-', $scaffolderConfig->name . '-api'))) . '/app/Models/' . $modelName . '.php';
// Store in cache
if ($fileToCompile->cached) {
File::copy(base_path('scaffolder-config/cache/api_model_' . $fileToCompile->hash . self::CACHE_EXT), $path);
} else {
File::put(base_path('scaffolder-config/cache/api_model_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
File::copy(base_path('scaffolder-config/cache/api_model_' . $fileToCompile->hash . self::CACHE_EXT), $path);
}
return $path;
}
示例13: setUpStyle
/**
* Configure Style.
*
* @return void
*/
protected function setUpStyle()
{
$this->describeMethod('Setup Stylus');
File::copyDirectory("{$this->packagePath}/stylus/vars", "{$this->stylePath}/basecamp/vars");
$this->reportStep('copy basecamp-design lib-files', 'SUCCESS');
File::copy("{$this->packagePath}/stylus/design.styl", "{$this->stylePath}/basecamp/design.styl");
$this->reportStep('copy design.styl template', 'SUCCESS');
$assemblerFile = $this->stylePath . '/basecamp/design.styl';
$report = FileModifier::open($assemblerFile)->replace("framework : './'", "framework : '../../../../vendor/patrikkernke/basecamp-design/src/stylus/'")->save();
$this->reportStep('change relative path and point to composer package in design.styl', $report);
$report = StyleAssembler::web()->addLibrary('basecamp/design');
$this->reportStep("require basecamp/design in web.styl", $report);
}
示例14: storeCustomRecord
public function storeCustomRecord($parameters)
{
if ($this->request->hasFile('attachment')) {
$filename = Miscellaneous::uploadFiles('attachment', public_path() . '/packages/syscover/octopus/storage/attachment/request');
} elseif ($this->request->has('attachment')) {
File::copy(public_path() . '/packages/syscover/octopus/storage/attachment/stock/' . $this->request->input('attachment'), public_path() . '/packages/syscover/octopus/storage/attachment/request/' . $this->request->input('attachment'));
$filename = $this->request->input('attachment');
}
$octopusRequest = OctopusRequest::create(['supervisor_id_078' => $this->request->input('supervisor'), 'customer_id_078' => $this->request->input('customer'), 'shop_id_078' => $this->request->input('shopId'), 'company_id_078' => $this->request->input('company'), 'family_id_078' => $this->request->input('family'), 'brand_id_078' => $this->request->input('brand'), 'product_id_078' => $this->request->input('product'), 'address_id_078' => $this->request->has('aliasId') ? $this->request->input('aliasId') : null, 'company_name_078' => $this->request->has('companyName') ? $this->request->input('companyName') : null, 'name_078' => $this->request->has('name') ? $this->request->input('name') : null, 'surname_078' => $this->request->has('surname') ? $this->request->input('surname') : null, 'country_id_078' => $this->request->input('country'), 'territorial_area_1_id_078' => $this->request->has('territorialArea1') ? $this->request->input('territorialArea1') : null, 'territorial_area_2_id_078' => $this->request->has('territorialArea2') ? $this->request->input('territorialArea2') : null, 'territorial_area_3_id_078' => $this->request->has('territorialArea3') ? $this->request->input('territorialArea3') : null, 'cp_078' => $this->request->has('cp') ? $this->request->input('cp') : null, 'locality_078' => $this->request->has('locality') ? $this->request->input('locality') : null, 'address_078' => $this->request->has('address') ? $this->request->input('address') : null, 'phone_078' => $this->request->has('phone') ? $this->request->input('phone') : null, 'email_078' => $this->request->has('email') ? $this->request->input('email') : null, 'observations_078' => $this->request->has('observations') ? $this->request->input('observations') : null, 'date_078' => \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('date'))->getTimestamp(), 'date_text_078' => $this->request->input('date'), 'view_width_078' => $this->request->input('viewWidth'), 'view_height_078' => $this->request->input('viewHeight'), 'total_width_078' => $this->request->has('totalWidth') ? $this->request->input('totalWidth') : null, 'total_height_078' => $this->request->has('totalHeight') ? $this->request->input('totalHeight') : null, 'units_078' => $this->request->input('units'), 'expiration_078' => $this->request->has('expiration') ? \DateTime::createFromFormat(config('pulsar.datePattern'), $this->request->input('expiration'))->getTimestamp() : null, 'expiration_text_078' => $this->request->has('expiration') ? $this->request->input('expiration') : null, 'attachment_078' => isset($filename) ? $filename : null, 'comments_078' => $this->request->has('comments') ? $this->request->input('comments') : null]);
// si la peticion proviene de un stock, damos por expirado el stock duplicado
if ($this->request->has('stock')) {
Stock::where('id_080', $this->request->input('stock'))->update(['expiration_080' => date('U'), 'expiration_text_080' => date(config('pulsar.datePattern'))]);
}
$this->sendRequestEmail($octopusRequest->id_078, 'store');
}
示例15: setupDB
protected function setupDB(SetupCommand $setupCommand)
{
if (File::exists(base_path() . '/database/stubdb.sqlite')) {
File::delete(base_path() . '/database/stubdb.sqlite');
}
File::put(base_path() . '/database/stubdb.sqlite', '');
if (File::exists(base_path() . '/database/testing.sqlite')) {
File::delete(base_path() . '/database/testing.sqlite');
}
/**
* @TODO Replace this with artisan command
*/
$command = "sh " . base_path() . '/deployment/migrate_testing.sh';
exec($command);
File::copy(base_path() . '/database/stubdb.sqlite', base_path() . '/database/testing.sqlite');
$setupCommand->info("Testing db info added");
}