@@ -472,7 +472,7 @@ |
||
472 | 472 | if ($field instanceof Fluent && !is_null($field->type)) { |
473 | 473 | $method = 'compile' . ucfirst($this->camelize($field->type)); |
474 | 474 | if (method_exists($this, $method)) { |
475 | - $statements[$field->name] = (array)$this->$method($field); |
|
475 | + $statements[$field->name] = (array) $this->$method($field); |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $this->filesystem = $filesystem; |
26 | 26 | $this->mappingLogRepository = $mappingLogRepository; |
27 | 27 | |
28 | - $this->mappingLogs = array_map(function ($log) { |
|
28 | + $this->mappingLogs = array_map(function($log) { |
|
29 | 29 | return $log['mapping']; |
30 | 30 | }, $this->mappingLogRepository->all()); |
31 | 31 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | $files = $this->filesystem->glob($path . DIRECTORY_SEPARATOR . '*.php'); |
75 | 75 | |
76 | - return array_map(function (string $file) { |
|
76 | + return array_map(function(string $file) { |
|
77 | 77 | return str_replace('.php', '', basename($file)); |
78 | 78 | }, $files); |
79 | 79 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function fill(Model $model, SearchResult $searchResult) |
20 | 20 | { |
21 | 21 | $searchResult->setHits( |
22 | - $searchResult->getHits()->map(function (array $hit) use ($model) { |
|
22 | + $searchResult->getHits()->map(function(array $hit) use ($model) { |
|
23 | 23 | return $this->fillModel($model, $hit); |
24 | 24 | }) |
25 | 25 | ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function hydrateRecursive(Model $model, array $items) |
126 | 126 | { |
127 | - return $model->newCollection(array_map(function ($item) use ($model) { |
|
127 | + return $model->newCollection(array_map(function($item) use ($model) { |
|
128 | 128 | return $this->newFromBuilderRecursive($model, $item); |
129 | 129 | }, $items)); |
130 | 130 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | $traits = class_uses_recursive(get_class($model)); |
20 | 20 | |
21 | 21 | if (!isset($traits[Searchable::class])) { |
22 | - throw new \InvalidArgumentException(get_class($model).' does not use the searchable trait.'); |
|
22 | + throw new \InvalidArgumentException(get_class($model) . ' does not use the searchable trait.'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | return true; |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $this->loadMigrationsFrom(__DIR__ . '/../Resources/database/migrations'); |
56 | 56 | |
57 | 57 | $this->publishes([ |
58 | - __DIR__.'/Resources/database' => database_path(), |
|
58 | + __DIR__ . '/Resources/database' => database_path(), |
|
59 | 59 | ], 'database'); |
60 | 60 | |
61 | 61 | $this->commands([ |
@@ -32,12 +32,12 @@ |
||
32 | 32 | */ |
33 | 33 | public function __construct(array $result) |
34 | 34 | { |
35 | - $this->took = (int)array_get($result, 'took'); |
|
36 | - $this->timedOut = (bool)array_get($result, 'timed_out'); |
|
37 | - $this->shards = (array)array_get($result, '_shards'); |
|
35 | + $this->took = (int) array_get($result, 'took'); |
|
36 | + $this->timedOut = (bool) array_get($result, 'timed_out'); |
|
37 | + $this->shards = (array) array_get($result, '_shards'); |
|
38 | 38 | $this->hits = new Collection(array_get($result, 'hits.hits')); |
39 | - $this->totalHits = (int)array_get($result, 'hits.total'); |
|
40 | - $this->maxScore = (float)array_get($result, 'hits.max_score'); |
|
39 | + $this->totalHits = (int) array_get($result, 'hits.total'); |
|
40 | + $this->maxScore = (float) array_get($result, 'hits.max_score'); |
|
41 | 41 | $this->aggregation = array_get($result, 'aggregations', null); |
42 | 42 | } |
43 | 43 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | foreach ($this->getModelsToSync($index) as $modelClass => $model) { |
44 | 44 | $this->line(sprintf('Sync index with model: %s', $modelClass)); |
45 | 45 | |
46 | - $model::chunk($chunkSize, function ($models) { |
|
46 | + $model::chunk($chunkSize, function($models) { |
|
47 | 47 | /** @var Collection $models */ |
48 | 48 | Leopard::repository()->bulkSave($models); |
49 | 49 | $this->line(sprintf('Indexing a chunk of %s documents ...', count($models))); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | public function handle() |
50 | 50 | { |
51 | - $mapping = $this->formatMappingName((string)$this->argument('mapping')); |
|
51 | + $mapping = $this->formatMappingName((string) $this->argument('mapping')); |
|
52 | 52 | |
53 | 53 | $model = $this->option('model') ? $this->formatModelName($this->option('model')) : null; |
54 | 54 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public static function bootSearchable() |
46 | 46 | { |
47 | - static::saved(function (Model $model) { |
|
47 | + static::saved(function(Model $model) { |
|
48 | 48 | /** @var Model|Searchable $model */ |
49 | 49 | if ($model->shouldSyncDocument()) { |
50 | 50 | $model->repository()->save($model); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $model->syncRelationships(); |
54 | 54 | }); |
55 | 55 | |
56 | - static::deleted(function (Model $model) { |
|
56 | + static::deleted(function(Model $model) { |
|
57 | 57 | /** @var Model|Searchable $model */ |
58 | 58 | if ($model->shouldSyncDocument()) { |
59 | 59 | $model->repository()->delete($model); |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | public function getDocumentType(): string |
96 | 96 | { |
97 | 97 | if (property_exists($this, 'documentType')) { |
98 | - return (string)$this->documentType; |
|
98 | + return (string) $this->documentType; |
|
99 | 99 | } |
100 | 100 | |
101 | - return (string)$this->getTable(); |
|
101 | + return (string) $this->getTable(); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | public function shouldSyncDocument(): bool |
110 | 110 | { |
111 | 111 | if (property_exists($this, 'syncDocument')) { |
112 | - return (bool)$this->syncDocument; |
|
112 | + return (bool) $this->syncDocument; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return true; |