Skip to content
Prev Previous commit
Next Next commit
Update to latest, with attendant fixes
  • Loading branch information
muglug committed Apr 17, 2018
commit 03a14ff38b6403d1f4dfb4a95d23b96cde03041f
6 changes: 3 additions & 3 deletions app/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public static function hasAny()
* @param string $last_name
* @param string $email
* @param string $password
* @return this
* @return $this
*/
public static function createDefault($first_name, $last_name, $email, $password)
{
Expand Down Expand Up @@ -711,7 +711,7 @@ public function getRelationshipTypeGroupByType(string $relationshipTypeGroupName
/**
* Get the statistics of the number of calls grouped by year.
*
* @return json
* @return array
*/
public function getYearlyCallStatistics()
{
Expand Down Expand Up @@ -746,7 +746,7 @@ public function getYearlyCallStatistics()
/**
* Get the statistics of the number of activities grouped by year.
*
* @return json
* @return array
*/
public function getYearlyActivitiesStatistics()
{
Expand Down
4 changes: 2 additions & 2 deletions app/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App;

use DB;
use App\Traits\Hasher;
use App\Traits\Searchable;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Storage;
Expand Down Expand Up @@ -414,7 +414,7 @@ public function getInitialsAttribute()
/**
* Mutator last_consulted_at.
*
* @param datetime $value
* @param \DateTime $value
*/
public function setLastConsultedAtAttribute($value)
{
Expand Down
2 changes: 1 addition & 1 deletion app/Helpers/LocaleHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Helpers;

use Auth;
use Illuminate\Support\Facades\Auth;

class LocaleHelper
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Contacts/RelationshipsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\Controllers\Contacts;

use Validator;
use App\Contact;
use App\Relationship;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;

class RelationshipsController extends Controller
{
Expand Down Expand Up @@ -196,7 +196,7 @@ public function edit(Contact $contact, Contact $otherContact)
/**
* Update the specified resource in storage.
*
* @param RelationshipsRequest $request
* @param Request $request
* @param Contact $contact
* @param SignificantOther $significantOther
* @return \Illuminate\Http\Response
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use App\Jobs\ResizeAvatars;
use App\Helpers\VCardHelper;
use Illuminate\Http\Request;
use Barryvdh\Debugbar\Facade as Debugbar;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;

Expand All @@ -31,6 +32,8 @@ public function index(Request $request)

$dateFlag = false;

$date_sort = null;

if (str_contains($sort, 'lastactivitydate')) {
$date_sort = str_after($sort, 'lastactivitydate');
$sort = 'firstnameAZ';
Expand Down Expand Up @@ -490,7 +493,7 @@ public function search(Request $request)
public function vCard(Contact $contact)
{
if (config('app.debug')) {
\Debugbar::disable();
Debugbar::disable();
}

$vcard = VCardHelper::prepareVCard($contact);
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Resources/Contact/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ public function toArray($request)
'relationships' => $this->when(! $this->is_partial, [
'love' => [
'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('love')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('love')->count()),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('love')) ? null : self::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('love'))),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('love')) ? null : \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('love'))),
],
'family' => [
'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('family')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('family')->count()),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('family')) ? null : self::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('family'))),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('family')) ? null : \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('family'))),
],
'friend' => [
'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('friend')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('friend')->count()),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('friend')) ? null : self::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('friend'))),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('friend')) ? null : \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('friend'))),
],
'work' => [
'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('work')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('work')->count()),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('work')) ? null : self::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('work'))),
'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('work')) ? null : \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('work'))),
],
]),
'dates' => [
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Resources/Contact/ContactWithContactFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ public function toArray($request)
'relationships' => $this->when(! $this->is_partial, [
'love' => [
'total' => $this->getRelationshipsByRelationshipTypeGroup('love')->count(),
'contacts' => Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('love')),
'contacts' => \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('love')),
],
'family' => [
'total' => $this->getRelationshipsByRelationshipTypeGroup('family')->count(),
'contacts' => Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('family')),
'contacts' => \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('family')),
],
'friend' => [
'total' => $this->getRelationshipsByRelationshipTypeGroup('friend')->count(),
'contacts' => Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('friend')),
'contacts' => \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('friend')),
],
'work' => [
'total' => $this->getRelationshipsByRelationshipTypeGroup('work')->count(),
'contacts' => Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('work')),
'contacts' => \App\Contact::translateForAPI($this->getRelationshipsByRelationshipTypeGroup('work')),
],
]),
'dates' => [
Expand Down
5 changes: 3 additions & 2 deletions app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace App;

use DB;
use Carbon\Carbon;
use Laravel\Passport\HasApiTokens;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Foundation\Auth\User as Authenticatable;
Expand Down Expand Up @@ -58,7 +59,7 @@ public static function createDefault($account_id, $first_name, $last_name, $emai
$user->password = bcrypt($password);
$user->timezone = config('app.timezone');
$user->created_at = now();
$user->locale = \App::getLocale();
$user->locale = App::getLocale();
$user->save();

return $user;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

Use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;

class PopulateDefaultRelationshipTypeTables extends Migration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use App\Account;
Use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;

class PopulateRelationshipTypeTablesWithDefaultValues extends Migration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use App\Account;
use App\Relationship;
Use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use App\Account;
Use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Migrations\Migration;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

Use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use App\Relationship;
Use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;

class FixContactsData extends Migration
Expand Down
1 change: 1 addition & 0 deletions database/migrations/2018_04_13_230536_update_changelog.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

Use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;

class UpdateChangelog extends Migration
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<!-- level 6 issues - bad stuff here -->

<InvalidNullableReturnType errorLevel="info" />
<NullableReturnStatement errorLevel="info" />
<ImplementedReturnTypeMismatch errorLevel="info" />
<UnresolvableInclude errorLevel="info" />
<InvalidReturnStatement errorLevel="info" />
Expand Down
4 changes: 0 additions & 4 deletions tests/Api/ApiRelationshipTypeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public function test_it_gets_the_list_of_relationship_types()
$response->assertStatus(200);

$response->assertJsonFragment([
'id' => $relationshipType->id,
'object' => 'relationshiptype',
'name' => 'father',
'delible' => false,
'id' => $relationshipType2->id,
'object' => 'relationshiptype',
'name' => 'son',
Expand Down
4 changes: 0 additions & 4 deletions tests/Api/ApiRelationshipTypeGroupControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ public function test_it_gets_the_list_of_relationship_type_groups()
$response->assertStatus(200);

$response->assertJsonFragment([
'id' => $relationshipTypeGroup->id,
'object' => 'relationshiptypegroup',
'name' => 'love',
'delible' => false,
'id' => $relationshipTypeGroup2->id,
'object' => 'relationshiptypegroup',
'name' => 'hate',
Expand Down
2 changes: 1 addition & 1 deletion tests/Commands/CommandExecutorTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class CommandExecutorTester implements CommandExecutorInterface
{
/**
* @var Collection
* @var \Illuminate\Support\Collection
*/
public $buffer;

Expand Down
3 changes: 2 additions & 1 deletion tests/CreatesApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests;

use Illuminate\Support\Facades\App;
use Illuminate\Contracts\Console\Kernel;

trait CreatesApplication
Expand All @@ -17,7 +18,7 @@ public function createApplication()

$app->make(Kernel::class)->bootstrap();

\App::setLocale('en');
App::setLocale('en');
\App\Helpers\DateHelper::setLocale('en');

return $app;
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function test_users_can_delete_addresses()
$response = $this->delete('/people/'.$contact->id.'/addresses/'.$address->id);
$response->assertStatus(200);

$params['id'] = $address->id;
$params = ['id' => $address->id];

$this->assertDatabaseMissing('addresses', $params);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/ContactFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function test_users_can_edit_contact_field()
{
list($user, $contact) = $this->fetchUser();

$params['data'] = 'test_data';
$params = ['data' => 'test_data'];

$feild = factory(\App\ContactFieldType::class)->create([
'account_id' => $user->account_id,
Expand Down Expand Up @@ -149,7 +149,7 @@ public function test_users_can_delete_addresses()
$response = $this->delete('/people/'.$contact->id.'/contactfield/'.$contactField->id);
$response->assertStatus(200);

$params['id'] = $contactField->id;
$params = ['id' => $contactField->id];

$this->assertDatabaseMissing('contact_fields', $params);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Tests\Unit;

use DB;
use App\User;
use App\Account;
use App\Reminder;
use App\Invitation;
use Tests\FeatureTestCase;
use Illuminate\Support\Facades\DB;
use Illuminate\Foundation\Testing\DatabaseTransactions;

class AccountTest extends FeatureTestCase
Expand Down