本文整理匯總了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();
}
}