Skip to content

Commit

Permalink
[5.5] Changing events property to avoid any conflicts with relations
Browse files Browse the repository at this point in the history
Related to: #17960
  • Loading branch information
arcanedev-maroc committed Feb 16, 2017
1 parent c16061d commit b3d3243
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Illuminate/Database/Eloquent/Concerns/HasEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ trait HasEvents
*
* @var array
*/
protected $events = [];
protected $observableEvents = [];

/**
* User exposed observable events.
Expand Down Expand Up @@ -152,11 +152,11 @@ protected function fireModelEvent($event, $halt = true)
*/
protected function fireCustomModelEvent($event, $method)
{
if (! isset($this->events[$event])) {
if (! isset($this->observableEvents[$event])) {
return;
}

$result = static::$dispatcher->$method(new $this->events[$event]($this));
$result = static::$dispatcher->$method(new $this->observableEvents[$event]($this));

if (! is_null($result)) {
return $result;
Expand Down
2 changes: 1 addition & 1 deletion tests/Database/DatabaseEloquentModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1954,7 +1954,7 @@ class EloquentModelSavingEventStub

class EloquentModelEventObjectStub extends \Illuminate\Database\Eloquent\Model
{
protected $events = [
protected $observableEvents = [
'saving' => EloquentModelSavingEventStub::class,
];
}

0 comments on commit b3d3243

Please sign in to comment.