public function getInitials() { $initials = []; foreach (Contact::all() as $contact) { $initials[] = strtoupper(substr($contact->nickname, 0, 1)); } sort($initials); return array_unique($initials); }
public function testDelete() { $idDelete = Contact::all()->last()['id']; factory(\App\Entities\Company::class)->create(['contact_id' => $idDelete]); $this->seeInDatabase('contacts', ['id' => $idDelete]); $this->visit('/contact/destroy/' . $idDelete)->seePageIs('/contact')->see('Este registro possui refer'); $this->seeIsNotSoftDeletedInDatabase('contacts', ['id' => $idDelete]); $contact = Contact::find($idDelete); $contact->companies()->delete(); $contact->entries()->delete(); $contact->models()->delete(); $contact->tripsDriver()->delete(); $contact->tripsVendor()->delete(); $contact->users()->delete(); $this->seeInDatabase('contacts', ['id' => $idDelete]); $this->visit('/contact/destroy/' . $idDelete); $this->seeIsSoftDeletedInDatabase('contacts', ['id' => $idDelete]); }
public function testDeleteExecutive() { $this->get('/contact/destroy/' . Contact::all()->last()['id'])->assertResponseStatus(302); }