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


PHP Vote::find方法代碼示例

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


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

示例1: actionMy

 /**
  * 我的投票
  */
 public function actionMy()
 {
     $uid = Yii::app()->user->id;
     $model = new Vote();
     //初始化
     $criteria = new CDbCriteria();
     $criteria->order = 'ctime DESC';
     $criteria->condition = "uid=:uid";
     $criteria->params = array(':uid' => $uid);
     $mini = $model->find($criteria);
     $icon_list = Smile::model()->findAll();
     $date = Yii::app()->request->getQuery('date');
     if (!empty($date)) {
         $criteria = $model->fileaway($date, $criteria);
     }
     //取得數據總數,分頁顯示
     $total = $model->count($criteria);
     $pages = new CPagination($total);
     $pages->pageSize = self::PAGE_SIZE;
     $pages->applyLimit($criteria);
     //獲取數據集
     $list = $model->findAll($criteria);
     $data = array('list' => $list, 'pages' => $pages, 'mini' => $mini, 'icon_list' => $icon_list);
     $this->render('my', $data);
 }
開發者ID:vangogogo,項目名稱:justsns,代碼行數:28,代碼來源:VoteController.php

示例2: function

});
Route::get('/test', function () {
    // $artist = new Artist;
    // $artist->name = 'Eve 6';
    // $artist->save();
    // $candidate = new Candidate;
    // $candidate->cname=$data_array1[0];
    // $candidate->job_title=$data_array1[1];
    // $candidate->sex=$data_array1[2];
    // $candidate->vote_id=42;
    // $candidate->total_count=0;
    // $account = new Account;
    // $account->username;
    // $account->vote_id;
    // $account->finish_at;
    $vote = Vote::find(49);
    $account = new Account();
    $account->username = 'sandy';
    $account->vote_id = 49;
    $account->finish_at = "0000-00-00 00:00:00";
    $account->vote()->associate($vote);
    $account->save();
    $account2 = new Account();
    $account2->username = 'sandy2';
    $account2->vote_id = 2;
    $account2->finish_at = "0000-00-00 00:00:00";
    $account2->vote()->associate($vote);
    $account2->save();
    $candidate = new Candidate();
    $candidate->cname = 'Naruto Uzumaki';
    $candidate->job_title = 'yy';
開發者ID:sandy7772266,項目名稱:vote_test6,代碼行數:31,代碼來源:routes.php

示例3: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $vote = Vote::find($id);
     $vote->delete();
     $arr = ['flash' => ['type' => 'success', 'msg' => '待辦事項已刪除!']];
     return Redirect::route('home');
 }
開發者ID:sandy7772266,項目名稱:vote_1031,代碼行數:14,代碼來源:CandidateController.php

示例4: destroy

 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     $vote = Vote::find($id);
     $candidates = Candidate::where('vote_id', '=', $id)->get();
     foreach ($candidates as $candidate) {
         $candidate->accounts()->detach();
         $candidate->delete();
     }
     Account::where('vote_id', '=', $id)->delete();
     $vote->delete();
     $arr = ['flash' => ['type' => 'success', 'msg' => '待辦事項已刪除!']];
     return Redirect::route('votes_not_yet');
 }
開發者ID:sandy7772266,項目名稱:vote_1031,代碼行數:20,代碼來源:VoteController.php


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