本文整理汇总了PHP中Invitation::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::find方法的具体用法?PHP Invitation::find怎么用?PHP Invitation::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invitation
的用法示例。
在下文中一共展示了Invitation::find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$invitation = Invitation::find($id);
if (!is_null($invitation)) {
if ($invitation->delete()) {
return Redirect::route('admin.invitations.index')->withErrors(array('mainSuccess' => 'Поканата е успешно изтрита.'));
} else {
return Redirect::route('admin.invitations.index')->withErrors(array('mainError' => 'Грешка с базата данни.'));
}
} else {
return Redirect::route('admin.invitations.index')->withErrors(array('mainError' => 'Поканата не е намерена.'));
}
}
示例2: emailChanged
function emailChanged()
{
$invites = new Invitation();
$invites->address = $this->email;
$invites->address_type = 'email';
if ($invites->find()) {
while ($invites->fetch()) {
$other = User::staticGet($invites->user_id);
subs_subscribe_to($other, $this);
}
}
}
示例3: emailChanged
function emailChanged()
{
$invites = new Invitation();
$invites->address = $this->email;
$invites->address_type = 'email';
if ($invites->find()) {
while ($invites->fetch()) {
try {
$other = Profile::getKV('id', $invites->user_id);
if (!$other instanceof Profile) {
// remove when getKV throws exceptions
continue;
}
Subscription::start($other, $this->getProfile());
} catch (Exception $e) {
continue;
}
}
}
}
示例4: bindEvent
public function bindEvent($user)
{
$this->loadModel('Invitation');
$invitation = new Invitation();
$conditions = ['Invitation.email' => $user['username']];
$result = $invitation->find('first', compact('conditions'));
if (!empty($result)) {
$this->loadModel('UserEvent');
$this->loadModel('UserEventShare');
$userEvent = new UserEvent();
$userEventShare = new UserEventShare();
$event = $result['UserEvent'];
$invitation = $result['Invitation'];
$ueShare = array('user_id' => $user['id'], 'user_event_id' => $invitation['object_id']);
$event['recipient_id'] = $user['id'];
$userEvent->create();
$userEvent->set($event);
$userEvent->save();
$userEventShare->create();
$userEventShare->set($ueShare);
$userEventShare->save();
}
}
示例5: declineInvite
/**
* @api {delete} /invitations/:id/users/:idUser/decline Decline group invitation
* @apiName Decline group invitation
* @apiGroup Invitation
* @apiHeader (Header) {String} X_Authorization Authorization value.
* @apiParam (url Parameter) {Number} id Invitation unique ID.
* @apiParam (url Parameter) {Number} idUser Users unique ID.
*
* @apiError 404 Not found. This will happen if the role id/user id/group id is not in our system.
* @apiError 401 Not authorized. This will happen if the header value is not attached.
* @apiError 409 The link expired.
*/
public static function declineInvite($id, $idUser)
{
$app = \Slim\Slim::getInstance();
$invitation = Invitation::find($id);
if (!$invitation) {
$app->halt('404');
}
if ($invitation->receiver_id != $idUser) {
$app->halt('401');
}
if ($invitation->group_jointed_at) {
$app->halt('409', json_encode('expired'));
}
//self::attachUser($invitation->group_id,$invitation->receiver_id);
$invitation->delete();
}