<?php

namespace LaravelTrailingSlash;

use Illuminate\Routing\UrlGenerator as BaseUrlGenerator;

class UrlGenerator extends BaseUrlGenerator
{
	/**
     * Format the given URL segments into a single URL.
     *
     * @param  string  $root
     * @param  string  $path
     * @param  string  $tail
     * @return string
     */
	protected function trimUrl($root, $path, $tail = '')
	{
		return parent::trimUrl($root, $path, $tail).'/';
	}

	/**
     * Format the given URL segments into a single URL.
     *
     * @param  string  $root
     * @param  string  $path
     * @return string
     */
    public function format($root, $path)
	{
		return parent::format($root, $path).'/';
	}
}

<?php

namespace LaravelTrailingSlash;

use Illuminate\Routing\UrlGenerator as BaseUrlGenerator;

class UrlGenerator extends BaseUrlGenerator
{
	/**
     * Format the given URL segments into a single URL.
     *
     * @param  string  $root
     * @param  string  $path
     * @param  string  $tail
     * @return string
     */
	protected function trimUrl($root, $path, $tail = '')
	{
		return parent::trimUrl($root, $path, $tail).'/';
	}
}

--- 
+++ 
@@ -18,4 +18,16 @@
 	{
 		return parent::trimUrl($root, $path, $tail).'/';
 	}
+
+	/**
+     * Format the given URL segments into a single URL.
+     *
+     * @param  string  $root
+     * @param  string  $path
+     * @return string
+     */
+    public function format($root, $path)
+	{
+		return parent::format($root, $path).'/';
+	}
 }
Create format() method to match old trimUrl() for Laravel 5.4 version