From 9d5c3bd95157e1e753377aad64b0a149d141836f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 11 Mar 2020 00:06:57 +0100 Subject: [PATCH] [v1] Add check for 0 value (#3473) * Add check for 0 value * David said, this one is better --- app/Http/Middleware/EligibleForMigration.php | 2 +- app/Models/User.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Middleware/EligibleForMigration.php b/app/Http/Middleware/EligibleForMigration.php index 1a8c4e82c5..43141c888d 100644 --- a/app/Http/Middleware/EligibleForMigration.php +++ b/app/Http/Middleware/EligibleForMigration.php @@ -15,7 +15,7 @@ class EligibleForMigration */ public function handle($request, Closure $next) { - if (is_null(auth()->user()->public_id)) { + if (auth()->user()->eligibleForMigration()) { return $next($request); } diff --git a/app/Models/User.php b/app/Models/User.php index e79a31ea40..b7255d721b 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -496,7 +496,7 @@ class User extends Authenticatable public function eligibleForMigration() { - return is_null($this->public_id); + return is_null($this->public_id) || $this->public_id == 0; } }