本文整理汇总了PHP中app\models\Invitation类的典型用法代码示例。如果您正苦于以下问题:PHP Invitation类的具体用法?PHP Invitation怎么用?PHP Invitation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Invitation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
public function save($data)
{
if (isset($data['client'])) {
$client = $this->clientRepo->save($data['client']);
$data['client_id'] = $client->id;
}
$invoice = $this->invoiceRepo->save($data);
$client = $invoice->client;
$client->load('contacts');
$sendInvoiceIds = [];
foreach ($client->contacts as $contact) {
if ($contact->send_invoice || count($client->contacts) == 1) {
$sendInvoiceIds[] = $contact->id;
}
}
foreach ($client->contacts as $contact) {
$invitation = Invitation::scope()->whereContactId($contact->id)->whereInvoiceId($invoice->id)->first();
if (in_array($contact->id, $sendInvoiceIds) && !$invitation) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $contact->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
} elseif (!in_array($contact->id, $sendInvoiceIds) && $invitation) {
$invitation->delete();
}
}
return $invoice;
}
开发者ID:lingxuan630,项目名称:invoiceninja,代码行数:29,代码来源:InvoiceService.php
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('invitations')->truncate();
$faker = Faker\Factory::create();
for ($i = 0; $i < 50; $i++) {
Invitation::create(['title' => $faker->sentence(6), 'address' => $faker->slug(), 'latitude' => $faker->latitude, 'longitude' => $faker->longitude, 'phone' => $faker->phoneNumber, 'level' => $faker->randomElement(['Mới biết chơi', 'Khá - Giỏi', 'Chuyên nghiệp']), 'time' => $faker->randomElement(['5-7', '7-9', '6-8']), 'description' => $faker->paragraph(4), 'user_id' => $faker->randomElement(range(1, 30))]);
}
}
开发者ID:byhbt,项目名称:laravel-skeleton,代码行数:13,代码来源:InvitationTableSeeder.php
示例3: sanitize
public function sanitize()
{
$input = $this->all();
$invitation = Invitation::with('invoice.invoice_items', 'invoice.client.currency', 'invoice.client.account.currency', 'invoice.client.account.account_gateways.gateway')->where('invitation_key', '=', $this->invitation_key)->firstOrFail();
$input['invitation'] = $invitation;
$input['gateway_type'] = session($invitation->id . 'gateway_type');
$this->replace($input);
return $this->all();
}
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:9,代码来源:CreateOnlinePaymentRequest.php
示例4: getInvitation
protected function getInvitation($key)
{
$invitation = Invitation::withTrashed()->where('invitation_key', '=', $key)->first();
if ($invitation && !$invitation->is_deleted) {
return $invitation;
} else {
return null;
}
}
开发者ID:hannenijhuis,项目名称:invoiceninja,代码行数:9,代码来源:Authenticate.php
示例5: markBounced
public function markBounced($messageId, $error)
{
$invitation = Invitation::with('user', 'invoice', 'contact')->whereMessageId($messageId)->first();
if (!$invitation) {
return false;
}
$invitation->email_error = $error;
$invitation->save();
$this->userMailer->sendEmailBounced($invitation);
return true;
}
开发者ID:magicians,项目名称:invoiceninja,代码行数:11,代码来源:EmailService.php
示例6: getCredentials
/**
* Get the needed authorization credentials from the request.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function getCredentials(Request $request)
{
$credentials = $request->only('password');
$credentials['id'] = null;
$invitation_key = session('invitation_key');
if ($invitation_key) {
$invitation = Invitation::where('invitation_key', '=', $invitation_key)->first();
if ($invitation && !$invitation->is_deleted) {
$credentials['id'] = $invitation->contact_id;
}
}
return $credentials;
}
开发者ID:sseshachala,项目名称:invoiceninja,代码行数:19,代码来源:AuthController.php
示例7: save
/**
* @param array $data
* @param Invoice|null $invoice
* @return \App\Models\Invoice|Invoice|mixed
*/
public function save(array $data, Invoice $invoice = null)
{
if (isset($data['client'])) {
$canSaveClient = false;
$canViewClient = false;
$clientPublicId = array_get($data, 'client.public_id') ?: array_get($data, 'client.id');
if (empty($clientPublicId) || $clientPublicId == '-1') {
$canSaveClient = Auth::user()->can('create', ENTITY_CLIENT);
} else {
$client = Client::scope($clientPublicId)->first();
$canSaveClient = Auth::user()->can('edit', $client);
$canViewClient = Auth::user()->can('view', $client);
}
if ($canSaveClient) {
$client = $this->clientRepo->save($data['client']);
}
if ($canSaveClient || $canViewClient) {
$data['client_id'] = $client->id;
}
}
$invoice = $this->invoiceRepo->save($data, $invoice);
$client = $invoice->client;
$client->load('contacts');
$sendInvoiceIds = [];
foreach ($client->contacts as $contact) {
if ($contact->send_invoice || count($client->contacts) == 1) {
$sendInvoiceIds[] = $contact->id;
}
}
foreach ($client->contacts as $contact) {
$invitation = Invitation::scope()->whereContactId($contact->id)->whereInvoiceId($invoice->id)->first();
if (in_array($contact->id, $sendInvoiceIds) && !$invitation) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $contact->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
} elseif (!in_array($contact->id, $sendInvoiceIds) && $invitation) {
$invitation->delete();
}
}
return $invoice;
}
开发者ID:rafaelsisweb,项目名称:invoice-ninja,代码行数:48,代码来源:InvoiceService.php
示例8: create
public function create()
{
$this->validateRoute();
$user = $this->getRepository()->createOrUpdate($this->request->all());
$sandboxData = [];
if (env('APP_ENV') == 'local') {
$sandboxData['token_email'] = $user->getVerifyEmailToken();
}
$invitation = Invitation::where('email', $user->email)->get();
foreach ($invitation as $item) {
if (array_key_exists('_id', $item->project)) {
$application = Application::find($item->project['_id']);
if (!$application->getUser($user->email)) {
$application->setUser(['user_id' => (string) $user->_id, 'role' => $item->role, 'scope' => $item->scope])->save();
}
}
}
return $this->response->json($user->toArray(), Response::HTTP_CREATED, [], [], $sandboxData);
}
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:19,代码来源:UsersController.php
示例9: save
public function save($data, $checkSubPermissions = false)
{
if (isset($data['client'])) {
$can_save_client = !$checkSubPermissions;
if (!$can_save_client) {
if (empty($data['client']['public_id']) || $data['client']['public_id'] == '-1') {
$can_save_client = Client::canCreate();
} else {
$can_save_client = Client::wherePublicId($data['client']['public_id'])->first()->canEdit();
}
}
if ($can_save_client) {
$client = $this->clientRepo->save($data['client']);
$data['client_id'] = $client->id;
}
}
$invoice = $this->invoiceRepo->save($data, $checkSubPermissions);
$client = $invoice->client;
$client->load('contacts');
$sendInvoiceIds = [];
foreach ($client->contacts as $contact) {
if ($contact->send_invoice || count($client->contacts) == 1) {
$sendInvoiceIds[] = $contact->id;
}
}
foreach ($client->contacts as $contact) {
$invitation = Invitation::scope()->whereContactId($contact->id)->whereInvoiceId($invoice->id)->first();
if (in_array($contact->id, $sendInvoiceIds) && !$invitation) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $contact->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
} elseif (!in_array($contact->id, $sendInvoiceIds) && $invitation) {
$invitation->delete();
}
}
return $invoice;
}
开发者ID:sseshachala,项目名称:invoiceninja,代码行数:39,代码来源:InvoiceService.php
示例10: store
/**
* @SWG\Post(
* path="/invoices",
* tags={"invoice"},
* summary="Create an invoice",
* @SWG\Parameter(
* in="body",
* name="body",
* @SWG\Schema(ref="#/definitions/Invoice")
* ),
* @SWG\Response(
* response=200,
* description="New invoice",
* @SWG\Schema(type="object", @SWG\Items(ref="#/definitions/Invoice"))
* ),
* @SWG\Response(
* response="default",
* description="an ""unexpected"" error"
* )
* )
*/
public function store(CreateInvoiceRequest $request)
{
$data = Input::all();
$error = null;
if (isset($data['email'])) {
$email = $data['email'];
$client = Client::scope()->whereHas('contacts', function ($query) use($email) {
$query->where('email', '=', $email);
})->first();
if (!$client) {
$validator = Validator::make(['email' => $email], ['email' => 'email']);
if ($validator->fails()) {
$messages = $validator->messages();
return $messages->first();
}
$clientData = ['contact' => ['email' => $email]];
foreach (['name', 'private_notes'] as $field) {
if (isset($data[$field])) {
$clientData[$field] = $data[$field];
}
}
foreach (['first_name', 'last_name'] as $field) {
if (isset($data[$field])) {
$clientData[$field] = $data[$field];
}
}
$client = $this->clientRepo->save($clientData);
}
} else {
if (isset($data['client_id'])) {
$client = Client::scope($data['client_id'])->firstOrFail();
}
}
$data = self::prepareData($data, $client);
$data['client_id'] = $client->id;
$invoice = $this->invoiceRepo->save($data);
if (!isset($data['id'])) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $client->contacts[0]->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
}
if (isset($data['email_invoice']) && $data['email_invoice']) {
$this->mailer->sendInvoice($invoice);
}
$invoice = Invoice::scope($invoice->public_id)->with('client', 'invoice_items', 'invitations')->first();
$transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer'));
$data = $this->createItem($invoice, $transformer, 'invoice');
return $this->response($data);
}
开发者ID:j-beere,项目名称:invoiceninja,代码行数:72,代码来源:InvoiceApiController.php
示例11: saveInvoice
private function saveInvoice($publicId, $input, $entityType)
{
$invoice = $input->invoice;
$this->taxRateRepo->save($input->tax_rates);
$clientData = (array) $invoice->client;
$client = $this->clientRepo->save($invoice->client->public_id, $clientData);
$invoiceData = (array) $invoice;
$invoiceData['client_id'] = $client->id;
$invoice = $this->invoiceRepo->save($publicId, $invoiceData, $entityType);
$account = Auth::user()->account;
if ($account->invoice_taxes != $input->invoice_taxes || $account->invoice_item_taxes != $input->invoice_item_taxes || $account->invoice_design_id != $input->invoice->invoice_design_id || $account->show_item_taxes != $input->show_item_taxes) {
$account->invoice_taxes = $input->invoice_taxes;
$account->invoice_item_taxes = $input->invoice_item_taxes;
$account->invoice_design_id = $input->invoice->invoice_design_id;
$account->show_item_taxes = $input->show_item_taxes;
$account->save();
}
$client->load('contacts');
$sendInvoiceIds = [];
foreach ($client->contacts as $contact) {
if ($contact->send_invoice || count($client->contacts) == 1) {
$sendInvoiceIds[] = $contact->id;
}
}
foreach ($client->contacts as $contact) {
$invitation = Invitation::scope()->whereContactId($contact->id)->whereInvoiceId($invoice->id)->first();
if (in_array($contact->id, $sendInvoiceIds) && !$invitation) {
$invitation = Invitation::createNew();
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $contact->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
} elseif (!in_array($contact->id, $sendInvoiceIds) && $invitation) {
$invitation->delete();
}
}
return $invoice;
}
开发者ID:nafrente,项目名称:invoice-ninja,代码行数:38,代码来源:InvoiceController.php
示例12: cloneInvoice
public function cloneInvoice($invoice, $quotePublicId = null)
{
$invoice->load('invitations', 'invoice_items');
$account = $invoice->account;
$clone = Invoice::createNew($invoice);
$clone->balance = $invoice->amount;
// if the invoice prefix is diff than quote prefix, use the same number for the invoice
if (($account->invoice_number_prefix || $account->quote_number_prefix) && $account->invoice_number_prefix != $account->quote_number_prefix && $account->share_counter) {
$invoiceNumber = $invoice->invoice_number;
if ($account->quote_number_prefix && strpos($invoiceNumber, $account->quote_number_prefix) === 0) {
$invoiceNumber = substr($invoiceNumber, strlen($account->quote_number_prefix));
}
$clone->invoice_number = $account->invoice_number_prefix . $invoiceNumber;
} else {
$clone->invoice_number = $account->getNextInvoiceNumber();
}
foreach (['client_id', 'discount', 'is_amount_discount', 'invoice_date', 'po_number', 'due_date', 'is_recurring', 'frequency_id', 'start_date', 'end_date', 'terms', 'invoice_footer', 'public_notes', 'invoice_design_id', 'tax_name', 'tax_rate', 'amount', 'is_quote', 'custom_value1', 'custom_value2', 'custom_taxes1', 'custom_taxes2', 'partial'] as $field) {
$clone->{$field} = $invoice->{$field};
}
if ($quotePublicId) {
$clone->is_quote = false;
$clone->quote_id = $quotePublicId;
}
$clone->save();
if ($quotePublicId) {
$invoice->quote_invoice_id = $clone->public_id;
$invoice->save();
}
foreach ($invoice->invoice_items as $item) {
$cloneItem = InvoiceItem::createNew($invoice);
foreach (['product_id', 'product_key', 'notes', 'cost', 'qty', 'tax_name', 'tax_rate'] as $field) {
$cloneItem->{$field} = $item->{$field};
}
$clone->invoice_items()->save($cloneItem);
}
foreach ($invoice->invitations as $invitation) {
$cloneInvitation = Invitation::createNew($invoice);
$cloneInvitation->contact_id = $invitation->contact_id;
$cloneInvitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$clone->invitations()->save($cloneInvitation);
}
return $clone;
}
开发者ID:ricoa,项目名称:invoice-ninja,代码行数:43,代码来源:InvoiceRepository.php
示例13: getInvitation
private function getInvitation()
{
$invitationKey = session('invitation_key');
if (!$invitationKey) {
return false;
}
$invitation = Invitation::where('invitation_key', '=', $invitationKey)->first();
if (!$invitation || $invitation->is_deleted) {
return false;
}
$invoice = $invitation->invoice;
if (!$invoice || $invoice->is_deleted) {
return false;
}
return $invitation;
}
开发者ID:jroblesc,项目名称:invoiceninja,代码行数:16,代码来源:PublicClientController.php
示例14: boot
/**
* Bootstrap any necessary services.
*
* @return void
*/
public function boot()
{
Table::observe(new TableObserver());
User::observe(new UserObserver());
Invitation::observe(new InvitationsObserver());
}
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:11,代码来源:ObserverServiceProvider.php
示例15: showResetForm
/**
* Display the password reset view for the given token.
*
* If no token is present, display the link request form.
*
* @param \Illuminate\Http\Request $request
* @param string|null $key
* @param string|null $token
* @return \Illuminate\Http\Response
*/
public function showResetForm(Request $request, $key = null, $token = null)
{
if (is_null($token)) {
return $this->getEmail();
}
$data = compact('token');
if ($key) {
$contact = Contact::where('contact_key', '=', $key)->first();
if ($contact && !$contact->is_deleted) {
$account = $contact->account;
$data['contact_key'] = $contact->contact_key;
} else {
// Maybe it's an invitation key
$invitation = Invitation::where('invitation_key', '=', $key)->first();
if ($invitation && !$invitation->is_deleted) {
$account = $invitation->account;
$data['contact_key'] = $invitation->contact->contact_key;
}
}
if (!empty($account)) {
$data['account'] = $account;
$data['clientFontUrl'] = $account->getFontsUrl();
} else {
return \Redirect::to('/client/sessionexpired');
}
}
return view('clientauth.reset')->with($data);
}
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:38,代码来源:PasswordController.php
示例16: createNinjaInvoice
public function createNinjaInvoice($client, $clientAccount, $plan = PLAN_PRO, $term = PLAN_TERM_MONTHLY, $credit = 0, $pending_monthly = false)
{
if ($credit < 0) {
$credit = 0;
}
$plan_cost = Account::$plan_prices[$plan][$term];
$account = $this->getNinjaAccount();
$lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first();
$publicId = $lastInvoice ? $lastInvoice->public_id + 1 : 1;
$invoice = new Invoice();
$invoice->account_id = $account->id;
$invoice->user_id = $account->users()->first()->id;
$invoice->public_id = $publicId;
$invoice->client_id = $client->id;
$invoice->invoice_number = $account->getNextInvoiceNumber($invoice);
$invoice->invoice_date = $clientAccount->getRenewalDate();
$invoice->amount = $invoice->balance = $plan_cost - $credit;
$invoice->save();
if ($credit) {
$credit_item = InvoiceItem::createNew($invoice);
$credit_item->qty = 1;
$credit_item->cost = -$credit;
$credit_item->notes = trans('texts.plan_credit_description');
$credit_item->product_key = trans('texts.plan_credit_product');
$invoice->invoice_items()->save($credit_item);
}
$item = InvoiceItem::createNew($invoice);
$item->qty = 1;
$item->cost = $plan_cost;
$item->notes = trans("texts.{$plan}_plan_{$term}_description");
// Don't change this without updating the regex in PaymentService->createPayment()
$item->product_key = 'Plan - ' . ucfirst($plan) . ' (' . ucfirst($term) . ')';
$invoice->invoice_items()->save($item);
if ($pending_monthly) {
$term_end = $term == PLAN_MONTHLY ? date_create('+1 month') : date_create('+1 year');
$pending_monthly_item = InvoiceItem::createNew($invoice);
$item->qty = 1;
$pending_monthly_item->cost = 0;
$pending_monthly_item->notes = trans("texts.plan_pending_monthly", array('date', Utils::dateToString($term_end)));
// Don't change this without updating the text in PaymentService->createPayment()
$pending_monthly_item->product_key = 'Pending Monthly';
$invoice->invoice_items()->save($pending_monthly_item);
}
$invitation = new Invitation();
$invitation->account_id = $account->id;
$invitation->user_id = $account->users()->first()->id;
$invitation->public_id = $publicId;
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $client->contacts()->first()->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
return $invitation;
}
开发者ID:hannenijhuis,项目名称:invoiceninja,代码行数:53,代码来源:AccountRepository.php
示例17: createRecurringInvoice
public function createRecurringInvoice($recurInvoice)
{
$recurInvoice->load('account.timezone', 'invoice_items', 'client', 'user');
if ($recurInvoice->client->deleted_at) {
return false;
}
if (!$recurInvoice->user->confirmed) {
return false;
}
if (!$recurInvoice->shouldSendToday()) {
return false;
}
$invoice = Invoice::createNew($recurInvoice);
$invoice->client_id = $recurInvoice->client_id;
$invoice->recurring_invoice_id = $recurInvoice->id;
$invoice->invoice_number = 'R' . $recurInvoice->account->getNextInvoiceNumber($recurInvoice);
$invoice->amount = $recurInvoice->amount;
$invoice->balance = $recurInvoice->amount;
$invoice->invoice_date = date_create()->format('Y-m-d');
$invoice->discount = $recurInvoice->discount;
$invoice->po_number = $recurInvoice->po_number;
$invoice->public_notes = Utils::processVariables($recurInvoice->public_notes);
$invoice->terms = Utils::processVariables($recurInvoice->terms);
$invoice->invoice_footer = Utils::processVariables($recurInvoice->invoice_footer);
$invoice->tax_name = $recurInvoice->tax_name;
$invoice->tax_rate = $recurInvoice->tax_rate;
$invoice->invoice_design_id = $recurInvoice->invoice_design_id;
$invoice->custom_value1 = $recurInvoice->custom_value1 ?: 0;
$invoice->custom_value2 = $recurInvoice->custom_value2 ?: 0;
$invoice->custom_taxes1 = $recurInvoice->custom_taxes1 ?: 0;
$invoice->custom_taxes2 = $recurInvoice->custom_taxes2 ?: 0;
$invoice->custom_text_value1 = $recurInvoice->custom_text_value1;
$invoice->custom_text_value2 = $recurInvoice->custom_text_value2;
$invoice->is_amount_discount = $recurInvoice->is_amount_discount;
if ($invoice->client->payment_terms != 0) {
$days = $invoice->client->payment_terms;
if ($days == -1) {
$days = 0;
}
$invoice->due_date = date_create()->modify($days . ' day')->format('Y-m-d');
}
$invoice->save();
foreach ($recurInvoice->invoice_items as $recurItem) {
$item = InvoiceItem::createNew($recurItem);
$item->product_id = $recurItem->product_id;
$item->qty = $recurItem->qty;
$item->cost = $recurItem->cost;
$item->notes = Utils::processVariables($recurItem->notes);
$item->product_key = Utils::processVariables($recurItem->product_key);
$item->tax_name = $recurItem->tax_name;
$item->tax_rate = $recurItem->tax_rate;
$invoice->invoice_items()->save($item);
}
foreach ($recurInvoice->invitations as $recurInvitation) {
$invitation = Invitation::createNew($recurInvitation);
$invitation->contact_id = $recurInvitation->contact_id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invoice->invitations()->save($invitation);
}
$recurInvoice->last_sent_date = date('Y-m-d');
$recurInvoice->save();
if ($recurInvoice->auto_bill) {
if ($this->paymentService->autoBillInvoice($invoice)) {
// update the invoice reference to match its actual state
// this is to ensure a 'payment received' email is sent
$invoice->invoice_status_id = INVOICE_STATUS_PAID;
}
}
return $invoice;
}
开发者ID:rnaby,项目名称:invoiceninja,代码行数:70,代码来源:InvoiceRepository.php
示例18: createNinjaInvoice
public function createNinjaInvoice($client)
{
$account = $this->getNinjaAccount();
$lastInvoice = Invoice::withTrashed()->whereAccountId($account->id)->orderBy('public_id', 'DESC')->first();
$publicId = $lastInvoice ? $lastInvoice->public_id + 1 : 1;
$invoice = new Invoice();
$invoice->account_id = $account->id;
$invoice->user_id = $account->users()->first()->id;
$invoice->public_id = $publicId;
$invoice->client_id = $client->id;
$invoice->invoice_number = $account->getNextInvoiceNumber();
$invoice->invoice_date = date_create()->format('Y-m-d');
$invoice->amount = PRO_PLAN_PRICE;
$invoice->balance = PRO_PLAN_PRICE;
$invoice->save();
$item = new InvoiceItem();
$item->account_id = $account->id;
$item->user_id = $account->users()->first()->id;
$item->public_id = $publicId;
$item->qty = 1;
$item->cost = PRO_PLAN_PRICE;
$item->notes = trans('texts.pro_plan_description');
$item->product_key = trans('texts.pro_plan_product');
$invoice->invoice_items()->save($item);
$invitation = new Invitation();
$invitation->account_id = $account->id;
$invitation->user_id = $account->users()->first()->id;
$invitation->public_id = $publicId;
$invitation->invoice_id = $invoice->id;
$invitation->contact_id = $client->contacts()->first()->id;
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
$invitation->save();
return $invitation;
}
开发者ID:rasata,项目名称:invoice-ninja,代码行数:34,代码来源:AccountRepository.php
示例19: transform
public function transform(Invitation $invitation)
{
$invitation->setRelation('account', $this->account);
return ['id' => (int) $invitation->public_id, 'key' => $invitation->getName(), 'status' => $invitation->getStatus(), 'link' => $invitation->getLink(), 'sent_date' => $invitation->sent_date, 'viewed_date' => $invitation->sent_date];
}
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:5,代码来源:InvitationTransformer.php
示例20: approve
public function approve($invitationKey)
{
$invitation = Invitation::with('invoice.invoice_items', 'invoice.invitations')->where('invitation_key', '=', $invitationKey)->firstOrFail();
$invoice = $invitation->invoice;
if ($invoice->is_quote && !$invoice->quote_invoice_id) {
Event::fire(new QuoteApproved($invoice));
Activity::approveQuote($invitation);
$invoice = $this->invoiceRepo->cloneInvoice($invoice, $invoice->id);
Session::flash('message', trans('texts.converted_to_invoice'));
foreach ($invoice->invitations as $invitationClone) {
if ($invitation->contact_id == $invitationClone->contact_id) {
$invitationKey = $invitationClone->invitation_key;
}
}
}
return Redirect::to("view/{$invitationKey}");
}
开发者ID:biggtfish,项目名称:invoiceNinja-1,代码行数:17,代码来源:QuoteController.php
注:本文中的app\models\Invitation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论