Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
dimsav committed Sep 4, 2014
2 parents 6abe7c7 + 5221016 commit 46f2284
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Coding Guidelines

Translatable follows the [coding guidelines](https://github.com/laravel/framework/blob/master/CONTRIBUTING.md#coding-guidelines) used by Laravel.

Pull requests MUST be sent to the development branch.
* Translatable follows the [coding guidelines](https://github.com/laravel/framework/blob/master/CONTRIBUTING.md#coding-guidelines) used by Laravel.
* Pull requests MUST be sent to the development branch.
* To preserve the quality of the package, only well tested code will by merged.
5 changes: 5 additions & 0 deletions Translatable/Translatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,9 @@ protected function getNewTranslationInstance($locale)
return $translation;
}

public function __isset($key)
{
return (in_array($key, $this->translatedAttributes) || parent::__isset($key));
}

}
12 changes: 12 additions & 0 deletions tests/TestCoreModelExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,16 @@ public function it_passes_the_N_plus_1_problem()
$this->assertGreaterThan(2, count($countries));
$this->assertEquals(2, $this->queriesCount);
}


// Forms

/**
* @test
*/
public function it_fakes_isset_for_translated_attributes()
{
$country = Country::find(1);
$this->assertEquals(true, isset($country->name));
}
}

0 comments on commit 46f2284

Please sign in to comment.