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


PHP Storage::put方法代码示例

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


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

示例1: create

 public function create(array $data)
 {
     try {
         $this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
         $projectFile = $this->repository->skipPresenter()->create($data);
         $this->storage->put($projectFile->getFileName(), $this->filesystem->get($data['file']));
         return ['success' => true];
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag(), "messageDev" => 'ValidatorException'];
     } catch (\Exception $e) {
         return ["error" => true, "message" => 'Falha ao gravar registro.', "messageDev" => $e->getMessage()];
     }
 }
开发者ID:jonasleitep4,项目名称:curso-laravel-angular,代码行数:13,代码来源:ProjectFileService.php

示例2: uploadingLocalOrCloudFiles

 /**
  * Upload to Local or Cloud
  * 
  */
 protected function uploadingLocalOrCloudFiles($type, $file, $fname, $assetPath, $localDestination = "")
 {
     if (!config('veer.use_cloud_' . $type)) {
         return $file->move($localDestination . $assetPath, $fname);
     }
     \Storage::put($assetPath . '/' . $fname, file_get_contents($file->getPathName()));
 }
开发者ID:artemsk,项目名称:veer-core,代码行数:11,代码来源:HelperTrait.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Suppression préalable des fichiers de upload par l'utilisation de la variable storage définie à l'aide de l'instruction public_path('upload') du fichier de configuration config\filesystem.php)
     $files = Storage::allFiles();
     //retroune un tableau des images de storage
     foreach ($files as $file) {
         Storage::delete($file);
     }
     //Supprimer toutes les lignes de la talble Pictures
     //        DB::table('pictures')->
     // Récupération d'un faker opétationnel
     // $faker = Faker\Factory::create();
     $products = Product::all();
     foreach ($products as $product) {
         // Stokage de l'image et récupération de l'uri
         $uri = str_random(15) . '_370x235.jpg';
         Storage::put($uri, file_get_contents('http://lorempixel.com/people/370/325/'));
         Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->faker->name]);
     }
     //        DB::table('pictures')->insert(
     //            [
     //                [
     //                    'product_id'  => '2' ,
     //                    'uri'         => $uri
     //                ],
     //            ]
     //        );
 }
开发者ID:lionel-kahan,项目名称:Star-Wars,代码行数:33,代码来源:PictureTableSeeder.php

示例4: hookHandler

 /**
  * process request from gitlab webhook.
  *
  * @param  Request  $request
  * @return Response
  */
 public function hookHandler(Request $request)
 {
     $clientIp = !empty($request->header('X-Forwarded-For')) ?: $request->ip();
     Log::debug('hook received from ' . $clientIp);
     if ($this->isVerbose()) {
         dump($request);
     }
     $eventType = $request->headers->get('X-Gitlab-Event');
     if (is_null($eventType)) {
         $eventType = 'Push Hook';
     }
     // for debugging purpose.
     \Storage::put(str_replace(' ', '-', $eventType) . ".json", json_encode($request->json()->all(), JSON_PRETTY_PRINT));
     Log::info('eventType : ' . $eventType);
     if ($eventType == 'Push Hook') {
         return $this->pushHook($request);
     } elseif ($eventType == 'Tag Push Hook') {
         return $this->tagPushHook($request);
     } elseif ($eventType == 'Issue Hook') {
         return $this->issueHook($request);
     } elseif ($eventType == 'Note Hook') {
         return $this->noteHook($request);
     } elseif ($eventType == 'Merge Request Hook') {
         return $this->mergeRequestHook($request);
     }
     abort(500, 'Unknown Hook type : ' . $eventType);
 }
开发者ID:dw250100785,项目名称:gitlab-jira-integration,代码行数:33,代码来源:GitlabController.php

示例5: createFile

 public function createFile(array $data)
 {
     $project = $this->repository->skipPresenter()->find($data['project_id']);
     $projectFile = $project->files()->create($data);
     $arquivo = $projectFile->id . "." . $data['extension'];
     \Storage::put($arquivo, \File::get($data['file']));
 }
开发者ID:danillosrangel,项目名称:CodeProject-curso,代码行数:7,代码来源:ProjectService.php

示例6: creating

 public function creating(Media $media)
 {
     $uploadedFile = $this->request->file('media');
     $fileName = time() . $uploadedFile->getClientOriginalName();
     \Storage::put($fileName, file_get_contents($uploadedFile->getRealPath()));
     $media->url = url('uploads/' . $fileName);
 }
开发者ID:laravel-italia,项目名称:site,代码行数:7,代码来源:UploadFileWhenAddingMedia.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     if ($request->hasFile('file')) {
         $name = $request->file('file')->getClientOriginalName();
         \Storage::put($name, file_get_contents($request->file('file')->getRealPath()));
         return response()->json(['img' => $name]);
     }
 }
开发者ID:cesg,项目名称:video-club,代码行数:14,代码来源:ImagenController.php

