Skip to content

Commit dbb77a3

Browse files
committed
Merge pull request #65 from chuangbo/feature/support
Move getIndexName to config trait
2 parents f718840 + 7769fae commit dbb77a3

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/ElasticquentConfigTrait.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44

55
trait ElasticquentConfigTrait
66
{
7+
/**
8+
* Get Index Name
9+
*
10+
* @return string
11+
*/
12+
public function getIndexName()
13+
{
14+
// The first thing we check is if there is an elasticquent
15+
// config file and if there is a default index.
16+
$index_name = $this->getElasticConfig('default_index');
17+
18+
if (!empty($index_name)) {
19+
return $index_name;
20+
}
21+
22+
// Otherwise we will just go with 'default'
23+
return 'default';
24+
}
25+
726
/**
827
* Get the Elasticquent config
928
*

src/ElasticquentTrait.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,6 @@ public function newCollection(array $models = array())
6464
return new ElasticquentCollection($models);
6565
}
6666

67-
/**
68-
* Get Index Name
69-
*
70-
* @return string
71-
*/
72-
public function getIndexName()
73-
{
74-
// The first thing we check is if there is an elasticquent
75-
// config file and if there is a default index.
76-
$index_name = $this->getElasticConfig('default_index');
77-
78-
if (!empty($index_name)) {
79-
return $index_name;
80-
}
81-
82-
// Otherwise we will just go with 'default'
83-
return 'default';
84-
}
85-
8667
/**
8768
* Get Type Name
8869
*

0 commit comments

Comments
 (0)