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


PHP Storage::makeDirectory方法代码示例

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


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

示例1: handle

 public function handle($payload)
 {
     $this->folder = $payload['folder'];
     $this->cleanUp();
     if (isset($payload['bucket'])) {
         Config::set('S3_BUCKET', $payload['bucket']);
     }
     if (isset($payload['region'])) {
         Config::set('S3_REGION', $payload['region']);
     }
     if (isset($payload['secret'])) {
         Config::set('S3_SECRET', $payload['secret']);
     }
     if (isset($payload['key'])) {
         Config::set('S3_KEY', $payload['key']);
     }
     if (isset($payload['destination'])) {
         $this->thumbnail_destination = $payload['destination'];
     } else {
         $this->thumbnail_destination = base_path("storage");
     }
     if (!Storage::exists($this->thumbnail_destination)) {
         Storage::makeDirectory($this->thumbnail_destination, 0755, true);
     }
     $files = Storage::disk('s3')->allFiles($this->folder);
     Log::info(print_r($files, 1));
     $this->getAndMake($files);
     $this->uploadFilesBacktoS3();
     $this->cleanUp();
 }
开发者ID:nagyistoce,项目名称:thumbnail-maker,代码行数:30,代码来源:ThumbMakerService.php

示例2: setupUploadOptions

 /**
  * Setup options for file upload.
  *
  * @option disk
  *         This will be if you want to use a different storage disk than default.
  *
  * @option filename
  *         Set the filename that you want, by default a random string is generated.
  *
  * @option extension
  *         Set the extension here, to str_replace on the filename that is passed through.
  *
  * @option image
  *         Set to true if you would like to have the upload be an image.
  *
  * @option directory
  *         Set a directory you would like the file to be uploaded to.
  *
  * @option img_width
  *         Set the thumbnail image width, default is 50px.
  *
  * @option img_height
  *         Set the thumbnail image height, default is 50px.
  *
  * @param array $options
  */
 protected function setupUploadOptions(array $options)
 {
     // Setup disk if set in options.
     if (isset($options['disk'])) {
         $this->disk = $options['disk'];
         $this->filesystem = Storage::disk($this->disk);
     }
     // Remove extension from filename if its passed through.
     if (isset($options['filename']) && isset($options['extension'])) {
         $this->filename = str_replace($options['extension'], '', $options['filename']);
     }
     // Setup filename if set in options.
     if (isset($options['filename']) && !isset($options['extension'])) {
         $this->filename = $options['filename'];
     }
     // Setup image if set in options.
     if (isset($options['image'])) {
         $this->image = true;
     }
     // Setup directory if set in options.
     if (isset($options['directory'])) {
         $this->directory = $options['directory'];
         $this->filesystem->makeDirectory($this->directory);
     }
     // Setup width if set in options.
     if (isset($options['img_width'])) {
         $this->width = $options['img_width'];
     }
     // Setup height if set in options.
     if (isset($options['img_height'])) {
         $this->height = $options['img_height'];
     }
 }
开发者ID:johnjjung,项目名称:support,代码行数:59,代码来源:UploadTrait.php

示例3: upload

 public function upload()
 {
     $dir = 'uploads/' . $this->folder;
     $path = $dir . '/' . $this->newFileName;
     if (!file_exists($dir)) {
         Storage::makeDirectory($this->folder);
     }
     $this->make($path);
     return $path;
 }
开发者ID:ninjamonz,项目名称:laravel_catalog_example,代码行数:10,代码来源:UploadImage.php

示例4: storeFile

 public function storeFile($directory, $uploadedFile)
 {
     Storage::makeDirectory($directory);
     if (!$uploadedFile) {
         return false;
     }
     do {
         $this->file_name = str_random(40);
     } while (UploadedFile::where('file_name', $this->file_name)->count() > 0);
     $this->folder = $directory;
     $this->original_file_name = $uploadedFile->getClientOriginalName();
     $uploadedFile->move(storage_path() . $directory, $this->file_name);
     $this->mime_type = File::mimeType(storage_path() . $directory . $this->file_name);
     $this->save();
     return true;
 }
