本文整理汇总了PHP中app\Item::skip方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::skip方法的具体用法?PHP Item::skip怎么用?PHP Item::skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Item
的用法示例。
在下文中一共展示了Item::skip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addEvent
function addEvent(Request $request)
{
$current_user = Session::get('user');
if (!isset($current_user)) {
return 'you must login first.';
} else {
$id_tmp = 0;
if (($count = Item::count()) != 0) {
$id_tmp = Item::skip($count - 1)->first()->item_id;
}
$id_tmp = $id_tmp + 1;
$item = new Item();
$event = new Event();
$location = new Location();
$photo = new PhotoGallery();
/*---------------------upload_picture-----------------------*/
$file = Input::file('profile_picture');
if ($file != null) {
$destinationPath = 'img/';
$filename = md5(microtime() . $file->getClientOriginalName()) . "." . $file->getClientOriginalExtension();
Input::file('profile_picture')->move($destinationPath, $filename);
$num_photo = DB::table('photo_gallery')->count();
$photo->photo_id = DB::table('photo_gallery')->skip($num_photo - 1)->first()->photo_id + 1;
$photo->link_item_id = $id_tmp;
$photo->photo_url = '/' . $destinationPath . $filename;
$item->title_picture = $photo->photo_url;
$photo->save();
}
/*---------------------------------------------------------*/
$item->item_id = $id_tmp;
$item->title = $request->in_new_title;
$item->description = $request->in_new_description;
$item->tel = $request->in_new_tel;
$item->user_id = $current_user[5];
$event->start_date = $request->in_new_start_date;
$event->end_date = $request->in_new_end_date;
$event->entrance_fee = $request->in_new_entrance_fee;
$event->type = $request->in_new_type;
$event->parking = $request->in_new_parking;
$event->website_url = $request->in_new_website_url;
$event->link_item_id = $id_tmp;
$location->hint = $request->in_new_hint;
$location->build = $request->in_new_build;
$location->street_address = $request->in_new_street_address;
$location->sub_district = $request->in_new_sub_dis;
$location->district = $request->in_new_district;
$location->province = $request->in_new_province;
$location->postal_code = $request->in_new_post_code;
$location->lat = $request->in_new_lat;
$location->long = $request->in_new_lng;
$location->link_item_id = $id_tmp;
$item->save();
$location->save();
$event->save();
return redirect('/page_event/info/' . $id_tmp);
}
}