JellyBool / laravel-vue-pagination

Pagination with Vue and Laravel
147 stars 24 forks source link

Cashier Invoices #1

Closed lstables closed 8 years ago

lstables commented 8 years ago

Wondered if you would test this out with the Laravel Cashier 6.0 invoices collection.

JellyBool commented 8 years ago

Emmm...I was suck with my college homework lately... I will try it as soon as i can . Sorry about that

lstables commented 8 years ago

Lol ok no worries when your ready, no rush just wondered thats all.

lstables commented 8 years ago

FYI the invoices method looks like:

public function invoices($includePending = false, $parameters = [])
    {
        $invoices = [];

        $parameters = array_merge(['limit' => 24], $parameters);

        $stripeInvoices = $this->asStripeCustomer()->invoices($parameters);

        // Here we will loop through the Stripe invoices and create our own custom Invoice
        // instances that have more helper methods and are generally more convenient to
        // work with than the plain Stripe objects are. Then, we'll return the array.
        if (! is_null($stripeInvoices)) {
            foreach ($stripeInvoices->data as $invoice) {
                if ($invoice->paid || $includePending) {
                    $invoices[] = new Invoice($this, $invoice);
                }
            }
        }

        return new Collection($invoices);
    }

You can pass params like so $user->invoices(false, ['limit' => '5']); which limits to 5 but ideally could do with pagination.