1 | <?php namespace Modules\Blog\Repositories\Eloquent; |
||
8 | class EloquentTagRepository extends EloquentBaseRepository implements TagRepository |
||
|
|||
9 | { |
||
10 | /** |
||
11 | * Find a tag by its name |
||
12 | * @param $name |
||
13 | * @return mixed |
||
14 | */ |
||
15 | public function findByName($name) |
||
16 | { |
||
17 | $tags = $this->model->with('translations')->whereHas('translations', function (Builder $q) use ($name) { |
||
18 | $q->where('name', 'like', "%$name%"); |
||
19 | })->get(); |
||
20 | |||
21 | return $this->setLocaleAsKey($tags); |
||
22 | } |
||
23 | |||
24 | private function setLocaleAsKey($tags) |
||
40 | |||
41 | /** |
||
42 | * Create the tag for the specified language |
||
43 | * @param string $lang |
||
44 | * @param array $name |
||
45 | * @return mixed |
||
46 | */ |
||
47 | public function createForLanguage($lang = 'en', $name) |
||
57 | } |
||
58 |