diff --git a/src/Illuminate/Database/Schema/Blueprint.php b/src/Illuminate/Database/Schema/Blueprint.php index e6c5c54343b2..a20fd190da9e 100755 --- a/src/Illuminate/Database/Schema/Blueprint.php +++ b/src/Illuminate/Database/Schema/Blueprint.php @@ -901,6 +901,22 @@ public function morphs($name, $indexName = null) $this->index(["{$name}_id", "{$name}_type"], $indexName); } + /** + * Add nullable columns for a polymorphic table. + * + * @param string $name + * @param string|null $indexName + * @return void + */ + public function nullableMorphs($name, $indexName = null) + { + $this->unsignedInteger("{$name}_id")->nullable(); + + $this->string("{$name}_type")->nullable(); + + $this->index(["{$name}_id", "{$name}_type"], $indexName); + } + /** * Adds the `remember_token` column to the table. * diff --git a/src/Illuminate/Events/Dispatcher.php b/src/Illuminate/Events/Dispatcher.php index 32e9990558ed..ba0bed137f49 100755 --- a/src/Illuminate/Events/Dispatcher.php +++ b/src/Illuminate/Events/Dispatcher.php @@ -329,7 +329,13 @@ protected function addInterfaceListeners($eventName, array $listeners = []) { foreach (class_implements($eventName) as $interface) { if (isset($this->listeners[$interface])) { - $listeners = array_merge_recursive($listeners, $this->listeners[$interface]); + foreach ($this->listeners[$interface] as $priority => $names) { + if (isset($listeners[$priority])) { + $listeners[$priority] = array_merge($listeners[$priority], $names); + } else { + $listeners[$priority] = $names; + } + } } }