Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions config/laroute.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@

/*
* Appends a prefix to URLs. By default the prefix is an empty string.
*
*/
*
*/
'prefix' => '',

/*
* Array of strings which indicate which, if any, route properties should be excluded from the compiled file.
* Intended to reduce the bundled file size by excluding rote properties not being referenced in production.
*
* The array may left empty or may include one or any of the following:
* ['host', 'methods', 'uri', 'action', 'name']
*/
'exclude' => [],

];
4 changes: 3 additions & 1 deletion src/Routes/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class Collection extends \Illuminate\Support\Collection
{
protected static $routeProperties = ['host', 'methods', 'uri', 'action', 'name'];

public function __construct(RouteCollection $routes, $filter, $namespace)
{
$this->items = $this->parseRoutes($routes, $filter, $namespace);
Expand Down Expand Up @@ -85,7 +87,7 @@ protected function getRouteInformation(Route $route, $filter, $namespace)
break;
}

return compact('host', 'methods', 'uri', 'name', 'action');
return compact(array_diff(static::$routeProperties, config('laroute.exclude')));
}

}