diff --git a/changelog.md b/changelog.md index 9bf65e686..4040e137e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ ## Changelog +### 5.0.7 +- Bugfix: Fixed boolean true bug +- Bugfix: Fixes a bug where soft deletes are not being properly detected in L5 + ### 5.0.6 - Added: Support for custom domains in the admin routes - Added: Ability to access the model from withinthe column output renderer diff --git a/readme.md b/readme.md index 5fba363ad..ddd952ffd 100644 --- a/readme.md +++ b/readme.md @@ -4,7 +4,7 @@ Administrator is an administrative interface builder for [Laravel](http://larave - **Author:** Jan Hartigan - **Website:** [http://frozennode.com](http://administrator.frozennode.com/) -- **Version:** 5.0.6 +- **Version:** 5.0.7 [![Build Status](https://travis-ci.org/FrozenNode/Laravel-Administrator.png?branch=master)](https://travis-ci.org/FrozenNode/Laravel-Administrator) @@ -63,6 +63,10 @@ Administrator is released under the MIT License. See the LICENSE file for detail ## Recent Changelog +### 5.0.7 +- Bugfix: Fixed boolean true bug +- Bugfix: Fixes a bug where soft deletes are not being properly detected in L5 + ### 5.0.6 - Added: Support for custom domains in the admin routes - Added: Ability to access the model from withinthe column output renderer diff --git a/src/Frozennode/Administrator/DataTable/Columns/Relationships/Relationship.php b/src/Frozennode/Administrator/DataTable/Columns/Relationships/Relationship.php index a49792c4b..4ce1287f9 100644 --- a/src/Frozennode/Administrator/DataTable/Columns/Relationships/Relationship.php +++ b/src/Frozennode/Administrator/DataTable/Columns/Relationships/Relationship.php @@ -96,7 +96,7 @@ public function getRelationshipWheres($relationship, $tableAlias, $pivotAlias = //one element of the relationship query's wheres is always useless (it will say pivot_table.other_id is null) //depending on whether or not softdeletes are enabled on the other model, this will be in either position 0 //or 1 of the wheres array - array_splice($query->wheres, (isset($relationshipModel->runSoftDelete) ? 1 : 0), 1); + array_splice($query->wheres, (method_exists($relationshipModel, 'getDeletedAtColumn') ? 1 : 0), 1); //iterate over the wheres to properly alias the columns foreach ($query->wheres as &$where) diff --git a/src/Frozennode/Administrator/Fields/Bool.php b/src/Frozennode/Administrator/Fields/Bool.php index 21c94c7dc..5d151551c 100644 --- a/src/Frozennode/Administrator/Fields/Bool.php +++ b/src/Frozennode/Administrator/Fields/Bool.php @@ -38,7 +38,7 @@ public function build() */ public function fillModel(&$model, $input) { - $model->{$this->getOption('field_name')} = $input === 'true' || $input === '1' ? 1 : 0; + $model->{$this->getOption('field_name')} = $input === 'true' || $input === '1' || $input === true ? 1 : 0; } /** diff --git a/tests/DataTable/Columns/Relationships/RelationshipTest.php b/tests/DataTable/Columns/Relationships/RelationshipTest.php index 5de4d7104..51f74753a 100644 --- a/tests/DataTable/Columns/Relationships/RelationshipTest.php +++ b/tests/DataTable/Columns/Relationships/RelationshipTest.php @@ -79,7 +79,7 @@ public function testGetRelationshipWheres() $eloquentQuery = m::mock('Illuminate\Database\Eloquent\Builder'); $eloquentQuery->shouldReceive('getQuery')->once()->andReturn($query); $relatedModel = m::mock('Illuminate\Database\Eloquent\Model'); - $relatedModel->shouldReceive('hasGetMutator')->once(); + $relatedModel->shouldReceive('hasGetMutator')->never(); $relationship = m::mock('Illuminate\Database\Eloquent\Relations\Relation'); $relationship->shouldReceive('getQuery')->once()->andReturn($eloquentQuery) ->shouldReceive('getRelated')->once()->andReturn($relatedModel);