Laravel Scout - keep in touch

When I import an index, everything works fine (including relationships).

The problem is that the main model does not monitor relationships.

When I update a relation, the index also does not update.

Can I use something similar Cache::tagsto updating an index when changing a relationship? Or maybe this is a different way.

+4
source share
1 answer

Unfortunately, there is no direct way to do this with Scout. However, using another Laravel function, you can β€œtrick” Laravel into updating the record.

$touches , . , Comment post(), belongsTo(), Comment:

protected $touches = ['post'];

, updated_at , .

+2

Source: https://habr.com/ru/post/1657179/


All Articles