本文整理汇总了PHP中Key::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Key::find方法的具体用法?PHP Key::find怎么用?PHP Key::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Key
的用法示例。
在下文中一共展示了Key::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_do_delete
public function action_do_delete($key_id)
{
$key = Key::find($key_id);
if (empty($key)) {
return Redirect::back();
}
$key->delete();
return Redirect::to('key/list')->with('success', 'API Key deleted!');
}
示例2: getUserKeys
/**
* Get a map of id => name for the keys belonging to $this->user
*
* @return array
*/
protected function getUserKeys()
{
$keyMap = [];
$keys = Key::find(['user_id = :user_id:', 'bind' => ['user_id' => $this->user->id]]);
foreach ($keys as $key) {
$keyMap[$key->id] = $key->name;
}
return $keyMap;
}
示例3: postDelete
public function postDelete($key_id)
{
$key = Key::find($key_id);
if (empty($key)) {
return Redirect::to('key/list')->withErrors(new MessageBag(array('Platform Key not found')));
}
$key->delete();
Cache::forget('keys');
return Redirect::to('key/list')->with('success', 'API Key deleted!');
}