當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Item::skip方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:nasa181,項目名稱:BKK_Travel,代碼行數:57,代碼來源:web_controller.php


注:本文中的app\Item::skip方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。