fixed issue with disk test, now with correct fix for redirection after creation
This commit is contained in:
@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
final class Comment extends Model
|
||||
{
|
||||
@@ -88,11 +89,23 @@ final class Comment extends Model
|
||||
return $this->hasMany(Attachment::class, 'comment_id');
|
||||
}
|
||||
|
||||
/** @param Builder<Comment> $query */
|
||||
/**
|
||||
* Scope the query to non-tombstoned comments when the legacy column exists.
|
||||
*
|
||||
* Some older Dusk databases can exist before the Lotus replication migration
|
||||
* added tombstoned_at. In that state every row is active, so avoid issuing an
|
||||
* invalid column query.
|
||||
*
|
||||
* @param Builder<Comment> $query
|
||||
*
|
||||
* @return Builder<Comment>
|
||||
*/
|
||||
public function scopeActive(Builder $query): Builder
|
||||
{
|
||||
if (! Schema::hasColumn($this->getTable(), 'tombstoned_at')) {
|
||||
return $query;
|
||||
}
|
||||
|
||||
return $query->whereNull('tombstoned_at');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user