本文整理汇总了PHP中Accounts::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Accounts::find方法的具体用法?PHP Accounts::find怎么用?PHP Accounts::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accounts
的用法示例。
在下文中一共展示了Accounts::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
/**
* Retrieves a list of models based on the current search/filter conditions.
* @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
*/
public function search($params)
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$query = Accounts::find();
$dataProvider = new ActiveDataProvider(['query' => $query]);
$this->load($params);
if (!$this->validate()) {
return $dataProvider;
}
$criteria->compare('id', $this->id, true);
$criteria->compare('text', $this->text, true);
return new CActiveDataProvider($this, array('criteria' => $criteria));
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
$input = Input::all();
$rules = array('account_name' => 'required');
$messages = array('account_name.required' => 'Please enter the account name !');
$validation = Validator::make($input, $rules, $messages);
if ($validation->passes()) {
$accounts = Accounts::find($id);
$accounts->account_name = Input::get('account_name');
//$accounts->manager_id = Session::get('manager_id');
$accounts->save();
return Redirect::to('/accounts/');
} else {
return Redirect::to('/accounts/' . $id . '/edit')->withErrors($validation);
}
}
示例3: listAction
public function listAction()
{
$list = Accounts::find();
$this->view->disable();
echo json_encode(array("data" => $list->toArray()));
}