本文整理汇总了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
// ],
// ]
// );
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
}
示例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);