At algolia website i found this code but it is not adding any index at the algolia website. i am working fine with a search for an index that algolia provides ""getstarted_actors"". but i want to import my own database data to be created as index. please help
The following code adds search capabilities to your Contact model creating a Contact index:
use Illuminate\Database\Eloquent\Model;
use AlgoliaSearch\Laravel\AlgoliaEloquentTrait;
class Contact extends Model
{ use AlgoliaEloquentTrait;
}
In order to initially import your data into Algolia you need to use the reindex
added by the AlgoliaEloquentTrait on your model. This is because the autoindex
feature is only triggered after you make changes, so the initial import has to be done manually.
This will look like:
YourModel::reindex();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With