<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ossycodes / laravel-scout-upstash-search example snippets
use Laravel\Scout\Searchable;
class Post extends Model
{
use Searchable;
protected $searchableAs = 'posts';
public function toSearchableArray()
{
return [
'title' => $this->title,
'body' => $this->body,
];
}
}
'driver' => env('SCOUT_DRIVER', 'upstash'),
// Search
$results = Post::search('laravel')->get();
// Paginate
$results = Post::search('laravel')->paginate(15);
// Import all records
php artisan scout:upstash-import "App\Models\Post"