-
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from andreaselia/fix/102-route-param
Fix API params issue
- Loading branch information
Showing
6 changed files
with
170 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace AndreasElia\PostmanGenerator\Tests\Fixtures; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Routing\Controller; | ||
|
||
class AuditLogController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
} | ||
|
||
public function store(Request $request) | ||
{ | ||
} | ||
|
||
public function show($id) | ||
{ | ||
} | ||
|
||
public function update(Request $request, ExampleModel $auditLog) | ||
{ | ||
} | ||
|
||
public function destroy($id) | ||
{ | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace AndreasElia\PostmanGenerator\Tests\Fixtures; | ||
|
||
trait CollectionHelpersTrait | ||
{ | ||
private function retrieveRoutes(array $route) | ||
{ | ||
// Skip patch routes | ||
if (isset($route['request']['method']) && $route['request']['method'] === 'PATCH') { | ||
return 0; | ||
} | ||
|
||
if (isset($route['item'])) { | ||
$sum = 0; | ||
|
||
foreach ($route['item'] as $item) { | ||
$sum += $this->retrieveRoutes($item); | ||
} | ||
|
||
return $sum; | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
private function countCollectionItems(array $collectionItems) | ||
{ | ||
$sum = 0; | ||
|
||
foreach ($collectionItems as $item) { | ||
$sum += $this->retrieveRoutes($item); | ||
} | ||
|
||
return $sum; | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
namespace AndreasElia\PostmanGenerator\Tests\Fixtures; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class ExampleModel extends Model | ||
{ | ||
} |
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