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


PHP Item::count方法代码示例

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


在下文中一共展示了Item::count方法的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::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。