本文整理汇总了PHP中Invitation::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Invitation::where方法的具体用法?PHP Invitation::where怎么用?PHP Invitation::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invitation
的用法示例。
在下文中一共展示了Invitation::where方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getClientDatatable
public function getClientDatatable()
{
$search = Input::get('sSearch');
$invitationKey = Session::get('invitation_key');
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->with('contact.client')->first();
if (!$invitation) {
return [];
}
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted) {
return [];
}
$payments = $this->paymentRepo->findForContact($invitation->contact->id, Input::get('sSearch'));
return Datatable::query($payments)->addColumn('invoice_number', function ($model) {
return $model->invitation_key ? link_to('/view/' . $model->invitation_key, $model->invoice_number) : $model->invoice_number;
})->addColumn('transaction_reference', function ($model) {
return $model->transaction_reference ? $model->transaction_reference : '<i>Manual entry</i>';
})->addColumn('payment_type', function ($model) {
return $model->payment_type ? $model->payment_type : ($model->account_gateway_id ? '<i>Online payment</i>' : '');
})->addColumn('amount', function ($model) {
return Utils::formatMoney($model->amount, $model->currency_id);
})->addColumn('payment_date', function ($model) {
return Utils::dateToString($model->payment_date);
})->make();
}
示例2: create
/**
* Show the form for creating a new resource.
*
* @param string $code
* @return Response
*/
public function create($code = null)
{
if ($code != null && is_null(Invitation::where('code', '=', $code)->where('used_by', '=', '0')->first())) {
return View::make('admin.login.register')->withErrors(array('mainError' => 'Кодът Ви е грешен. Ако мислите, че няма грешка, моля въведете кода и имейла по-отдолу.'));
} elseif (!is_null(Invitation::where('code', '=', $code)->where('used_by', '=', '0')->first())) {
$email = Invitation::where('code', '=', $code)->first()->email;
return View::make('admin.login.register')->with('code', $code)->with('email', $email);
}
return View::make('admin.login.register');
}
示例3: getClientDatatable
public function getClientDatatable()
{
$search = Input::get('sSearch');
$invitationKey = Session::get('invitation_key');
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->first();
if (!$invitation || $invitation->is_deleted) {
return [];
}
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted) {
return [];
}
return $this->invoiceRepo->getClientDatatable($invitation->contact_id, ENTITY_QUOTE, $search);
}
示例4: view
public function view($invitationKey)
{
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->firstOrFail();
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted) {
return View::make('invoices.deleted');
}
if ($invoice->is_quote && $invoice->quote_invoice_id) {
$invoice = Invoice::scope($invoice->quote_invoice_id, $invoice->account_id)->firstOrFail();
if (!$invoice || $invoice->is_deleted) {
return View::make('invoices.deleted');
}
}
$invoice->load('user', 'invoice_items', 'invoice_design', 'account.country', 'client.contacts', 'client.country');
$client = $invoice->client;
if (!$client || $client->is_deleted) {
return View::make('invoices.deleted');
}
if (!Session::has($invitationKey) && (!Auth::check() || Auth::user()->account_id != $invoice->account_id)) {
Activity::viewInvoice($invitation);
Event::fire('invoice.viewed', $invoice);
}
Session::set($invitationKey, true);
Session::set('invitation_key', $invitationKey);
Session::set('white_label', $client->account->isWhiteLabel());
$client->account->loadLocalizationSettings();
$invoice->invoice_date = Utils::fromSqlDate($invoice->invoice_date);
$invoice->due_date = Utils::fromSqlDate($invoice->due_date);
$invoice->is_pro = $client->account->isPro();
$contact = $invitation->contact;
$contact->setVisible(['first_name', 'last_name', 'email', 'phone']);
$data = array('showClientHeader' => true, 'showBreadcrumbs' => false, 'hideLogo' => $client->account->isWhiteLabel(), 'invoice' => $invoice->hidePrivateFields(), 'invitation' => $invitation, 'invoiceLabels' => $client->account->getInvoiceLabels(), 'contact' => $contact);
return View::make('invoices.view', $data);
}
示例5: validate
public function validate()
{
if (is_null(Invitation::where('code', '=', $this->invitation)->where('used_by', '=', '0')->first())) {
throw new ValidationException(null, null, null, array('invitation' => "Грешен код."));
} else {
return true;
}
}
示例6: inviteUser
/**
* @api {post} /groups/:idGroup/users/:id/invite Invite User
* @apiName Invite User by Admin
* @apiGroup Group
* @apiHeader (Header) {String} X_Authorization Authorization value.
* @apiParam (url Parameter) {Number} idGroup Group unique ID.
* @apiParam (url Parameter) {Number} id Users unique ID. The operator's id, usually the admin of the group.
* @apiParam {String} email User's email.
*
* @apiError 400 Input Invalid. This will happen if the param is missing or not the valid format.
* @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 User already enrolled to this group.
* @apiError 412 The User are not in the same company as the manager.
*
* @apiSuccess 200 New Invitation is created and email sent out.
* @apiSuccess 203 The Invitation to this group already exist. No new recored created, no email send out.
*/
public static function inviteUser($idGroup, $idUser)
{
$app = \Slim\Slim::getInstance();
$request = $app->request->post();
$validata = $app->validata;
$validator = $validata::key('email', $validata::email()->notEmpty());
if (!$validator->validate($request)) {
$app->halt("400", json_encode("Input Invalid"));
}
$role = self::getRole($idGroup, $idUser);
if ($role->id < 3) {
$app->halt("403", json_encode("permission denied"));
}
$user = User::where('email', '=', $request['email'])->first();
if (!$user) {
$app->halt("404", json_encode("User not found."));
}
if (self::isMember($idGroup, $user->id)) {
$app->halt("409", json_encode("User already in group."));
}
//self::sameCompanyRestriction($idGroup,$user->id);
$invitation = Invitation::where('receiver_id', '=', $user->id)->where('group_id', '=', $idGroup)->first();
if ($invitation) {
$invitation->invited_at = date('Y-m-d H:i:s');
$invitation->group_jointed_at = null;
$invitation->save();
$app->halt("202", json_encode("This user already has the same group invitation in record."));
}
User::find($user->id)->invitations()->create(['sender_id' => $idUser, 'group_id' => $idGroup, 'invited_at' => date('Y-m-d H:i:s')]);
EmailController::noticificationReminder($user->id);
}