开发者ID:ElasticOrange,项目名称:issue-monitoring,代码行数:16,代码来源:UploadedFile.php

示例5: StoreAttachment

 private function StoreAttachment($parentID, Request $request)
 {
     $AttachmentFieldsData = [];
     Storage::makeDirectory("P_" . $parentID);
     Storage::disk("local")->put("P_" . $parentID . "/" . $request->files->get("attached_file")->getClientOriginalName(), file_get_contents($request->file("attached_file")));
     $AttachmentFieldsData["Attachment_Storage_File_Name"] = $request->files->get("attached_file")->getClientOriginalName();
     return $AttachmentFieldsData;
 }
开发者ID:rowanhwilliams,项目名称:ftm-php,代码行数:8,代码来源:ProductsController.php

示例6: upload

 /**
  * @param UploadedFile $file
  *
  * @param null $filename
  * @return null|string
  */
 private function upload(UploadedFile $file, $filename = null)
 {
     if ($file && $file->isValid()) {
         if (!Storage::exists('page_image')) {
             Storage::makeDirectory('page_image');
         }
         if ($filename === null) {
             $filename = $this->getUniqueName('page_image', $file->getClientOriginalExtension());
         }
         $file->move('page_image', $filename);
         return $filename;
     }
     return null;
 }
开发者ID:rdehnhardt,项目名称:rdehnhardt,代码行数:20,代码来源:TagsController.php

