Skip to content

Commit b9af581

Browse files
authored
Merge pull request #138 from Hoya/laravel-5
Tagged model should apply custom connection if one is set
2 parents 7932f38 + e95e581 commit b9af581

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Model/Tagged.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ class Tagged extends Eloquent
1616
public function __construct(array $attributes = array())
1717
{
1818
parent::__construct($attributes);
19-
19+
20+
if (function_exists('config') && $connection = config('tagging.connection')) {
21+
$this->connection = $connection;
22+
}
23+
2024
$this->taggingUtility = app(TaggingUtility::class);
2125
}
22-
26+
2327
/**
2428
* Morph to the tag
2529
*
@@ -29,7 +33,7 @@ public function taggable()
2933
{
3034
return $this->morphTo();
3135
}
32-
36+
3337
/**
3438
* Get instance of tag linked to the tagged value
3539
*
@@ -41,4 +45,4 @@ public function tag()
4145
return $this->belongsTo($model, 'tag_slug', 'slug');
4246
}
4347

44-
}
48+
}

0 commit comments

Comments
 (0)