A ton of progress, search start
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -2,9 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use App\Services\Search\BookConfigurator;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use ScoutElastic\Searchable;
|
||||
|
||||
class Book extends Authenticatable {
|
||||
class Book extends Model {
|
||||
|
||||
use Searchable;
|
||||
|
||||
protected $indexConfigurator = BookConfigurator::class;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
@ -12,14 +18,28 @@ class Book extends Authenticatable {
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'location_id', 'barcode', 'name',
|
||||
];
|
||||
|
||||
public function author() {
|
||||
return $this->hasMany(Author::class);
|
||||
public function authors() {
|
||||
return $this->belongsToMany(Author::class, 'book_authors');
|
||||
}
|
||||
|
||||
public function location() {
|
||||
return $this->belongsTo(Location::class);
|
||||
}
|
||||
|
||||
protected $mapping = [
|
||||
'properties' => [
|
||||
'name' => [
|
||||
'type' => 'text',
|
||||
// Also you can configure multi-fields, more details you can find here https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html
|
||||
'fields' => [
|
||||
'raw' => [
|
||||
'type' => 'keyword',
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user