Download app/Jobs/ProcessStripeCustomerJob.php from pnacorp/magicai: direct link, hf CLI and curl.
- Browser
- Download file 921 Bytes
-
https://huggingface.co/pnacorp/magicai/resolve/main/app/Jobs/ProcessStripeCustomerJob.php
- Command line
-
hf download hf://pnacorp/magicai/app/Jobs/ProcessStripeCustomerJob.php
-
curl -L -o ProcessStripeCustomerJob.php https://huggingface.co/pnacorp/magicai/resolve/main/app/Jobs/ProcessStripeCustomerJob.php
921 Bytes
| namespace App\Jobs; | |
| use Illuminate\Bus\Queueable; | |
| use Illuminate\Contracts\Queue\ShouldQueue; | |
| use Illuminate\Foundation\Bus\Dispatchable; | |
| use Illuminate\Queue\InteractsWithQueue; | |
| use Illuminate\Queue\SerializesModels; | |
| class ProcessStripeCustomerJob implements ShouldQueue | |
| { | |
| use Dispatchable; | |
| use InteractsWithQueue; | |
| use Queueable; | |
| use SerializesModels; | |
| protected $stripe; | |
| protected $user; | |
| protected $userData; | |
| /** | |
| * Create a new job instance. | |
| */ | |
| public function __construct($stripe, $user, $userData) | |
| { | |
| $this->stripe = $stripe; | |
| $this->user = $user; | |
| $this->userData = $userData; | |
| } | |
| /** | |
| * Execute the job. | |
| */ | |
| public function handle(): void | |
| { | |
| $stripeCustomer = $this->stripe->customers->create($this->userData); | |
| $this->user->stripe_id = $stripeCustomer->id; | |
| $this->user->save(); | |
| } | |
| } | |