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
9 changes: 4 additions & 5 deletions app/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,11 @@ public function getRemindersForMonth(int $month)
{
$startOfMonth = \Carbon\Carbon::now()->addMonthsNoOverflow($month)->startOfMonth();
$endInThreeMonths = \Carbon\Carbon::now()->addMonthsNoOverflow($month)->endOfMonth();
$reminders = auth()->user()->account->reminders()
->whereBetween('next_expected_date', [$startOfMonth, $endInThreeMonths])
->orderBy('next_expected_date', 'asc')
->get();

return $reminders;
return auth()->user()->account->reminders()
->whereBetween('next_expected_date', [$startOfMonth, $endInThreeMonths])
->orderBy('next_expected_date', 'asc')
->get();
}

/**
Expand Down
4 changes: 1 addition & 3 deletions app/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function getContactsForAPI()
*/
public function getInfoForJournalEntry()
{
$data = [
return [
'type' => 'activity',
'id' => $this->id,
'activity_type' => (! is_null($this->type) ? $this->type->getTranslationKeyAsString() : null),
Expand All @@ -173,7 +173,5 @@ public function getInfoForJournalEntry()
'year' => $this->date_it_happened->year,
'attendees' => $this->getContactsForAPI(),
];

return $data;
}
}
4 changes: 2 additions & 2 deletions app/Console/Commands/PingVersionServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct()
*/
public function handle()
{
if (config('monica.check_version') == false) {
if (! config('monica.check_version')) {
return false;
}

Expand Down Expand Up @@ -83,7 +83,7 @@ public function handle()
}

// make sure the JSON has all the fields we need
if (isset($json['latest_version']) == false or isset($json['new_version']) == false or isset($json['number_of_versions_since_user_version']) == false) {
if (! isset($json['latest_version']) || ! isset($json['new_version']) || ! isset($json['number_of_versions_since_user_version'])) {
return;
}

Expand Down
47 changes: 18 additions & 29 deletions app/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ public function getPotentialContacts()
->where('is_the_parent_of', $this->id)
->count();

if ($relationship != 0 or $offspring != 0 or $progenitor != 0) {
if ($relationship != 0 || $offspring != 0 || $progenitor != 0) {
$partners->forget($counter);
}
$counter++;
Expand Down Expand Up @@ -1055,7 +1055,7 @@ public function getPartialOffsprings()
*/
public function setRelationshipWith(self $partner, $bilateral = false)
{
$relationship = Relationship::create(
Relationship::create(
[
'account_id' => $this->account_id,
'contact_id' => $this->id,
Expand All @@ -1065,7 +1065,7 @@ public function setRelationshipWith(self $partner, $bilateral = false)
);

if ($bilateral) {
$relationship = Relationship::create(
Relationship::create(
[
'account_id' => $this->account_id,
'contact_id' => $partner->id,
Expand All @@ -1084,7 +1084,7 @@ public function setRelationshipWith(self $partner, $bilateral = false)
*/
public function updateRelationshipWith(self $partner)
{
$relationship = Relationship::create(
Relationship::create(
[
'account_id' => $this->account_id,
'contact_id' => $partner->id,
Expand All @@ -1103,7 +1103,7 @@ public function updateRelationshipWith(self $partner)
*/
public function isTheOffspringOf(self $parent, $bilateral = false)
{
$offspring = Offspring::create(
Offspring::create(
[
'account_id' => $this->account_id,
'contact_id' => $this->id,
Expand All @@ -1112,7 +1112,7 @@ public function isTheOffspringOf(self $parent, $bilateral = false)
);

if ($bilateral) {
$progenitor = Progenitor::create(
Progenitor::create(
[
'account_id' => $this->account_id,
'contact_id' => $parent->id,
Expand Down Expand Up @@ -1175,15 +1175,15 @@ public function unsetOffspring(self $kid, $bilateral = false)
*/
public function deleteEventsAboutTheseTwoContacts(self $contact, $type)
{
$events = Event::where('contact_id', $this->id)
->where('object_id', $contact->id)
->where('object_type', $type)
->delete();
Event::where('contact_id', $this->id)
->where('object_id', $contact->id)
->where('object_type', $type)
->delete();

$events = Event::where('contact_id', $contact->id)
->where('object_id', $this->id)
->where('object_type', $type)
->delete();
Event::where('contact_id', $contact->id)
->where('object_id', $this->id)
->where('object_type', $type)
->delete();
}

/**
Expand Down Expand Up @@ -1222,9 +1222,7 @@ public function getFirstProgenitor()
$offspring = Offspring::where('contact_id', $this->id)
->first();

$progenitor = self::findOrFail($offspring->is_the_child_of);

return $progenitor;
return self::findOrFail($offspring->is_the_child_of);
}

/**
Expand All @@ -1236,9 +1234,7 @@ public function getFirstPartner()
$relationship = Relationship::where('with_contact_id', $this->id)
->first();

$relationship = self::findOrFail($relationship->contact_id);

return $relationship;
return self::findOrFail($relationship->contact_id);
}

/**
Expand All @@ -1247,14 +1243,7 @@ public function getFirstPartner()
*/
public function isOwedMoney()
{
return $this
->debts()
->where('status', '=', 'inprogress')
->getResults()
->sum(function ($d) {
return $d->in_debt === 'yes' ? -$d->amount : $d->amount;
})
> 0;
return $this->totalOutstandingDebtAmount() > 0;
}

/**
Expand Down Expand Up @@ -1299,7 +1288,7 @@ public function getFamilyMembers()
*/
public function hasFirstMetInformation()
{
return ! is_null($this->first_met_additional_info) or ! is_null($this->firstMetDate) or ! is_null($this->first_met_through_contact_id);
return ! is_null($this->first_met_additional_info) || ! is_null($this->firstMetDate) || ! is_null($this->first_met_through_contact_id);
}

/**
Expand Down
4 changes: 1 addition & 3 deletions app/Day.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getCommentAttribute($value)
*/
public function getInfoForJournalEntry()
{
$data = [
return [
'type' => 'day',
'id' => $this->id,
'rate' => $this->rate,
Expand All @@ -77,7 +77,5 @@ public function getInfoForJournalEntry()
'year' => $this->date->year,
'happens_today' => $this->date->isToday(),
];

return $data;
}
}
4 changes: 1 addition & 3 deletions app/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function getPostAttribute($value)
*/
public function getInfoForJournalEntry()
{
$data = [
return [
'type' => 'activity',
'id' => $this->id,
'title' => $this->title,
Expand All @@ -76,7 +76,5 @@ public function getInfoForJournalEntry()
'month_name' => \App\Helpers\DateHelper::getShortMonth($this->created_at),
'year' => $this->created_at->year,
];

return $data;
}
}
6 changes: 2 additions & 4 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ class Handler extends ExceptionHandler
*/
public function report(Exception $e)
{
if (config('monica.sentry_support') and config('app.env') == 'production') {
if ($this->shouldReport($e)) {
app('sentry')->captureException($e);
}
if (config('monica.sentry_support') && config('app.env') == 'production' && $this->shouldReport($e)) {
app('sentry')->captureException($e);
}
parent::report($e);
}
Expand Down
4 changes: 1 addition & 3 deletions app/Helpers/DateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class DateHelper
*/
public static function createDateFromFormat($date, $timezone)
{
$date = Carbon::createFromFormat('Y-m-d H:i:s', $date, $timezone);

return $date;
return Carbon::createFromFormat('Y-m-d H:i:s', $date, $timezone);
}

/**
Expand Down
8 changes: 2 additions & 6 deletions app/Helpers/InstanceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class InstanceHelper
*/
public static function getNumberOfPaidSubscribers()
{
$paidAccounts = Account::where('stripe_id', '!=', null)->count();

return $paidAccounts;
return Account::where('stripe_id', '!=', null)->count();
}

/**
Expand All @@ -30,14 +28,12 @@ public static function getPlanInformationFromConfig(String $timePeriod)
return;
}

$planInformation = [
return [
'type' => $timePeriod,
'name' => config('monica.paid_plan_'.$timePeriod.'_friendly_name'),
'id' => config('monica.paid_plan_'.$timePeriod.'_id'),
'price' => config('monica.paid_plan_'.$timePeriod.'_price'),
'friendlyPrice' => config('monica.paid_plan_'.$timePeriod.'_price') / 100,
];

return $planInformation;
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/ActivitiesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function store(ActivitiesRequest $request, Contact $contact)
}

// Log a journal entry
$journalEntry = (new JournalEntry)->add($activity);
(new JournalEntry)->add($activity);

return redirect('/people/'.$contact->id)
->with('success', trans('people.activities_add_success'));
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/ApiActivityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function store(Request $request)
}

// Log a journal entry
$journalEntry = (new JournalEntry)->add($activity);
(new JournalEntry)->add($activity);

// Now we associate the activity with each one of the attendees
$attendeesID = $request->get('contacts');
Expand Down Expand Up @@ -167,7 +167,7 @@ public function update(Request $request, $activityId)

// Log a journal entry but need to delete the previous one first
$activity->deleteJournalEntry();
$journalEntry = (new JournalEntry)->add($activity);
(new JournalEntry)->add($activity);

// Get the attendees
$attendees = $request->get('contacts');
Expand Down
Loading