diff --git a/app/Models/Incident.php b/app/Models/Incident.php index b294a5f710bb..bebf43163cb9 100644 --- a/app/Models/Incident.php +++ b/app/Models/Incident.php @@ -193,7 +193,7 @@ public function scopeStickied(Builder $query) */ public function scopeScheduled(Builder $query) { - return $query->where('status', 0)->where('scheduled_at', '>=', Carbon::now()->toDateTimeString()); + return $query->where('status', 0)->where('scheduled_at', '>=', Carbon::now()); } /** @@ -207,7 +207,7 @@ public function scopeNotScheduled(Builder $query) { return $query->where('status', '>', 0)->orWhere(function ($query) { $query->where('status', 0)->where(function ($query) { - $query->whereNull('scheduled_at')->orWhere('scheduled_at', '<=', Carbon::now()->toDateTimeString()); + $query->whereNull('scheduled_at')->orWhere('scheduled_at', '<=', Carbon::now()); }); }); } diff --git a/app/Models/User.php b/app/Models/User.php index ebb838a11068..c8573d5bb0fc 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -18,7 +18,6 @@ use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Support\Facades\Hash; /** @@ -187,11 +186,7 @@ public function getGravatarAttribute($size = 200) */ public static function findByApiToken($token, $columns = ['*']) { - $user = static::where('api_key', $token)->first($columns); - - if (!$user) { - throw new ModelNotFoundException(); - } + $user = static::where('api_key', $token)->firstOrFail($columns); return $user; }