示例7: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $selfFirmUser = User::with('firm')->where('role_id', User::ADMIN)->first();
     $userCompany = User::with('firm')->where('id', $this->order->user_id)->first();
     $products = $this->order->products_in_order;
     $firm = $userCompany->firm;
     $productsArr = [];
     foreach ($products as $product) {
         $productsArr[$this->depo->id][] = ['product_name' => $product->product_name, 'product_amount' => $product->product_amount, 'product_price' => $product->product_price, 'product_nds' => Product::getVAT_calculationByKey($product->nds), 'product_nds_as_str' => Product::getAllVAT_rateByKey($product->nds)];
     }
     $date = DateTime::createFromFormat('Y-m-d H:i:s', $this->order->created_at);
     $date = strtotime($date->format('d F Y'));
     if (!$firm->rp_face_fio) {
         $faceFioArr = explode(' ', $firm->face_fio);
         $lastName = isset($faceFioArr[0]) ? $faceFioArr[0] : '';
         $name = isset($faceFioArr[1]) ? $faceFioArr[1] : '';
         $secondName = isset($faceFioArr[2]) ? $faceFioArr[2] : '';
         $petrovich = new Petrovich();
         $petrovich->gender = $petrovich->detectGender($secondName);
         if ($petrovich->gender == Petrovich::FAIL_MIDDLEWARE) {
             $fio = $firm->face_fio;
         } else {
             $fio = $petrovich->lastname($lastName, Petrovich::CASE_GENITIVE) . ' ' . $petrovich->firstname($name, Petrovich::CASE_GENITIVE) . ' ' . $petrovich->middlename($secondName, Petrovich::CASE_GENITIVE);
             $firm->rp_face_fio = $fio;
             $firm->save();
         }
     } else {
         $fio = $firm->rp_face_fio;
     }
     if (!$firm->rp_face_position) {
         $facePosition = Utils::getGenitiveCase($firm->face_position);
         if ($facePosition != $firm->face_position) {
             $firm->rp_face_position = $facePosition;
             $firm->save();
         }
     } else {
         $facePosition = $firm->rp_face_position;
     }
     if (!$firm->rp_base_document) {
         $baseDocument = Utils::getGenitiveCase($firm->base_document);
         if ($baseDocument != $firm->base_document) {
             $firm->rp_base_document = $baseDocument;
             $firm->save();
         }
     } else {
         $baseDocument = $firm->rp_base_document;
     }
     $pdf = App::make('dompdf.wrapper');
     $pdf->loadView('documents.invoice', ['orderNumber' => $this->order->id, 'orderDate' => date('d.m.Y', $date), 'firm' => $firm, 'firmRpFio' => $fio, 'firmFacePosition' => $facePosition, 'firmBaseDocument' => $baseDocument, 'selfFirm' => $selfFirmUser->firm, 'products' => $productsArr, 'depoId' => $this->depo->id, 'depoName' => $this->depo->stantion_name]);
     //$whereAreClientDocuments = storage_path().'/app'.Config::get('documents')['documents_folder'];
     $documents = Config::get('documents');
     $whereAreClientDocuments = $documents['documents_folder'];
     //client_{id}
     if (!Storage::disk('local')->exists($whereAreClientDocuments . '/client_' . Auth::user()->id)) {
         Storage::makeDirectory($whereAreClientDocuments . '/client_' . Auth::user()->id);
     }
     //invoices
     if (!Storage::disk('local')->exists($whereAreClientDocuments . '/client_' . Auth::user()->id . '/invoices')) {
         Storage::makeDirectory($whereAreClientDocuments . '/client_' . Auth::user()->id . '/invoices');
     }
     $clientFolder = storage_path() . '/app' . $whereAreClientDocuments . '/client_' . Auth::user()->id . '/invoices';
     //invoice_{orderID}_{depoName}_date_{currentDate}
     $fileNameTemplate = $documents['client_invoice_template'];
     $fileNameTemplate = Utils::mb_str_replace('{docType}', Order::getDocTypeName(Order::INVOICE_TYPE), $fileNameTemplate);
     $fileNameTemplate = Utils::mb_str_replace('{orderID}', $this->order->id, $fileNameTemplate);
     $depoName = Utils::mb_str_replace(' ', '', $this->depo->stantion_name);
     $depoName = Utils::translit($depoName);
     $fileNameTemplate = Utils::mb_str_replace('{depoName}', $depoName, $fileNameTemplate);
     $fileNameTemplate = Utils::mb_str_replace('{currentDate}', time(), $fileNameTemplate);
     $pdf->save($clientFolder . '/' . $fileNameTemplate);
     $docs = new Document();
     $docs->type = Order::INVOICE_TYPE;
     $docs->user_id = Auth::user()->id;
     $docs->order_id = $this->order->id;
     $docs->file_name = $clientFolder . '/' . $fileNameTemplate;
     $docs->sended = 1;
     $docs->save();
 }
开发者ID:kostik34,项目名称:trains.shop,代码行数:83,代码来源:CreateInvoice.php

示例8: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $rules = array('firstname' => 'required', 'surname' => 'required', 'customeremail' => 'required|email', 'pass' => 'required', 'phone' => 'required', 'rpass' => 'required|same:pass');
     $validator = Validator::make($request->all(), $rules);
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return back()->withInput()->withErrors($messages);
     } else {
         if (User::where('email', $request->input('customeremail'))->first()) {
             return redirect()->action('AuthenticationController@showRegister')->withErrors(['messages' => "Sistemde mail adresi kayıtlı"]);
         }
         $user = new User();
         $user->name = trim($request->input('firstname'));
         $user->surname = trim($request->input('surname'));
         $user->setAsCustomer();
         $user->is_active = false;
         $user->email = $request->input('customeremail');
         $user->password = bcrypt($request->input('pass'));
         $user->save();
         $customer = new Customer();
         $customer->phone = $request->input('phone');
         $customer->id = $user->id;
         $customer->save();
         if (Session::has('user_instagram_info')) {
             $instagramInfo = Session::pull('user_instagram_info');
             $instagramAccount = new InstagramAccount();
             $instagramAccount->instagram_id = $instagramInfo->user->id;
             $instagramAccount->username = $instagramInfo->user->username;
             $instagramAccount->access_token = $instagramInfo->access_token;
             $instagramAccount->full_name = $instagramInfo->user->full_name;
             $instagramAccount->bio = $instagramInfo->user->bio;
             $instagramAccount->website = $instagramInfo->user->website;
             $instagramAccount->profile_picture = $instagramInfo->user->profile_picture;
             $customer->instagramAccount()->save($instagramAccount);
         }
         Storage::makeDirectory($user->id);
         return redirect()->action('AuthenticationController@showRegister')->with('success', ['Successful']);
     }
 }
