Replace activity types and activity type categories models (#1556)

This PR adds the first step towards supporting custom activity types and custom activity type categories.
This commit is contained in:
Régis Freyd
2018-07-14 08:25:31 -04:00
committed by GitHub
parent 23a84a9dfa
commit b4ec3d96ca
42 changed files with 1421 additions and 240 deletions
@@ -155,42 +155,33 @@ class ContactsController extends Controller
if ($contact->is_partial) {
return redirect('/people');
}
$contact->load(['notes' => function ($query) {
$query->orderBy('updated_at', 'desc');
}]);
$contact->last_consulted_at = Carbon::now(auth()->user()->timezone);
$contact->save();
$relationships = $contact->relationships;
// get love relationship type
$loveRelationships = $relationships->filter(function ($item) {
return $item->relationshipType->relationshipTypeGroup->name == 'love';
});
// get family relationship type
$familyRelationships = $relationships->filter(function ($item) {
return $item->relationshipType->relationshipTypeGroup->name == 'family';
});
// get friend relationship type
$friendRelationships = $relationships->filter(function ($item) {
return $item->relationshipType->relationshipTypeGroup->name == 'friend';
});
// get work relationship type
$workRelationships = $relationships->filter(function ($item) {
return $item->relationshipType->relationshipTypeGroup->name == 'work';
});
// reminders
$reminders = $contact->reminders;
$relevantRemindersFromRelatedContacts = $contact->getBirthdayRemindersAboutRelatedContacts();
$reminders = $reminders->merge($relevantRemindersFromRelatedContacts)
->sortBy('next_expected_date');
// list of active features
$modules = $contact->account->modules()->active()->get();