Using defaults
This commit is contained in:
@@ -193,7 +193,7 @@ class Incident extends Model implements HasPresenter
|
||||
*/
|
||||
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 @@ class Incident extends Model implements HasPresenter
|
||||
{
|
||||
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());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||
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 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user