PHP code example of baethon / eloquent-searchable-scope
1. Go to this page and download the library: Download baethon/eloquent-searchable-scope 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/ */
baethon / eloquent-searchable-scope example snippets
namespace App\Models;
use Baethon\Laravel\Scopes\Searchable;
class Post extends Model
{
use Searchable;
}
namespace App\Models;
use Baethon\Laravel\Scopes\Searchable;
use Baethon\Laravel\Scopes\SearchableOptions;
class Post extends Model
{
use Searchable;
public function getSearchableOptions(): SearchableOptions
{
return SearchableOptions::defaults()
->fields(['topic', 'text', 'user.email'];
}
}