Reputation: 4515
In order to use Algolia search with Airtable data, in a Laravel application, I think need to create an Eloquent model with the data I have retrieved, to then make use of Laravel Scout.
Can I use Collection data, that I have retrieved from Airtable, as a Model without a DB?
Upvotes: 0
Views: 1307
Reputation: 12899
there is a hydrate
method for this:
YourModel::hydrate($collections->toArray())
But if you have only one object, you can just
$res = new YourModel($your_object)
Or you can even use fill
(new YourModel())->fill($your_obj)
And obviously until you don't call like save
or update
or something like this, where laravel tries to save that model on the DB, you're safe (maybe consider "disabling" them from the model, so that if you accidentally call those methods, nothing happens)
Upvotes: 3