示例8: imageresponse

 public function imageresponse($name)
 {
     $randomcolor = RandomColor::one(array('luminosity' => 'light'));
     $img = \DefaultProfileImage::create($name, 256, $randomcolor, '#FFF');
     \Storage::put("profile.png", $img->encode());
     $headers = ['Content-Type' => 'image/jpeg', 'Content-Disposition' => 'inline', 'Cache-Control' => 'must-revalidate, post-check=0, pre-check=0', 'Pragma' => 'public'];
     return \Response::make($img, 200, $headers)->setTtl(60 * 30);
 }
开发者ID:axlyody,项目名称:mikoci,代码行数:8,代码来源:HomeController.php

示例9: testDelete

 public function testDelete()
 {
     Storage::put('test-file.txt', 'what is this');
     $file = factory(\Yab\Quarx\Models\File::class)->make(['id' => 2, 'location' => ['file_a' => ['name' => CryptoService::encrypt('test-file.txt'), 'original' => 'test-file.txt', 'mime' => 'txt', 'size' => 24]]]);
     $this->call('POST', 'quarx/files', $file->getAttributes());
     $response = $this->call('DELETE', 'quarx/files/2');
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertRedirectedTo('quarx/files');
 }
开发者ID:YABhq,项目名称:Quarx,代码行数:9,代码来源:FilesTest.php

示例10: postAdd

 function postAdd()
 {
     $data = json_decode(\File::get(storage_path() . '/app/data.json'), 1);
     $product = ['name' => \Input::get('product_name'), 'quantity' => \Input::get('quantity'), 'price' => \Input::get('price'), 'timestamp' => date("Y-m-d H:i:s")];
     $data[] = $product;
     \Storage::put('data.json', json_encode($data));
     $product['timestamp'] = date("m/d/Y h:i a", strtotime($product['timestamp']));
     return \Response::json(['success' => true, 'data' => $product]);
 }
开发者ID:amermchaudhary,项目名称:coalition,代码行数:9,代码来源:FormWebPage.php

示例11: makeUpload

 /**
  * Upload a single image
  * @param $file Object 
  * @param $path String
  * @return String Image name
  */
 private function makeUpload($file, $path)
 {
     // Get file name
     $filename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
     // Create safe name with extension
     $name = str_slug($filename) . '.' . $file->getClientOriginalExtension();
     // Upload
     \Storage::put($path . $name, file_get_contents($file->getRealPath()));
     return $name;
 }
开发者ID:juanem1,项目名称:uploader,代码行数:16,代码来源:Uploader.php

示例12: store

 /**
  *   Store the new game in the database
  *
  *   @param App\Http\Requests\StoreGameRequest $request
  *   @param App\Repositories\GameRepository $gameRepo
  *
  *   @return response
  */
 public function store(StoreGameRequest $request, GameRepository $gameRepo)
 {
     $game = $gameRepo->create($request);
     if ($request->hasFile('image') and $request->file('image')->isValid()) {
         $imageUri = 'games/logos/' . $game->id . '_logo_' . \Carbon\Carbon::now()->timestamp . '.' . $request->file('image')->getClientOriginalExtension();
         \Storage::put($imageUri, file_get_contents($request->file('image')->getRealPath()));
         $game->logo = $imageUri;
         $game->save();
     }
     return redirect()->route('admin.games.index')->with('success', $game->name . " has been created");
 }
开发者ID:BrantWladichuk,项目名称:gamechalleng.es,代码行数:19,代码来源:GameController.php

示例13: rollback

 /**
  * rollback
  */
 public function rollback()
 {
     $this->storage->remove($this->uri, $this->options);
     if (is_null($this->previous)) {
         $this->storage->remove($this->uri);
     } else {
         $this->storage->put($this->previous, $this->uri, $this->options);
     }
     $this->clean();
     $this->initialize();
 }
开发者ID:mychaelstyle,项目名称:php-utils,代码行数:14,代码来源:File.php

示例14: testPut

 /**
  * @covers mychaelstyle\Storage::put
  */
 public function testPut()
 {
     $def1 = $this->dsnMap['Local'];
     $def2 = $this->dsnMap['Local2'];
     $this->object->addProvider($def2['dsn'], $def2['options']);
     $path = DIR_FIXTURES . '/example.txt';
     $expected = file_get_contents($path);
     $this->object->put($path, $this->uri_example, array('permission' => 0644));
     $this->assertLocalWritten($def1['dsn'], $expected, $this->uri_example);
     $this->assertLocalWritten($def2['dsn'], $expected, $this->uri_example);
 }
开发者ID:mychaelstyle,项目名称:php-utils,代码行数:14,代码来源:StorageTest.php

示例15: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $tables = ['maven_faqs', 'maven_tags', 'maven_unique_keys'];
     foreach ($tables as $table) {
         $values = \DB::table($table)->get();
         if (count($values)) {
             $json = json_encode($values);
             \Storage::put('maven/' . $table . '.json', $json);
             $this->info('"' . $table . '" exported!');
         }
     }
 }
开发者ID:sukohi,项目名称:maven,代码行数:17,代码来源:MavenExportCommand.php


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