fix tests
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\BaseModel;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
@@ -12,6 +11,7 @@ class Notification extends BaseModel
|
||||
|
||||
// ✅ legacy: soft deletes + timestamps
|
||||
use SoftDeletes;
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
@@ -73,10 +73,10 @@ class Notification extends BaseModel
|
||||
->where('scheduled_at', '<=', now())
|
||||
->where(function ($w) {
|
||||
$w->whereNull('expires_at')
|
||||
->orWhere('expires_at', '>', now());
|
||||
->orWhere('expires_at', '>', now());
|
||||
});
|
||||
|
||||
if (!empty($targetGroup)) {
|
||||
if (! empty($targetGroup)) {
|
||||
$q->where('target_group', $targetGroup);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,10 @@ class Notification extends BaseModel
|
||||
public static function restoreNotification(int $id): bool
|
||||
{
|
||||
$row = static::withTrashed()->find($id);
|
||||
if (!$row) return false;
|
||||
if (! $row) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $row->restore();
|
||||
}
|
||||
|
||||
@@ -129,4 +132,4 @@ class Notification extends BaseModel
|
||||
->where('expires_at', '<', now())
|
||||
->delete(); // soft delete
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user