Skip to content

Commit ef43326

Browse files
Merge pull request #95 from brel-pro/master
some fixes
2 parents 8c5bed3 + 5c4f676 commit ef43326

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

resources/views/index.blade.php

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<script src="https://unpkg.com/vue-markdown@2.2.4/dist/vue-markdown.js"></script>
2424
<script src="https://cdnjs.cloudflare.com/ajax/libs/sql-formatter/3.1.0/sql-formatter.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
25-
<script src="{{asset('./vendor/request-docs/dist/app.js')}}"></script>
25+
2626
<style>
2727
[v-cloak] {
2828
display: none;
@@ -130,7 +130,7 @@ class="my-prism-editor"
130130
</section>
131131
<h1 class="font-medium mx-3 mt-3" style="width: max-content;min-width:350px;">Routes List</h1>
132132
<hr class="border-b border-gray-300">
133-
<table class="table-fixed text-sm mt-5" style="width: max-content">
133+
<table class="table-fixed text-sm mt-5 mb-5" style="width: max-content">
134134
<tbody>
135135
@foreach ($docs as $index => $doc)
136136
<tr v-if="!docs[{{$index}}]['isHidden']">
@@ -187,8 +187,8 @@ class="inline-flex text-xs"
187187
<hr class="border-b border-gray-300">
188188
<br>
189189
@foreach ($docs as $index => $doc)
190-
<section class="pt-5 pl-2 pr-2 pb-5 border mb-10 rounded bg-white shadow" v-if="!docs[{{$index}}]['isHidden']">
191-
<div class="font-sans" id="{{$doc['httpMethod'] .'-'. $doc['uri']}}">
190+
<section class="pt-5 pl-2 pr-2 pb-5 border-2 mb-10 rounded bg-white shadow" v-if="!docs[{{$index}}]['isHidden']">
191+
<div class="border-2 rounded" id="{{$doc['httpMethod'] .'-'. $doc['uri']}}">
192192
<h1 class="text-sm break-normal text-black bg-indigo-50 break-normal font-sans pb-1 pt-1 text-black">
193193
<span class="w-20
194194
font-medium
@@ -197,6 +197,8 @@ class="inline-flex text-xs"
197197
justify-center
198198
px-2
199199
py-1
200+
ml-2
201+
mr-2
200202
text-xs
201203
font-bold
202204
leading-none
@@ -207,15 +209,13 @@ class="inline-flex text-xs"
207209
text-{{in_array('PATCH', $doc['methods']) ? 'black': ''}}-100 bg-{{in_array('PATCH', $doc['methods']) ? 'yellow': ''}}-500
208210
text-{{in_array('DELETE', $doc['methods']) ? 'white': ''}} bg-{{in_array('DELETE', $doc['methods']) ? 'black': ''}}
209211
">
210-
{{$doc['methods'][0]}}
212+
{{$doc['methods'][0]}}
211213
</span>
212214
<span class="">
213215
<a href="#{{$doc['uri']}}">{{$doc['uri']}}</a>
214216
</span>
215217
</h1>
216218
</div>
217-
<hr class="border-b border-grey-light">
218-
219219
<table class="table-fixed text-sm mt-5">
220220
<tbody>
221221
<tr>
@@ -245,12 +245,15 @@ class="inline-flex text-xs"
245245
</tbody>
246246
</table>
247247
<div v-if="docs[{{$index}}]['docBlock']" class="border-2 mr-4 mt-4 p-4 rounded text-sm">
248-
<h3 class="font-bold">LRD Docs</h3>
249-
<vue-markdown>{!! $doc['docBlock'] !!}</vue-markdown>
248+
<h3 class="font-bold">Description</h3>
249+
<hr>
250+
<vue-markdown class="mt-2">{!! $doc['docBlock'] !!}</vue-markdown>
250251
</div>
251-
<br>
252252
@if (!empty($doc['rules']))
253-
<table class="table-fixed align-left text-sm mt-5">
253+
<div class="border-2 mr-4 mt-4 p-4 rounded">
254+
<h3 class="font-bold">Attributes</h3>
255+
<hr>
256+
<table class="table-fixed align-left text-sm mt-3">
254257
<thead class="border">
255258
<tr class="border">
256259
<th class="border border-gray-300 pl-2 pr-16 pt-1 pb-1 w-min text-left bg-gray-200">No.</th>
@@ -319,7 +322,7 @@ class="inline-flex text-xs"
319322
<div class="font-mono">
320323
@foreach ($rules as $rule)
321324
@foreach (explode('|', $rule) as $r)
322-
@if (!in_array($r, ['required', 'integer', 'string', 'boolean', 'array', 'nullable', 'bail', 'file', 'image']))
325+
@if (!in_array($r, ['required', 'integer', 'string', 'boolean', 'array', 'nullable', 'bail', 'file', 'image', 'numeric']))
323326
{{$r}}
324327
@if (!$loop->last)
325328
<span class="text-gray-900 font-bold">|</span>
@@ -333,6 +336,7 @@ class="inline-flex text-xs"
333336
@endforeach
334337
</tbody>
335338
</table>
339+
</div>
336340
@endif
337341
<button
338342
class="hover:bg-red-500 font-semibold hover:text-white mt-2 pl-5 pr-5 border-gray-700 hover:border-transparent shadow-inner border-2 rounded-full"
@@ -559,6 +563,9 @@ class="my-prism-editor"
559563
validations.max = 100
560564
}
561565
}
566+
if (rule.match(/numeric/)) {
567+
validations.isInteger = true
568+
}
562569
})
563570
564571
if (validations.isString) {

src/LaravelRequestDocs.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public function sortDocs(array $docs, $sortBy = 'default'): array
5353
foreach ($methods as $method) {
5454
foreach ($docs as $key => $doc) {
5555
if (in_array($method, $doc['methods'])) {
56-
$sorted[] = $doc;
56+
if (!in_array($doc, $sorted)){
57+
$sorted[] = $doc;
58+
}
5759
}
5860
}
5961
}

0 commit comments

Comments
 (0)