當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Storage::allFiles方法代碼示例

本文整理匯總了PHP中Storage::allFiles方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::allFiles方法的具體用法?PHP Storage::allFiles怎麽用?PHP Storage::allFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Storage的用法示例。


在下文中一共展示了Storage::allFiles方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: run

 public function run()
 {
     $files = Storage::allFiles();
     foreach ($files as $file) {
         Storage::delete($file);
     }
     $test = Product::all();
     foreach ($test as $value) {
         $uri = str_random(12) . '_370x235.jpg';
         Storage::put($uri, file_get_contents('http://lorempixel.com/futurama/370/235'));
         Picture::create(['product_id' => $value->id, 'uri' => $uri, 'title' => $this->faker->name]);
     }
 }
開發者ID:olivierfinot,項目名稱:ProjetLaravel,代碼行數:13,代碼來源:PictureTableSeeder.php

示例3: run

 public function run()
 {
     $files = Storage::allFiles();
     foreach ($files as $file) {
         Storage::delete($file);
     }
     $products = App\Product::all();
     foreach ($products as $product) {
         // pour importer de fichiers distants
         $uri = str_random(12) . '_370x235.jpg';
         Storage::put($uri, file_get_contents('http://lorempixel.com/futurama/370/235/'));
         Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->faker->name]);
     }
 }
開發者ID:bocanico,項目名稱:ProjetStarWars,代碼行數:14,代碼來源:PictureTableSeeder.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //        Eloquent::unguard();
     DB::table('pictures')->delete();
     DB::statement("ALTER TABLE pictures AUTO_INCREMENT=1");
     $files = Storage::allFiles();
     foreach ($files as $file) {
         Storage::delete($file);
     }
     $products = Product::all();
     foreach ($products as $product) {
         $uri = str_random(12) . '_370x235.jpg';
         Storage::put($uri, file_get_contents('http://lorempixel.com/futurama/370/235'));
         Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->facker->name, 'type' => 'jpg', 'size' => 200]);
     }
 }
開發者ID:patlegris,項目名稱:appStarWars,代碼行數:21,代碼來源:PictureTableSeeder.php

示例5: run

 public function run()
 {
     $files = Storage::allFiles();
     foreach ($files as $file) {
         Storage::delete($file);
         //sert a vider le dossier upload si on relance un refresh
         //pour éviter de stocker 15 images + 15 images ect...
     }
     $products = Product::all();
     //recupere tous les produits precedement creer dans un tableau
     foreach ($products as $product) {
         $uri = str_random(12) . '_370x235.jpg';
         //str_random fait un chaine de caractere de 12
         Storage::put($uri, file_get_contents('http://lorempixel.com/futurama/370/235/'));
         Picture::create(['product_id' => $product->id, 'uri' => $uri, 'title' => $this->faker->name]);
     }
 }
開發者ID:laetitia91800,項目名稱:StarWars,代碼行數:17,代碼來源:PictureTableSeeder.php

示例6: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->insert([['name' => 'Tony', 'email' => 'tony@tony.fr', 'password' => Hash::make('Tony'), 'role' => 'administrator'], ['name' => 'Antoine', 'email' => 'antoine@antoine.fr', 'password' => Hash::make('Antoine'), 'role' => 'visitor'], ['name' => 'Romain', 'email' => 'romain@romain.fr', 'password' => Hash::make('Tony'), 'role' => 'visitor'], ['name' => 'yini', 'email' => 'ynin@ynin.fr', 'password' => Hash::make('Yini'), 'role' => 'visitor']]);
     factory(App\Customer::class, 4)->create();
     // avatars
     DB::table('avatars')->delete();
     DB::statement("ALTER TABLE avatars AUTO_INCREMENT=1");
     $files = Storage::allFiles(env('UPLOADS_AVATARS', 'uploads'));
     foreach ($files as $file) {
         Storage::delete($file);
     }
     $users = User::all();
     foreach ($users as $user) {
         $uri = str_random(12) . '_216x256.jpg';
         $fileName = file_get_contents('http://lorempixel.com/216/256/animals');
         $pathDirectory = env('UPLOADS_AVATARS', 'avatars') . DIRECTORY_SEPARATOR . $uri;
         Storage::put($pathDirectory, $fileName);
         $mime = mime_content_type(storage_path('app') . DIRECTORY_SEPARATOR . $pathDirectory);
         Avatar::create(['user_id' => $user->id, 'uri' => $uri, 'title' => $this->facker->name, 'mime' => $mime]);
     }
 }
開發者ID:Antoine07,項目名稱:appStarwars,代碼行數:26,代碼來源:UserTableSeeder.php

示例7: base_path

| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/
$app = (require_once __DIR__ . '/application/bootstrap/app.php');
/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/
$kernel = $app->make('Illuminate\\Contracts\\Http\\Kernel');
$response = $kernel->handle($request = Illuminate\Http\Request::capture());
#SYNTROPY: 2016-02-06: Die and Dump Settings
#dd(App::make('Settings'));
#$storagePath  = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix();
#$storagePath = base_path();
#$storagePath  = Storage::disk('cryptoffice');
#dd($storagePath);
$files = Storage::allFiles('application/storage/uploads/');
#$files = Storage::allFiles($storagePath);
dd($files);
$response->send();
$kernel->terminate($request, $response);
開發者ID:syntropysoftware,項目名稱:cryptoffice-frontend,代碼行數:31,代碼來源:index.php


注:本文中的Storage::allFiles方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。