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


PHP SiteHelpers::processTimeUpdate方法代码示例

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


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

示例1: postSave

 function postSave(Request $request)
 {
     $validator = Validator::make($request->all(), News::$rules);
     if ($validator->passes()) {
         $data = $this->getDataPost('news');
         $type_pro = !isset($data['news_id']) ? "add" : "edit";
         //Make alias
         //$data['alias'] =  \SiteHelpers::seoUrl( trim($data['name']));
         $data = \SiteHelpers::processTimeUpdate($type_pro, $data);
         if (!is_null(\Input::file('file'))) {
             $file = \Input::file('file');
             //Edit Path
             $destinationPath = './uploads/news/';
             $filename = $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             //if you need extension of the file
             //Edit file name
             $newfilename = 'news_' . time() . '.' . $extension;
             $uploadSuccess = \Input::file('file')->move($destinationPath, $newfilename);
             if ($uploadSuccess) {
                 //Edit name of field image
                 $data['news_picture'] = $newfilename;
                 $orgFile = $destinationPath . '/' . $newfilename;
                 $thumbFile = $destinationPath . '/thumb/' . $newfilename;
                 //SiteHelpers::resizewidth("213",$orgFile,$thumbFile);
                 //Edit size thumb image
                 \SiteHelpers::resize_crop_image('600', '450', $orgFile, $thumbFile);
                 if ($type_pro == "edit") {
                     $data_old = $this->model->getRow(\Input::get('news_id'));
                     //Edit folder name and field name
                     @unlink(ROOT . '/uploads/news/' . $data_old->aboutus_image);
                     @unlink(ROOT . '/uploads/news/thumb/' . $data_old->aboutus_image);
                 }
             }
         }
         $id = $this->model->insertRow($data, \Input::get('news_id'));
         if (!is_null($request->input('apply'))) {
             $return = 'news/update/' . $id . '?return=' . self::returnUrl();
         } else {
             $return = 'news?return=' . self::returnUrl();
         }
         // Insert logs into database
         if ($request->input('news_id') == '') {
             \SiteHelpers::auditTrail($request, 'New Data with ID ' . $id . ' Has been Inserted !');
         } else {
             \SiteHelpers::auditTrail($request, 'Data with ID ' . $id . ' Has been Updated !');
         }
         return Redirect::to($return)->with('messagetext', \Lang::get('core.note_success'))->with('msgstatus', 'success');
     } else {
         $id = \Input::get('news_id') ? \Input::get('news_id') : "";
         return Redirect::to('news/update/' . $id)->with('messagetext', \Lang::get('core.note_error'))->with('msgstatus', 'error')->withErrors($validator)->withInput();
     }
 }
开发者ID:blackorwhite123,项目名称:cms_laravel5,代码行数:53,代码来源:NewsController.php


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