本文整理汇总了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);
}
示例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';
示例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');
}
示例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');
}