diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 9971ef26cd9..7343c8bab60 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -54,3 +54,4 @@ Michael Bianco Ben Fesili @benfes Markus Dick @markusdick Dung Nguyen @nhymxu +Krzysztof Rewak @krzysztofrewak diff --git a/app/Console/Commands/SentryRelease.php b/app/Console/Commands/SentryRelease.php index 91a1881f557..89b1af3c631 100644 --- a/app/Console/Commands/SentryRelease.php +++ b/app/Console/Commands/SentryRelease.php @@ -52,15 +52,6 @@ class SentryRelease extends Command */ private const SENTRY_URL = 'https://sentry.io/get-cli/'; - /** - * Create a new command. - */ - public function __construct() - { - $this->install_dir = env('SENTRY_ROOT', getenv('HOME').'/.local/bin'); - parent::__construct(); - } - /** * Execute the console command. * @@ -73,6 +64,8 @@ public function handle() } if ($this->confirmToProceed()) { + $this->install_dir = env('SENTRY_ROOT', getenv('HOME').'/.local/bin'); + $release = $this->option('release') ?? config('sentry.release'); $commit = $this->option('commit') ?? (is_dir(__DIR__.'/../../../.git') ? trim(exec('git log --pretty="%H" -n1 HEAD')) : $release); diff --git a/app/Console/Commands/Tests/SetupFrontEndTestUser.php b/app/Console/Commands/Tests/SetupFrontEndTestUser.php index a57bd0f1c10..9ce815c0e41 100644 --- a/app/Console/Commands/Tests/SetupFrontEndTestUser.php +++ b/app/Console/Commands/Tests/SetupFrontEndTestUser.php @@ -22,25 +22,6 @@ class SetupFrontEndTestUser extends Command */ protected $description = 'Create a user exclusively for front-end testing with Cypress.'; - /** - * The migrator instance. - * - * @var \Illuminate\Database\Migrations\Migrator - */ - protected $migrator; - - /** - * Create a new command. - * - * @return void - */ - public function __construct() - { - parent::__construct(); - - $this->migrator = app('migrator'); - } - /** * Execute the console command. * @@ -48,7 +29,7 @@ public function __construct() */ public function handle(): void { - $this->migrator->setConnection($this->option('database')); + app('migrator')->setConnection($this->option('database')); $user = factory(User::class)->create(); $user->account->populateDefaultFields(); diff --git a/app/Http/Controllers/Contacts/ActivitiesController.php b/app/Http/Controllers/Contacts/ActivitiesController.php index 87fe8abced4..8efba7e78b1 100644 --- a/app/Http/Controllers/Contacts/ActivitiesController.php +++ b/app/Http/Controllers/Contacts/ActivitiesController.php @@ -5,7 +5,6 @@ use Carbon\Carbon; use Illuminate\Http\Request; use App\Models\Contact\Contact; -use App\Models\Account\Activity; use Illuminate\Support\Collection; use App\Http\Controllers\Controller; use App\Models\Account\ActivityType; @@ -17,18 +16,6 @@ class ActivitiesController extends Controller { use JsonRespondController; - /** - * Statistics about an activity. - * - * @var ActivityStatisticService - */ - protected $activityStatisticService; - - public function __construct(ActivityStatisticService $service) - { - $this->activityStatisticService = $service; - } - /** * Get the list of activities. * @@ -126,21 +113,21 @@ public function summary(Request $request, Contact $contact) /** * Get all the activities for this contact for a specific year. */ - public function year(Request $request, Contact $contact, int $year) + public function year(ActivityStatisticService $activityStatisticService, Contact $contact, int $year) { $startDate = Carbon::create($year, 1, 1); $endDate = Carbon::create($year, 12, 31); - $activitiesLastTwelveMonths = $this->activityStatisticService + $activitiesLastTwelveMonths = $activityStatisticService ->activitiesWithContactInTimeRange($contact, now()->subMonths(12), now()) ->count(); - $uniqueActivityTypes = $this->activityStatisticService + $uniqueActivityTypes = $activityStatisticService ->uniqueActivityTypesInTimeRange($contact, $startDate, $endDate); - $activitiesPerYear = $this->activityStatisticService->activitiesPerYearWithContact($contact); + $activitiesPerYear = $activityStatisticService->activitiesPerYearWithContact($contact); - $activitiesPerMonthForYear = $this->activityStatisticService + $activitiesPerMonthForYear = $activityStatisticService ->activitiesPerMonthForYear($contact, $year) ->sortByDesc('month');