Skip to content

Commit

Permalink
Merge pull request cachethq#2173 from abhimanyu003/2.4
Browse files Browse the repository at this point in the history
Using defaults
  • Loading branch information
jbrooksuk committed Oct 13, 2016
2 parents 4205353 + d938591 commit 1c3e74a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/Models/Incident.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand All @@ -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());
});
});
}
Expand Down
7 changes: 1 addition & 6 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 1c3e74a

Please sign in to comment.