开发者ID:mg9,项目名称:koalaBazaar,代码行数:47,代码来源:CustomerController.php

示例9: addPage

 /**
  * Add a page
  * @param string $any current directory path
  */
 public function addPage($any = '')
 {
     $name = Request::input('name');
     $type = Request::input('type');
     $success = false;
     if (empty($name)) {
         return response()->json(['success' => $success, 'message' => 'Title cannot be empty.']);
     }
     $newPath = $any !== '/' ? $any : '';
     $any = 'wiki/' . $any;
     $exists = Lecter::checkIfPageExists($name, $any, $type);
     if ($exists === false) {
         if ($type === 'file') {
             $success = Storage::put($any . '/' . $name . '.md', '');
         } else {
             $success = Storage::makeDirectory($any . '/' . $name);
         }
     } else {
         $message = 'A page with this name already exists';
     }
     if ($success === true) {
         $message = 'Page created with success.';
     }
     return response()->json(['success' => $success, 'message' => $message, 'newPath' => $newPath]);
 }
开发者ID:mrjuliuss,项目名称:lecter,代码行数:29,代码来源:WikiController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     if (Session::has('user_instagram_info')) {
         $rules = array('firstname' => 'required', 'surname' => 'required', 'shopname' => 'required', 'shopemail' => 'required|email', 'pass' => 'required', 'repass' => 'required|same:pass');
         // do the validation ----------------------------------
         // validate against the inputs from our form
         $validator = Validator::make($request->all(), $rules);
         // check if the validator failed -----------------------
         if ($validator->fails()) {
             // get the error messages from the validator
             $messages = $validator->messages();
             // redirect our user back to the form with the errors from the validator
             return back()->withInput()->withErrors($messages);
         } else {
             $instagramInfo = Session::pull('user_instagram_info');
             $user = new User();
             $user->name = $request->input('firstname');
             $user->surname = $request->input('surname');
             $user->setAsSupplier();
             $user->is_active = false;
             $user->email = $request->input('shopemail');
             $user->password = bcrypt($request->input('pass'));
             $user->save();
             $supplier = new Supplier();
             $supplier->id = $user->id;
             $supplier->shop_name = $request->input('shopname');
             $supplier->profile_image = $instagramInfo->user->profile_picture;
             $supplier->save();
             $instagramAccount = new InstagramAccount();
             $instagramAccount->instagram_id = $instagramInfo->user->id;
             $instagramAccount->username = $instagramInfo->user->username;
             $instagramAccount->access_token = $instagramInfo->access_token;
             $instagramAccount->full_name = $instagramInfo->user->full_name;
             $instagramAccount->bio = $instagramInfo->user->bio;
             $instagramAccount->website = $instagramInfo->user->website;
             $instagramAccount->profile_picture = $instagramInfo->user->profile_picture;
             $supplier->instagramAccount()->save($instagramAccount);
             Storage::makeDirectory($user->id);
             return redirect()->action('AuthenticationController@showRegister')->with('success', ['Successful']);
         }
     } else {
         return redirect()->action('AuthenticationController@showRegister');
     }
 }
开发者ID:mg9,项目名称:koalaBazaar,代码行数:50,代码来源:SupplierController.php

示例11: handle

 /**
  * Handle the event.
  *
  * @param  SomeEvent  $event
  * @return void
  */
 public function handle(CategoryCreated $event)
 {
     $directory = "/img/blueprints/" . $event->category->id;
     Storage::makeDirectory($directory);
 }
开发者ID:karlos545,项目名称:takeaway,代码行数:11,代码来源:CreateCategoryFolder.php


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