We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP: 7.3 Laravel: 5.8 Laravel Scout: 7.1 Algolia Scout extended: 1.6
class Page extends Model { use Searchable; public function toSearchableArray() { $array = [ 'title' => optional($this->content)->title, 'extra' => $this->extra, ]; return $array; } public function content() { return $this->morphOne(Content::class, 'contentable'); } protected $fillable = ['extra']; protected $with = ['content']; } class Content extends Model { public function contentable() { return $this->morphTo(); } protected $fillable = ['title']; protected $touches = ['contentable']; } class PageController extends Controller { public function store(Request $request) { $page = Page::create($request->all()); $page->content()->create($request->all()); return $page; } public function update(Request $request, $id) { $page = $this->findOrFail($id); $page->update($request->all()); $page->content->update($request->all()); $page = $page->fresh(); return $page; } }
Scout import of existing instances works fine, all instances are in sync.
On update the sync works fine, $touches does the job.
$array = [ 'title' => 'Title', 'extra' => 'Extra field', ];
On store the content relation is null and not updated when is created.
$array = [ 'title' => null, 'extra' => 'Extra field', ];
The text was updated successfully, but these errors were encountered:
No branches or pull requests
PHP: 7.3
Laravel: 5.8
Laravel Scout: 7.1
Algolia Scout extended: 1.6
Scout import of existing instances works fine, all instances are in sync.
On update the sync works fine, $touches does the job.
On store the content relation is null and not updated when is created.
The text was updated successfully, but these errors were encountered: