public function testInvite() { $c = Customer::find(3); $counter = new CustomerInvitationCounter(Customer::find(1)); $before = $counter->getMonthlyCount(); // $this->assertEquals(0, $before); event(new Register($c)); $after = $counter->getMonthlyCount(); $this->assertEquals($before + 1, $after); }
public function a() { $p = 0; for ($i = 87; $i <= CustomerInformation::orderBy('id', 'desc')->first()->id; $i++) { $info = CustomerInformation::find($i); if (!$info) { continue; } if ($info->type == 'A' && ($customer_id = $info->customer_id)) { $customer = Customer::find($customer_id); $counter = new CustomerInvitationCounter($customer); print $info->name; print ' '; print $counter->getMonthlyCount(); print '<br>'; $p++; } } print '共' . $p . '人'; }
/** * @param $upper */ protected function addInvitationForCustomer($upper) { $counter = new CustomerInvitationCounter($upper); $counter->addOneInvitation(); }