| Conditions | 1 |
| Paths | 1 |
| Total Lines | 28 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | public function handle() |
||
| 16 | { |
||
| 17 | $stripe = new StripeClient( |
||
| 18 | config('dashboard.tiles.stripe.secret_key', env('STRIPE_SECRET')) |
||
|
|
|||
| 19 | ); |
||
| 20 | |||
| 21 | $this->info('Fetching Stripe customers ...'); |
||
| 22 | |||
| 23 | $customers = $stripe->customers->all( |
||
| 24 | config('dashboard.tiles.stripe.customers.params') ?? ['limit' => 5] |
||
| 25 | ); |
||
| 26 | |||
| 27 | $customers = collect($customers->data) |
||
| 28 | ->map(function ($customer) { |
||
| 29 | return [ |
||
| 30 | 'name' => $customer->name, |
||
| 31 | 'customer_id' => $customer->id, |
||
| 32 | 'email' => $customer->email, |
||
| 33 | 'createdAt' => Carbon::parse($customer->created) |
||
| 34 | ->format("d.m.Y"), |
||
| 35 | ]; |
||
| 36 | })->toArray(); |
||
| 37 | |||
| 38 | StripeCustomersStore::make()->setData($customers); |
||
| 39 | |||
| 40 | $this->info('All done!'); |
||
| 41 | |||
| 42 | return 0; |
||
| 43 | } |
||
| 45 |