本文整理匯總了PHP中Illuminate\Support\Facades\Storage::allFiles方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::allFiles方法的具體用法?PHP Storage::allFiles怎麽用?PHP Storage::allFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\Storage
的用法示例。
在下文中一共展示了Storage::allFiles方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run()
{
$files = Storage::allFiles();
foreach ($files as $file) {
Storage::disk('local')->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->faker->name]);
}
}
示例2: getVersions
public function getVersions($id)
{
$entry = FileRecord::where('id', '=', $id)->firstOrFail();
$owner = $entry->owner_id;
$files = Storage::allFiles($entry->owner_id . $entry->id . $entry->filename . "/");
$docType = $entry->doc_type_id;
$i = 0;
foreach ($files as $file) {
$files[$i] = str_replace($entry->owner_id . $entry->id . $entry->filename . "/", "", $file);
$i++;
}
return View::make('nav.cards.fileVersions')->with('files', $files)->with('id', $id)->with('owner', $owner)->with('docType', $docType);
}
示例3: deleteFileVer
public function deleteFileVer($id, $ver)
{
$entry = FileRecord::where('id', '=', $id)->firstOrFail();
Storage::delete($entry->owner_id . $entry->id . $entry->filename . "/" . $ver);
$files = Storage::allFiles($entry->owner_id . $entry->id . $entry->filename . "/");
if (count($files) == 0) {
Storage::deleteDirectory($entry->owner_id . $entry->id . $entry->filename);
$entry->delete();
} else {
if ($ver == $entry->public_version) {
$last = str_replace($entry->owner_id . $entry->id . $entry->filename . "/", "", end($files));
$entry->public_version = $last;
$entry->save();
}
}
return redirect('/');
}