1. Go to this page and download the library: Download clydescobidal/larasearch library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
clydescobidal / larasearch example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Clydescobidal\Larasearch\Searchable;
class Post extends Model
{
use Searchable;
}
$post= Post::search('my post title')->get();
$posts = Post::search('search posts')->paginate();
$post= Post::find(1);
$post->searchable(); // Adds this model to the search index
$post= Post::find(2);
$post->unsearchable(); // Removes this model from the search index