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


PHP Listing::order_by方法代碼示例

本文整理匯總了PHP中Listing::order_by方法的典型用法代碼示例。如果您正苦於以下問題:PHP Listing::order_by方法的具體用法?PHP Listing::order_by怎麽用?PHP Listing::order_by使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Listing的用法示例。


在下文中一共展示了Listing::order_by方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: action_create

 public function action_create()
 {
     if (Session::has('id')) {
         $account = Account::find(Session::get('id'));
         if (Input::has('title') && Input::has('category_id') && Input::has('price') && Input::has('date_available') && Input::has('date_unavailable')) {
             $location;
             if (Input::has('location_id')) {
                 $location = Location::find(Input::get('location_id'));
             }
             if (Input::has('address') || Input::has('city') || Input::has('postal_code')) {
                 $location = new Location();
                 Input::has('address') ? $location->address = Input::get('address') : ($location->address = '');
                 Input::has('city') ? $location->city = Input::get('city') : ($location->city = '');
                 Input::has('postal_code') ? $location->postal_code = Input::get('postal_code') : ($location->postal_code = '');
                 // $location->address = Input::get('address');
                 // $location->city = Input::get('city');
                 // $location->postal_code = Input::get('postal_code');
                 $location->account_id = $account->id;
                 $location->save();
                 $location = Location::where_address_and_city_and_postal_code(Input::get('address'), Input::get('city'), Input::get('postal_code'))->first();
             } else {
                 Session::put('alert', 'Incomplete Location Data');
                 // $view = View::make('')
             }
             $listing = new Listing();
             $listing->title = strip_tags(Input::get('title'));
             $listing->description = Input::has('description') ? strip_tags(Input::get('description')) : '';
             $listing->category_id = Input::get('category_id');
             $listing->price = Input::get('price');
             $date_available = Input::get('date_available');
             $date_unavailable = Input::get('date_unavailable');
             $listing->date_available = $date_available . "-00-00-00";
             $listing->date_unavailable = $date_unavailable . "-00-00-00";
             $listing->location_id = $location->id;
             $listing->save();
             $listing = Listing::order_by('id', 'desc')->first();
             return Redirect::to('/listing/addimages/' . $listing->id);
         } else {
             $categories = Categorie::all();
             $locations = $account->locations()->get();
             $view = View::make('listing.create.index')->with('title', 'Create a Posting')->with('locations', $locations)->with('categories', $categories);
             // var_dump($_POST);
             return $view;
         }
     } else {
         return Redirect::to('/account');
     }
 }
開發者ID:angmark0309,項目名稱:remarket,代碼行數:48,代碼來源:listing.php


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