Support the ongoing development of Laravel.io →
posted 10 years ago
Packages

I'm working on a site selling service customer to customer. The workflow I've thought about is:

The user 'A' see the good service from user 'B' user 'A' buy the service paying the site and I manage this with:

public function store(Request $request) {
        $stripeToken = $request->input('stripeToken');
        $email = Auth::user()->email;
        $charge = $request->input('charge');
        //validation
        if($stripeToken){
            // Do I have to do this check  ?
            if(!Auth::user()->subscribed()){
                Auth::user()
                    ->subscription('monthly')
                        ->create($stripeToken, [
                            'email' => $email
                ]);
                }
                Auth::user()->charge($charge, [
                'receipt_email' => $email,
            ]); 
            return 'Done';  
        }
        return 'Failed';    
}

The site take the percentage

// the code is trivial

now I've to give money to 'B'

// What's the way/code to manage this ?

Thanks in advance

Last updated 3 years ago.
0

I would suggest you to watch this series on using command bus. https://laracasts.com/lessons/laravel-5-commands

0

Sign in to participate in this thread!

Eventy

Your banner here too?

whisher whisher Joined 9 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.