Update book table to cintain extra info
This commit is contained in:
@ -22,6 +22,10 @@ class Book extends Model {
|
||||
'location_id', 'barcode', 'name',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'published_date' => 'datetime:Y-m-d'
|
||||
];
|
||||
|
||||
public function authors() {
|
||||
return $this->belongsToMany(Author::class, 'book_authors');
|
||||
}
|
||||
@ -34,13 +38,24 @@ class Book extends Model {
|
||||
'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',
|
||||
]
|
||||
]
|
||||
],
|
||||
'description' => [
|
||||
'type' => 'text',
|
||||
'fields' => [
|
||||
'raw' => [
|
||||
'type' => 'keyword',
|
||||
]
|
||||
]
|
||||
],
|
||||
'published_date' => [
|
||||
'type' => 'date',
|
||||
'format' => 'yyyy-MM-dd'
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user