forked from spatie/laravel-route-discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
82cc1e0
commit c92b723
Showing
32 changed files
with
489 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
namespace Spatie\RouteDiscovery\Attributes; | ||
|
||
interface RouteAttribute | ||
interface DiscoveryAttribute | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace Spatie\RouteDiscovery\Attributes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_METHOD)] | ||
class DoNotDiscover implements DiscoveryAttribute | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
src/PendingRouteTransformers/AddControllerUriToActions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Spatie\RouteDiscovery\PendingRouteTransformers; | ||
|
||
use Illuminate\Support\Collection; | ||
use Spatie\RouteDiscovery\PendingRoutes\PendingRouteAction; | ||
use Spatie\RouteDiscovery\PendingRoutes\PendingRoute; | ||
|
||
class AddControllerUriToActions implements PendingRouteTransformer | ||
{ | ||
/** | ||
* @param Collection<PendingRoute> $pendingRoutes | ||
* | ||
* @return Collection<PendingRoute> | ||
*/ | ||
public function transform(Collection $pendingRoutes): Collection | ||
{ | ||
$pendingRoutes->each(function (PendingRoute $pendingRoute) { | ||
$pendingRoute->actions->each(function (PendingRouteAction $action) use ($pendingRoute) { | ||
$originalActionUri = $action->uri; | ||
|
||
$action->uri = $pendingRoute->uri; | ||
|
||
if ($originalActionUri) { | ||
$action->uri .= "/{$originalActionUri}"; | ||
} | ||
}); | ||
}); | ||
|
||
return $pendingRoutes; | ||
} | ||
} |
Oops, something went wrong.