mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 13:38:20 +01:00
Make subscribers is verified a attribute getter
This commit is contained in:
parent
412c119131
commit
e5c90b25b2
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user