JohnRivs

JohnRivs

Member Since 5 Years Ago

Experience Points
104,760
Total
Experience

240 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
1040
Lessons
Completed
Best Reply Awards
37
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 21
104,760 XP
Oct
11
2 months ago
Activity icon

Replied to What's Your Preferred Approach For Structuring Products And Plans In Stripe?

Forgot to mention Stripe in the title. Fixed it.

Oct
10
2 months ago
Activity icon

Started a new Conversation What's Your Preferred Approach For Structuring Products And Plans In Stripe?

I've been asking this around hoping to get some insight.

Oct
07
2 months ago
Activity icon

Replied to [Cashier/Stripe] How Can I Know The Payment Method Used For A Subscription?

@nakov Well.. I got a problem then because I asked Dries Vints and unless I'm understanding either of you wrong, what he says is in opposition to what you just explained.

Activity icon

Replied to [Cashier/Stripe] How Can I Know The Payment Method Used For A Subscription?

@nakov I did pass ['customer' => $user->stripe_id] to all(). I also tried fetching subscriptions one by one.

I can't just compare the customer's current default payment method to the one in the request. Imagine a customer uses payment method A to subscribe to product 1, then adds a new default payment method (B) and uses it to subscribe to product 2 and finally tries to delete payment method A. "Are you trying to delete the current default payment method?" is not enough because in this situation, even though payment method A is no longer the default one I shouldn't allow payment method A to be deleted, since it's being used for active subscription to product 1.

Activity icon

Replied to [Cashier/Stripe] How Can I Know The Payment Method Used For A Subscription?

I just gave it a try and default_payment_method is returning null.

I create the customer, add a payment method, add a new one and set it as default, fetch all subscriptions, loop over them and output default_payment_method. Not sure what I'm doing wrong.

Notice the active status.

Activity icon

Replied to Cashier's Service Provider Not Registered During Testing.

Turns out clearing the cache with artisan was OK when using the browser but it wouldn't work on cache for PHPUnit. This change got rid of the problem.

Activity icon

Replied to [Cashier/Stripe] How Can I Know The Payment Method Used For A Subscription?

@nakov Oh wow, I was looking at all these IDs in the object examples and I expected one of them to start with pm_. Should've read slowly and I would've seen default_payment_method.

So the idea would be something like this:

$subscriptions = \Stripe\Subscription::all();

foreach ($subscriptions as $subscription) {
    if ($subscription->default_payment_method === request('payment_method')) {
        // can't delete
    }
}
Activity icon

Started a new Conversation [Cashier/Stripe] How Can I Know The Payment Method Used For A Subscription?

I want to let my users delete a payment method as long as it's not being used for an active subscription. From what I understand, Cashier doesn't offer this out of the box and I'd imagine I'd have to go to Stripe's API.

I looked at the subscription and payment method objects but they don't seem to reference each other. Is there a way to ask "what subscriptions is a given payment method being used for" or "what payment method is being used for a given subscription"?

Oct
03
2 months ago
Activity icon

Started a new Conversation Cashier's Service Provider Not Registered During Testing.

I'm trying to test a scenario where IncompletePayment is thrown and the user is redirected to the cashier.payment route. When I php artisan list, I can see the route but during testing, this is what I get InvalidArgumentException: Route [cashier.payment] not defined. It doesn't seem like CashierServiceProvider is being called.

I'm also having other problems like when cancelling a subscription. Whether I override CASHIER_MODEL or keep it as App\User, this line returns null.

I created a new Laravel app and added Cashier. The service provider is being registered during testing as expected. When I run a test in the real app where I dd(Route::getRoutes()), Cashier is not there.

Is there a way to debug why a package's service provider wouldn't register during testing?