当前位置: 首页>>代码示例>>PHP>>正文


PHP Invoice::getPrivateId方法代码示例

本文整理汇总了PHP中app\models\Invoice::getPrivateId方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::getPrivateId方法的具体用法?PHP Invoice::getPrivateId怎么用?PHP Invoice::getPrivateId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Invoice的用法示例。


在下文中一共展示了Invoice::getPrivateId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save($publicId = null, $input)
 {
     if ($publicId) {
         $payment = Payment::scope($publicId)->firstOrFail();
     } else {
         $payment = Payment::createNew();
     }
     $paymentTypeId = $input['payment_type_id'] ? $input['payment_type_id'] : null;
     $payment->payment_type_id = $paymentTypeId;
     $payment->payment_date = Utils::toSqlDate($input['payment_date']);
     $payment->transaction_reference = trim($input['transaction_reference']);
     if (!$publicId) {
         $clientId = Client::getPrivateId($input['client']);
         $amount = Utils::parseFloat($input['amount']);
         if ($paymentTypeId == PAYMENT_TYPE_CREDIT) {
             $credits = Credit::scope()->where('client_id', '=', $clientId)->where('balance', '>', 0)->orderBy('created_at')->get();
             $applied = 0;
             foreach ($credits as $credit) {
                 $applied += $credit->apply($amount);
                 if ($applied >= $amount) {
                     break;
                 }
             }
         }
         $payment->client_id = $clientId;
         $payment->invoice_id = isset($input['invoice']) && $input['invoice'] != "-1" ? Invoice::getPrivateId($input['invoice']) : null;
         $payment->amount = $amount;
     }
     $payment->save();
     return $payment;
 }
开发者ID:biggtfish,项目名称:invoiceNinja-1,代码行数:31,代码来源:PaymentRepository.php

示例2: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if ($this->action == ACTION_ARCHIVE) {
         return [];
     }
     $publicId = $this->route('invoices');
     $invoiceId = Invoice::getPrivateId($publicId);
     $rules = ['invoice_items' => 'valid_invoice_items', 'invoice_number' => 'unique:invoices,invoice_number,' . $invoiceId . ',id,account_id,' . Auth::user()->account_id, 'discount' => 'positive'];
     return $rules;
 }
开发者ID:joshuadwire,项目名称:invoiceninja,代码行数:15,代码来源:UpdateInvoiceRequest.php

示例3: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $publicId = Request::get('public_id');
     $invoiceId = $publicId ? Invoice::getPrivateId($publicId) : '';
     $rules = ['client.contacts' => 'valid_contacts', 'invoice_number' => 'required|unique:invoices,invoice_number,' . $invoiceId . ',id,account_id,' . Auth::user()->account_id, 'discount' => 'positive'];
     /* There's a problem parsing the dates
        if (Request::get('is_recurring') && Request::get('start_date') && Request::get('end_date')) {
            $rules['end_date'] = 'after' . Request::get('start_date');
        }
        */
     return $rules;
 }
开发者ID:n-a-m-e,项目名称:invoice-ninja,代码行数:17,代码来源:SaveInvoiceRequest.php

示例4: getErrors

 public function getErrors($input)
 {
     $contact = (array) $input->client->contacts[0];
     $rules = ['email' => 'email|required_without:first_name', 'first_name' => 'required_without:email'];
     $validator = \Validator::make($contact, $rules);
     if ($validator->fails()) {
         return $validator;
     }
     $invoice = (array) $input;
     $invoiceId = isset($invoice['public_id']) && $invoice['public_id'] ? Invoice::getPrivateId($invoice['public_id']) : null;
     $rules = ['invoice_number' => 'required|unique:invoices,invoice_number,' . $invoiceId . ',id,account_id,' . \Auth::user()->account_id, 'discount' => 'positive'];
     if ($invoice['is_recurring'] && $invoice['start_date'] && $invoice['end_date']) {
         $rules['end_date'] = 'after:' . $invoice['start_date'];
     }
     $validator = \Validator::make($invoice, $rules);
     if ($validator->fails()) {
         return $validator;
     }
     return false;
 }
开发者ID:hanspoelmans,项目名称:invoice-ninja,代码行数:20,代码来源:InvoiceRepository.php

示例5: store

 public function store(CreatePaymentRequest $request)
 {
     $input = $request->input();
     $input['invoice_id'] = Invoice::getPrivateId($input['invoice']);
     $input['client_id'] = Client::getPrivateId($input['client']);
     $payment = $this->paymentRepo->save($input);
     if (Input::get('email_receipt')) {
         $this->contactMailer->sendPaymentConfirmation($payment);
         Session::flash('message', trans('texts.created_payment_emailed_client'));
     } else {
         Session::flash('message', trans('texts.created_payment'));
     }
     return redirect()->to($payment->client->getRoute());
 }
开发者ID:joshuadwire,项目名称:invoiceninja,代码行数:14,代码来源:PaymentController.php


注:本文中的app\models\Invoice::getPrivateId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。