Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphschindler committed Feb 18, 2019
1 parent a638e10 commit 5d8c183
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
10 changes: 5 additions & 5 deletions src/Illuminate/Database/Eloquent/Relations/Concerns/AsPivot.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Pivot;

trait AsPivot
{
Expand Down Expand Up @@ -43,7 +42,8 @@ public static function fromAttributes(Model $parent, $attributes, $table, $exist
{
$instance = new static;

// if this factory was presented valid timestamp columns, set th e
// if this factory was presented valid timestamp columns, set the $timestamps
// property accordingly
$instance->timestamps = $instance->hasTimestampAttributes($attributes);

// The pivot model is a "dynamic" model since we will set the tables dynamically
Expand Down Expand Up @@ -77,8 +77,8 @@ public static function fromRawAttributes(Model $parent, $attributes, $table, $ex
{
$instance = static::fromAttributes($parent, [], $table, $exists);

// If this is a subclassed Pivot class, treat it as a model and respect
// the $timestamps property
// if this factory was presented valid timestamp columns, set the $timestamps
// property accordingly
$instance->timestamps = $instance->hasTimestampAttributes($attributes);

$instance->setRawAttributes($attributes, true);
Expand Down Expand Up @@ -211,7 +211,7 @@ public function setPivotKeys($foreignKey, $relatedKey)
* Determine if the pivot model has timestamp attributes in either a provided
* array of attributes or the currently tracked attributes inside the model.
*
* @param $attributes array|null Optional,
* @param $attributes array|null Options attributes to check instead of properties
* @return bool
*/
public function hasTimestampAttributes($attributes = null)
Expand Down
2 changes: 0 additions & 2 deletions tests/Database/DatabaseEloquentIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
use RuntimeException;
use InvalidArgumentException;
use Illuminate\Support\Carbon;
use Illuminate\Tests\Integration\Database\EloquentCollectionFreshTest;
use Illuminate\Tests\Integration\Database\EloquentDeleteTest;
use PHPUnit\Framework\TestCase;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\QueryException;
Expand Down
11 changes: 0 additions & 11 deletions tests/Integration/Database/EloquentPivotEventsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

namespace Illuminate\Tests\Integration\Database;

use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Relations\MorphPivot;
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;

/**
* @group integration
Expand Down Expand Up @@ -85,42 +82,34 @@ public static function boot()

static::creating(function ($model) {
static::$eventsCalled[] = 'creating';
return true;
});

static::created(function ($model) {
static::$eventsCalled[] = 'created';
return true;
});

static::updating(function ($model) {
static::$eventsCalled[] = 'updating';
return true;
});

static::updated(function ($model) {
static::$eventsCalled[] = 'updated';
return true;
});

static::saving(function ($model) {
static::$eventsCalled[] = 'saving';
return true;
});

static::saved(function ($model) {
static::$eventsCalled[] = 'saved';
return true;
});

static::deleting(function ($model) {
static::$eventsCalled[] = 'deleting';
return true;
});

static::deleted(function ($model) {
static::$eventsCalled[] = 'deleted';
return true;
});
}
}

0 comments on commit 5d8c183

Please sign in to comment.