本文整理汇总了PHP中event::find方法的典型用法代码示例。如果您正苦于以下问题:PHP event::find方法的具体用法?PHP event::find怎么用?PHP event::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类event
的用法示例。
在下文中一共展示了event::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$event = event::find($id);
$input = Request::all();
$event->update(['name' => $input['name']]);
return redirect()->action('EventsController@index');
}
示例2: postViewRule
public function postViewRule()
{
$input = Input::only('event_id');
$event = event::find($input['event_id']);
$errors = Events::EventWithRules($input);
if ($errors) {
return $errors;
}
$rules = $event->rules()->paginate(10);
return $this->make('tableRulesForEvents', array('rules' => $rules));
}
示例3: actionView
public function actionView($id)
{
$model = event::find()->where(['id' => $id])->one();
if (is_null($model)) {
// 404 HTTP status will be returned
throw new \yii\web\NotFoundHttpException();
}
/*
* Количество просмотров считается отдельно для русской и отдельно для английской версии
*/
$Event_ru = Event_ru::find()->where(['event_id' => $id])->one();
$Event_en = Event_en::find()->where(['event_id' => $id])->one();
if (Yii::$app->language == 'en') {
$Event_en->visited++;
$Event_en->save();
} elseif (Yii::$app->language == 'ru') {
$Event_ru->visited++;
$Event_ru->save();
}
$photos = event_photo::find()->where(['event_id' => $id])->all();
//$photos = events_Photo::find(array('events_id' => $id));
return $this->render('view', ['model' => $model, 'photos' => $photos]);
}
示例4: del
function del($id)
{
$news = event::find($id);
return $news->delete();
}