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


PHP Presenter::create方法代碼示例

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


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

示例1: postLecture

 public function postLecture()
 {
     //verify the user input and create account
     $validator = Validator::make(Input::all(), array('Title' => 'required|max:200', 'Description' => 'required', 'Date' => 'required', 'First_Name' => 'required|max:120', 'Last_Name' => 'required|max:120', 'Pic' => 'image|max:3000', 'Room' => 'required'));
     if ($validator->fails()) {
         return Redirect::route('organiser')->withErrors($validator)->withInput()->with('global', 'Sorry!! Your Event was not posted, please retry.');
     } else {
         $title = Input::get('Title');
         $description = Input::get('Description');
         $firstname = Input::get('First_Name');
         $lastname = Input::get('Last_Name');
         $date_view = Input::get('Date');
         $date = date('Y-m-d', strtotime($date_view));
         $file = Input::file('Pic');
         $roomid = Input::get('Room');
         if (Auth::user()) {
             $organiserid = Auth::user()->id;
         } else {
             $organiserid = 0;
         }
         //save the presenter details
         $presenter = Presenter::create(array('firstname' => $firstname, 'lastname' => $lastname));
         $pic_id = 0;
         //post photo
         if ($file != null) {
             //photos validation
             $destinationPath = 'pics';
             $ext = $file->guessClientExtension();
             // Get real extension according to mime type
             $fullname = $file->getClientOriginalName();
             // Client file name, including the extension of the client
             $hashname = date('H.i.s') . '-' . md5($fullname) . '.' . $ext;
             // Hash processed file name, including the real extension
             $upload_success = $file->move($destinationPath, $hashname);
             //Set the photo path name to hashname
             $pic = Photo::create(array('path' => 'pics/' . $hashname));
             if ($pic) {
                 $pic_id = $pic->id;
             }
         }
         if ($presenter) {
             //save all the other details
             $post = Lecture::create(array('organiser_id' => $organiserid, 'presenter_id' => $presenter->id, 'room_id' => $roomid, 'pic_id' => $pic_id, 'title' => $title, 'overview' => $description, 'date' => $date, 'attendance' => 0));
             if ($post) {
                 return View::make('organiser.success');
             }
         }
     }
 }
開發者ID:franqq,項目名稱:plmas,代碼行數:49,代碼來源:PostLectureController.php


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