Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ public function populateContactFieldTypeTable($ignoreMigratedTable = false)

foreach ($defaultContactFieldTypes as $defaultContactFieldType) {
if (! $ignoreMigratedTable || $defaultContactFieldType->migrated == 0) {
$contactFieldType = ContactFieldType::create([
ContactFieldType::create([
'account_id' => $this->id,
'name' => $defaultContactFieldType->name,
'fontawesome_icon' => (is_null($defaultContactFieldType->fontawesome_icon) ? null : $defaultContactFieldType->fontawesome_icon),
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ImportCSV.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function handle()
$birthdate = new \DateTime(strtotime($data[14]));

$specialDate = $contact->setSpecialDate('birthdate', $birthdate->format('Y'), $birthdate->format('m'), $birthdate->format('d'));
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}

$imported++;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ImportVCards.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function handle(Filesystem $filesystem)
$birthdate = new \DateTime((string) $vcard->BDAY);

$specialDate = $contact->setSpecialDate('birthdate', $birthdate->format('Y'), $birthdate->format('m'), $birthdate->format('d'));
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}

if ($vcard->ADR) {
Expand Down
2 changes: 0 additions & 2 deletions app/Console/Commands/SendNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public function handle()
continue;
}

$account = $notification->contact->account;

ScheduleNotification::dispatch($notification);
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ public function updateGravatar()
// won't make constant call to gravatar to load the avatar on every
// page load.
$response = $this->getGravatar(250);
if ($response != false and is_string($response)) {
if ($response !== false && is_string($response)) {
$this->gravatar_url = $response;
} else {
$this->gravatar_url = null;
Expand Down
4 changes: 1 addition & 3 deletions app/Helpers/DateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@ public static function getListOfHours()
*/
public static function getDateMinusGivenNumberOfDays(Carbon $date, int $numberOfDaysBefore)
{
$olderDate = $date->subDays($numberOfDaysBefore);

return $olderDate;
return $date->subDays($numberOfDaysBefore);
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiAddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -108,7 +108,7 @@ public function update(Request $request, $addressId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiCallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -111,7 +111,7 @@ public function update(Request $request, $callId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
16 changes: 8 additions & 8 deletions app/Http/Controllers/Api/ApiContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function store(Request $request)
// user is authorized to access
if ($request->get('first_met_through_contact_id')) {
try {
$contactFirstMetThrough = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('first_met_through_contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -157,7 +157,7 @@ public function store(Request $request)
$specialDate = $contact->setSpecialDate('birthdate', 0, $date->month, $date->day);
} else {
$specialDate = $contact->setSpecialDate('birthdate', $date->year, $date->month, $date->day);
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}
} elseif ($request->get('birthdate_is_age_based')) {
$specialDate = $contact->setSpecialDateFromAge('birthdate', $request->input('birthdate_age'));
Expand All @@ -173,7 +173,7 @@ public function store(Request $request)
$specialDate = $contact->setSpecialDate('first_met', 0, $date->month, $date->day);
} else {
$specialDate = $contact->setSpecialDate('first_met', $date->year, $date->month, $date->day);
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}
} elseif ($request->get('first_met_date_is_age_based')) {
$specialDate = $contact->setSpecialDateFromAge('first_met', $request->input('first_met_date_age'));
Expand All @@ -189,7 +189,7 @@ public function store(Request $request)
$specialDate = $contact->setSpecialDate('deceased_date', 0, $date->month, $date->day);
} else {
$specialDate = $contact->setSpecialDate('deceased_date', $date->year, $date->month, $date->day);
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}
} elseif ($request->get('deceased_date_is_age_based')) {
$specialDate = $contact->setSpecialDateFromAge('deceased_date', $request->input('deceased_date_age'));
Expand Down Expand Up @@ -253,7 +253,7 @@ public function update(Request $request, $contactId)
// user is authorized to access
if ($request->get('first_met_through_contact_id')) {
try {
$contactFirstMetThrough = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('first_met_through_contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -287,7 +287,7 @@ public function update(Request $request, $contactId)
$specialDate = $contact->setSpecialDate('birthdate', 0, $date->month, $date->day);
} else {
$specialDate = $contact->setSpecialDate('birthdate', $date->year, $date->month, $date->day);
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}
} elseif ($request->get('birthdate_is_age_based')) {
$specialDate = $contact->setSpecialDateFromAge('birthdate', $request->input('birthdate_age'));
Expand All @@ -304,7 +304,7 @@ public function update(Request $request, $contactId)
$specialDate = $contact->setSpecialDate('first_met', 0, $date->month, $date->day);
} else {
$specialDate = $contact->setSpecialDate('first_met', $date->year, $date->month, $date->day);
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}
} elseif ($request->get('first_met_date_is_age_based')) {
$specialDate = $contact->setSpecialDateFromAge('first_met', $request->input('first_met_date_age'));
Expand All @@ -321,7 +321,7 @@ public function update(Request $request, $contactId)
$specialDate = $contact->setSpecialDate('deceased_date', 0, $date->month, $date->day);
} else {
$specialDate = $contact->setSpecialDate('deceased_date', $date->year, $date->month, $date->day);
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $contact->first_name]));
}
} elseif ($request->get('deceased_date_is_age_based')) {
$specialDate = $contact->setSpecialDateFromAge('deceased_date', $request->input('deceased_date_age'));
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Api/ApiContactFieldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
return $this->respondNotFound();
}

try {
$contactFieldType = ContactFieldType::where('account_id', auth()->user()->account_id)
ContactFieldType::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_field_type_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -109,7 +109,7 @@ public function update(Request $request, $contactFieldId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiDebtController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -132,7 +132,7 @@ public function update(Request $request, $debtId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiGiftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -133,7 +133,7 @@ public function update(Request $request, $giftId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiNoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -115,7 +115,7 @@ public function update(Request $request, $noteId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiReminderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -136,7 +136,7 @@ public function update(Request $request, $reminderId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiTaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function store(Request $request)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down Expand Up @@ -115,7 +115,7 @@ public function update(Request $request, $taskId)
}

try {
$contact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->input('contact_id'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand Down
4 changes: 1 addition & 3 deletions app/Http/Controllers/Contacts/AddressesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function getCountries()
*/
public function store(AddressesRequest $request, Contact $contact)
{
$address = $contact->addresses()->create([
return $contact->addresses()->create([
'account_id' => auth()->user()->account->id,
'country_id' => ($request->get('country_id') == 0 ? null : $request->get('country_id')),
'name' => ($request->get('name') == '' ? null : $request->get('name')),
Expand All @@ -59,8 +59,6 @@ public function store(AddressesRequest $request, Contact $contact)
'province' => ($request->get('province') == '' ? null : $request->get('province')),
'postal_code' => ($request->get('postal_code') == '' ? null : $request->get('postal_code')),
]);

return $address;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Contacts/GiftsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function get(Contact $contact)
'comment' => $gift->comment,
'url' => $gift->url,
'value' => MoneyHelper::format($gift->value),
'does_value_exist' => $gift->value ? true : false,
'does_value_exist' => (bool) $gift->value,
'is_an_idea' => $gift->is_an_idea,
'has_been_offered' => $gift->has_been_offered,
'has_been_received' => $gift->has_been_received,
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Contacts/IntroductionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function update(IntroductionsRequest $request, Contact $contact)
// place
if ($request->get('metThroughId') != 0) {
try {
$metThroughContact = Contact::where('account_id', auth()->user()->account_id)
Contact::where('account_id', auth()->user()->account_id)
->where('id', $request->get('metThroughId'))
->firstOrFail();
} catch (ModelNotFoundException $e) {
Expand All @@ -54,7 +54,7 @@ public function update(IntroductionsRequest $request, Contact $contact)
$specialDate = $contact->setSpecialDate('first_met', $request->input('first_met_year'), $request->input('first_met_month'), $request->input('first_met_day'));

if ($request->addReminder == 'on') {
$newReminder = $specialDate->setReminder('year', 1, trans('people.introductions_reminder_title', ['name' => $contact->first_name]));
$specialDate->setReminder('year', 1, trans('people.introductions_reminder_title', ['name' => $contact->first_name]));
}
}

Expand Down
16 changes: 8 additions & 8 deletions app/Http/Controllers/Contacts/KidsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public function create(Contact $contact)
*/
public function store(KidsRequest $request, Contact $contact)
{
$contactToSaveTheReminderTo = $contact;

// this is a real contact, not just a significant other
if ($request->get('realContact')) {
$kid = Contact::create(
Expand Down Expand Up @@ -83,14 +81,15 @@ public function store(KidsRequest $request, Contact $contact)
// birthdate
$kid->removeSpecialDate('birthdate');
switch ($request->input('birthdate')) {
case 'unknown':
break;
case 'approximate':
$specialDate = $kid->setSpecialDateFromAge('birthdate', $request->input('age'));
break;
case 'exact':
$specialDate = $kid->setSpecialDate('birthdate', $request->input('birthdate_year'), $request->input('birthdate_month'), $request->input('birthdate_day'));
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $kid->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $kid->first_name]));
break;
case 'unknown':
default:
break;
}

Expand Down Expand Up @@ -155,14 +154,15 @@ public function update(KidsRequest $request, Contact $contact, Contact $kid)
// birthdate
$kid->removeSpecialDate('birthdate');
switch ($request->input('birthdate')) {
case 'unknown':
break;
case 'approximate':
$specialDate = $kid->setSpecialDateFromAge('birthdate', $request->input('age'));
break;
case 'exact':
$specialDate = $kid->setSpecialDate('birthdate', $request->input('birthdate_year'), $request->input('birthdate_month'), $request->input('birthdate_day'));
$newReminder = $specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $kid->first_name]));
$specialDate->setReminder('year', 1, trans('people.people_add_birthday_reminder', ['name' => $kid->first_name]));
break;
case 'unknown':
default:
break;
}

Expand Down
Loading