當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。