public function stripe() { $user = User::whereType('client')->get()->random(8); $faker = $this->faker; foreach ($user as $u) { try { $amount = rand(5, 50); $payment = UserPayment::create(['user_id' => $u->id, 'merchant' => 'stripe', 'transaction_number' => rand(1000000, 2000000), 'title' => 'refill', 'amount' => $amount, 'currency' => 'USD']); LogMapper::log('payment', $amount, 'refilled', ['payment_id' => $payment->id, 'merchant' => 'stripe']); NotificationMapper::refilled($payment); } catch (\Exception $e) { dd($e->getTraceAsString()); } } }
public static function payments(User $user, $limit = 50) { return UserPayment::whereUserId($user->id)->paginate($limit); }