Skip to content

Commit 28853da

Browse files
committed
Merge pull request #1036 from CoditoNet/annotation_format_overriding
Setting default format in RestRouteCollection.php only if not set already
2 parents ceb10f9 + 785373d commit 28853da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Routing/RestRouteCollection.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ public function prependRouteControllersWithPrefix($prefix)
6262
public function setDefaultFormat($format)
6363
{
6464
foreach (parent::all() as $route) {
65-
$route->setDefault('_format', $format);
65+
// Set default format only if not set already (could be defined in annotation)
66+
if (!$route->getDefault('_format')) {
67+
$route->setDefault('_format', $format);
68+
}
6669
}
6770
}
6871

0 commit comments

Comments
 (0)