Added canonicalize macro

This commit is contained in:
Graham Campbell
2015-06-12 22:44:57 +01:00
parent 33a282ca4e
commit bf53768530

View File

@@ -13,6 +13,7 @@ namespace CachetHQ\Cachet\Providers;
use Illuminate\Bus\Dispatcher;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
class AppServiceProvider extends ServiceProvider
{
@@ -28,6 +29,10 @@ class AppServiceProvider extends ServiceProvider
$dispatcher->mapUsing(function ($command) {
return Dispatcher::simpleMapping($command, 'CachetHQ\Cachet\Commands', 'CachetHQ\Cachet\Handlers\Commands');
});
Str::macro('canonicalize', function ($url) {
return preg_replace('/([^\/])$/', '$1/', $url);
});
}
/**