Skip to content

Commit

Permalink
Merge pull request #5 from spatie/analysis-z49Vnw
Browse files Browse the repository at this point in the history
Applied fixes from StyleCI
  • Loading branch information
freekmurze authored Oct 23, 2016
2 parents 5db11f4 + bd21192 commit f064594
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/laravel-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [

/**
/*
* The model used to manage the tags. You can put any model you want here
* as long as it extends \Spatie\Tags\Tag
*/
Expand Down
3 changes: 1 addition & 2 deletions src/HasSlug.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ trait HasSlug
public static function bootHasSlug()
{
static::saving(function (Model $model) {

collect($model->getTranslatedLocales('name'))
->each(function (string $locale) use ($model) {
$model->setTranslation('slug', $locale, $model->generateSlug($locale));
Expand All @@ -21,4 +20,4 @@ protected function generateSlug(string $locale): string
{
return str_slug($this->getTranslation('name', $locale));
}
}
}
16 changes: 8 additions & 8 deletions src/HasTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function tags(): MorphToMany
*/
public function setTagsAttribute($tags)
{
if (!$this->exists) {
if (! $this->exists) {
$this->queuedTags = $tags;

return;
Expand All @@ -48,11 +48,11 @@ public function setTagsAttribute($tags)
*/
public function scopeWithAllTags(Builder $query, $tags): Builder
{
if (!is_array($tags)) {
if (! is_array($tags)) {
$tags = [$tags];
}

if (!count($tags)) {
if (! count($tags)) {
return $query;
}

Expand All @@ -75,11 +75,11 @@ public function scopeWithAllTags(Builder $query, $tags): Builder
*/
public function scopeWithAnyTags(Builder $query, $tags): Builder
{
if (!is_array($tags)) {
if (! is_array($tags)) {
$tags = [$tags];
}

if (!count($tags)) {
if (! count($tags)) {
return $query;
}

Expand Down Expand Up @@ -108,11 +108,11 @@ public function tagsOfType(string $type = null): Collection
*/
public function attachTags($tags)
{
if (!is_array($tags)) {
if (! is_array($tags)) {
$tags = [$tags];
}

if (!count($tags)) {
if (! count($tags)) {
return $this;
}

Expand Down Expand Up @@ -142,7 +142,7 @@ public function attachTag($tags)
*/
public function detachTags($tags)
{
if (!is_array($tags)) {
if (! is_array($tags)) {
$tags = [$tags];
}

Expand Down
2 changes: 1 addition & 1 deletion tests/TagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function it_can_store_translations()
$this->assertEquals([
'en' => 'my tag',
'fr' => 'mon tag',
'nl' => 'mijn tag'
'nl' => 'mijn tag',
], $tag->getTranslations('name'));
}
}
1 change: 0 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use DB;
use Illuminate\Database\Schema\Blueprint;
use Orchestra\Testbench\TestCase as Orchestra;
use Spatie\EloquentSortable\SortableServiceProvider;
use Spatie\Tags\TagsServiceProvider;
use Spatie\Translatable\TranslatableServiceProvider;

Expand Down

0 comments on commit f064594

Please sign in to comment.