diff --git a/app/Http/Controllers/SubscribeController.php b/app/Http/Controllers/SubscribeController.php index 21173bf2b..8c4e5145a 100644 --- a/app/Http/Controllers/SubscribeController.php +++ b/app/Http/Controllers/SubscribeController.php @@ -81,7 +81,7 @@ class SubscribeController extends Controller $subscriber = Subscriber::where('verify_code', '=', $code)->first(); - if (!$subscriber || $subscriber->verified()) { + if (!$subscriber || $subscriber->is_verified) { throw new BadRequestHttpException(); } @@ -106,7 +106,7 @@ class SubscribeController extends Controller $subscriber = Subscriber::where('verify_code', '=', $code)->first(); - if (!$subscriber || !$subscriber->verified()) { + if (!$subscriber || !$subscriber->is_verified) { throw new BadRequestHttpException(); } diff --git a/app/Models/Subscriber.php b/app/Models/Subscriber.php index fb86b843b..8e03c55c0 100644 --- a/app/Models/Subscriber.php +++ b/app/Models/Subscriber.php @@ -14,6 +14,7 @@ namespace CachetHQ\Cachet\Models; use AltThree\Validator\ValidatingTrait; use CachetHQ\Cachet\Presenters\SubscriberPresenter; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Builder; use McCool\LaravelAutoPresenter\HasPresenter; class Subscriber extends Model implements HasPresenter @@ -65,9 +66,11 @@ class Subscriber extends Model implements HasPresenter /** * Scope a query to only include verified subscribers. * + * @param \Illuminate\Database\Eloquent\Builder $query + * * @return \Illuminate\Database\Eloquent\Builder */ - public function scopeVerified($query) + public function scopeVerified(Builder $query) { return $query->whereNotNull('verified_at'); } @@ -77,7 +80,7 @@ class Subscriber extends Model implements HasPresenter * * @return bool */ - public function verified() + public function getIsVerifiedAttribute() { return $this->verified_at !== null; }