search stuffs
This commit is contained in:
@@ -7,10 +7,12 @@ use GoldSpecDigital\LaravelEloquentUUID\Database\Eloquent\Uuid;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Source;
|
||||
use App\Topic;
|
||||
use Laravel\Scout\Searchable;
|
||||
|
||||
class Article extends Model
|
||||
{
|
||||
use Uuid;
|
||||
use Searchable;
|
||||
|
||||
/**
|
||||
* The "type" of the auto-incrementing ID.
|
||||
@@ -73,4 +75,14 @@ class Article extends Model
|
||||
return $this->with('source', 'topics')
|
||||
->latest("published_date");
|
||||
}
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'body' => implode(" ",$this->body),
|
||||
'author' => $this->author
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user