| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 31 | 
| Code Lines | 20 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 16 | public function handle() | ||
| 17 |     { | ||
| 18 |         Paystack::setApiKey(config('dashboard.tiles.paystack.secret_key', env('PAYSTACK_SECRET'))); | ||
|  | |||
| 19 | |||
| 20 |         $this->info('Fetching Paystack customers ...'); | ||
| 21 | |||
| 22 | $customers = Customer::list( | ||
| 23 |             config('dashboard.tiles.paystack.customers.params') ?? [ | ||
| 24 | 'perPage' => 5, | ||
| 25 | ] | ||
| 26 | ); | ||
| 27 | |||
| 28 | $customers = collect($customers->data) | ||
| 29 |             ->map(function ($customer) { | ||
| 30 | return [ | ||
| 31 | 'first_name' => $customer->first_name, | ||
| 32 | 'last_name' => $customer->last_name, | ||
| 33 | 'customer_code' => $customer->customer_code, | ||
| 34 | 'email' => $customer->email, | ||
| 35 | 'id' => $customer->id, | ||
| 36 | 'createdAt' => Carbon::parse($customer->createdAt) | ||
| 37 |                         ->setTimezone('UTC') | ||
| 38 |                         ->format("d.m.Y"), | ||
| 39 | ]; | ||
| 40 | })->toArray(); | ||
| 41 | |||
| 42 | PaystackCustomersStore::make()->setData($customers); | ||
| 43 | |||
| 44 |         $this->info('All done!'); | ||
| 45 | |||
| 46 | return 0; | ||
| 47 | } | ||
| 49 |