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


PHP Purchase::orderby方法代码示例

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


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

示例1: autouploadsaved

 public function autouploadsaved()
 {
     //Image Upload
     $purchasecheck = Purchase::orderby('id', 'DESC')->count();
     if ($purchasecheck != 0) {
         $purchase = Purchase::orderby('id', 'DESC')->find(Input::get('id'));
         $docs = Document::orderby('id', 'DESC')->where('pr_id', $purchase->id)->first();
         $pr_id = $purchase->id;
         $doc_id = $docs->id;
     } else {
         $pr_id = 1;
         $doc_id = 1;
     }
     foreach (Input::file('file') as $file) {
         $rules = array('file' => 'required|mimes:png,gif,jpeg,jpg|max:900000000000000000000');
         $validator = \Validator::make(array('file' => $file), $rules);
         $destine = public_path() . "/uploads";
         if ($validator->passes()) {
             $ext = $file->guessClientExtension();
             // (Based on mime type)
             $ext = $file->getClientOriginalExtension();
             // (Based on filename)
             $filename = $file->getClientOriginalName();
             $archivo = value(function () use($file) {
                 $filename = str_random(10) . '.' . $file->getClientOriginalExtension();
                 return strtolower($filename);
             });
             $archivo = value(function () use($file) {
                 $date = date('m-d-Y-h-i-s', time());
                 $filename = $date . "-" . $file->getClientOriginalName();
                 return strtolower($filename);
             });
             $attach = new Attachments();
             $attach->doc_id = $doc_id;
             $attach->data = $archivo;
             $attach->saved = 1;
             $attach->save();
             $filename = $doc_id . "_" . $attach->id;
             $file->move($destine, $archivo);
             $target_folder = $destine;
             $upload_image = $target_folder . "/" . $archivo;
             $thumbnail = $target_folder . "/resize" . $archivo;
             $actual = $target_folder . "/" . $archivo;
             // THUMBNAIL SIZE
             list($width, $height) = getimagesize($upload_image);
             $newwidth = $width;
             $newheight = $height;
             while ($newheight > 525) {
                 $newheight = $newheight * 0.8;
                 $newwidth = $newwidth * 0.8;
             }
             $source = $upload_image;
             $ext = strtolower($ext);
             $thumb = imagecreatetruecolor($newwidth, $newheight);
             if ($ext == "jpg" || $ext == "jpeg") {
                 $source = imagecreatefromjpeg($upload_image);
             } elseif ($ext == "png") {
                 $source = imagecreatefrompng($upload_image);
             } elseif ($ext == "gif") {
                 $source = imagecreatefromgif($upload_image);
             } else {
                 continue;
             }
             // RESIZE
             imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
             // MAKE NEW FILES
             if ($ext == "jpg" || $ext == "jpeg") {
                 imagejpeg($thumb, $thumbnail, 100);
             } elseif ($ext == "png") {
                 imagepng($thumb, $thumbnail, 9);
             } elseif ($ext == "gif") {
                 imagegif($thumb, $thumbnail, 100);
             } else {
                 echo "An invalid image";
             }
             unlink($actual);
             // FILE RENAMES
             rename($thumbnail, $actual);
         } else {
             Session::put('imgerror', 'Invalid file.');
         }
     }
     //End Image Upload
     return redirect::back()->withInput();
 }
开发者ID:iHunt101,项目名称:procurementTrackingSystem,代码行数:85,代码来源:PurchaseRequestController.php


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