-
Notifications
You must be signed in to change notification settings - Fork 0
/
Auto Laravel Sr Dev.rivet-project
1126 lines (971 loc) · 49.2 KB
/
Auto Laravel Sr Dev.rivet-project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
version: 4
data:
attachedData:
trivet:
testSuites:
- id: jyVXcr4mG3iRQ5HGuy8p5
testCases: []
testGraph: Vh2mw5duuDuZI8vag8pPS
validationGraph: a
version: 1
graphs:
Vh2mw5duuDuZI8vag8pPS:
metadata:
description: ""
id: Vh2mw5duuDuZI8vag8pPS
name: 03 - Code Generator by Task
nodes:
'[2_DjflD5HXzlEYrG4fOlf]:text "Text"':
data:
text: >-
QUESTION: Generate a complete Eloquent model for this task
context.
Include properties relevant to this task, necessary methods for setting and getting these properties, any required relationships, and Laravel-specific functionalities like soft deletes, attribute casting, and API resources if applicable.
EXAMPLE:
// If the task is to manage a Book inventory system, the model might look like this:
path: laravel/app/Http/Controllers/Book.php or laravel/Modules/Module/Http/Controllers/Book.php replacing Module with the right module name if i'm working with nwidart package
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Book extends Model
{
use HasFactory, SoftDeletes;
protected $fillable = ['title', 'author', 'isbn', 'published_date', 'genre'];
protected $dates = ['deleted_at'];
public function author()
{
return $this->belongsTo(Author::class);
}
// Additional methods and properties relevant to managing books
}
Istructions:
- Replace NS with the right namespace using psr-4 rules
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message3
visualData: 350.77883611068216/958.2628901592876/330/348//
'[2lmFNBhyzPh7N1OvhfPgG]:text "Translation Input"':
data:
prompt: ""
text: If it is not already in English, translate my task into English. Remove
any comments related to the programmer, such as updates to
documentation or information not useful for a GPT prompt, and
respond only with the translation, nothing else.
outgoingConnections:
- output->"Chat" EHiUCChzKnLG5Eml0UIS6/systemPrompt
visualData: -217.5150927859754/-95.757531995406/330/325//
'[2qEQtjWdmMzL45HxAhFwM]:userInput "Module Path Input"':
data:
prompt: If you want to use a nwidart module path, please indicate the module
path
text: ""
useInput: false
outgoingConnections:
- output->"Text" McQyyHtU6z25VJf7j85dC/subpath
visualData: -205.6883774259495/306.9091658327993/280/317//
'[3SsMAGe_uGDFLY7vpLgIx]:slice "Slice"':
data:
count: 2
start: 1
outgoingConnections:
- output->"Chat" l_RA_rhpwrQIfSEoAxRNu/prompt
visualData: 2206.508994923712/750.1522741042018/230/362//
'[8SFhcv_ZtRLa3wCVA0z6y]:compare "Compare"':
data:
comparisonFunction: ==
outgoingConnections:
- output->"If" wD6eALCT4fmDJeY4hkCgd/if
visualData: 1246.1835631040635/1019.4197904226277/190/286//
'[AI9rnqWLZC4wwSQ42ILFG]:text "Text"':
data:
text: >-
QUESTION: Generate a Store{ModelName}Request PHP class file for a
Laravel application, tailoring the directory structure to the
specific project setup.
Instructions:
File Path Decision:
Standard Laravel Installation: Use the path laravel/app/Http/Requests/{ModelName}/Store{ModelName}Request.php.
If using the nwidart package: Replace {ModuleName} with the appropriate module name and use the path laravel/Modules/{ModuleName}/Http/Requests/{ModelName}/Store{ModelName}Request.php.
Note: Verify whether you are working within a standard setup or a modular setup (nwidart package) before setting the file path. This is critical to ensuring the file is placed correctly.
Validation Rules:
Apply the required rule for all fields necessary for creating a new record.
Include additional relevant validation rules for each field, such as string, max, email, etc., to ensure comprehensive validation and adherence to application standards.
Details to Include:
Rule Inference: Automatically infer validation rules based on the fields defined in the model.
Output Formatting: The result should be a PHP class file, properly formatted with the correct namespace and extending FormRequest to leverage Laravel’s request validation system.
Class Naming: Name the class Store{ModelName}Request, indicating its role in handling new record creation requests for {ModelName}.
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message7
visualData: 350.82051625923907/1909.1377994153606/330/337//
'[Co96goY6kRzbNDEVzHDqH]:userInput "Task Input"':
data:
prompt: "This is my assigned task: "
text: ""
useInput: false
outgoingConnections:
- questionsAndAnswers->"Chat" GQwV2mceZ5_vuqfM3vPrF/prompt
visualData: -571.6604276779555/160.24355479301528/325.2427058114997/343//
'[EHiUCChzKnLG5Eml0UIS6]:chat "Chat"':
data:
cache: false
enableFunctionUse: false
headers: []
maxTokens: 1024
model: gpt-3.5-turbo
parallelFunctionCalling: true
stop: ""
temperature: 0.8
top_p: 1
useAsGraphPartialOutput: true
useFrequencyPenaltyInput: false
useMaxTokensInput: false
useModelInput: false
usePresencePenaltyInput: false
useStop: false
useStopInput: false
useTemperatureInput: false
useTopP: false
useTopPInput: false
useUseTopPInput: false
useUserInput: false
outgoingConnections:
- response->"Assemble Message" zthfNVwit30h0Wn7zsBTU/part2
visualData: 350.53221351396587/78.51066816740787/339.91836158229603/225//
'[EY0-JFFxxvNkFIuJ9a5y-]:chat "Chat"':
data:
cache: false
enableFunctionUse: false
headers: []
maxTokens: 1024
model: gpt-3.5-turbo
parallelFunctionCalling: true
responseFormat: json
stop: ""
temperature: 0.75
top_p: 1
useAsGraphPartialOutput: true
useFrequencyPenaltyInput: false
useMaxTokensInput: false
useModelInput: false
usePresencePenaltyInput: false
useStop: false
useStopInput: false
useTemperatureInput: false
useTopP: false
useTopPInput: false
useUseTopPInput: false
useUserInput: false
isSplitRun: true
outgoingConnections:
- response->"Chat" T-gHRG8UBzX0ZLJZCp1HT/prompt
- response->"Extract JSON" RFs0dqw80evMO4f1hMh7X/input
- response->"Slice" 3SsMAGe_uGDFLY7vpLgIx/input
splitRunMax: 10
visualData: 1151.2599427857394/-84.3901305216554/381.4455410661085/366//
'[GQwV2mceZ5_vuqfM3vPrF]:chat "Chat"':
data:
cache: false
enableFunctionUse: false
headers: []
maxTokens: 1024
model: gpt-4
parallelFunctionCalling: true
stop: ""
temperature: 0.5
top_p: 1
useAsGraphPartialOutput: true
useFrequencyPenaltyInput: false
useMaxTokensInput: false
useModelInput: false
usePresencePenaltyInput: false
useStop: false
useStopInput: false
useTemperatureInput: false
useTopP: false
useTopPInput: false
useUseTopPInput: false
useUserInput: false
outgoingConnections:
- response->"Chat" EHiUCChzKnLG5Eml0UIS6/prompt
visualData: -47.626929080206025/49.537971487089976/230/342//
'[IYeOVFRVn9BuIW2nenkPB]:extractJson "Extract JSON"':
isSplitRun: true
outgoingConnections:
- output->"Destructure" eWx337N91cvDojFOBdPa8/object
splitRunMax: 10
visualData: 2238.281019973792/585.5047365177907/280/339//
'[JDgNiSDQpWlGM3EdRYcBQ]:text "Content"':
data:
text: "{{input}}"
isSplitRun: true
outgoingConnections:
- output->"Write File" pj5mvJJ6NNZmQ0mwewvDZ/content
splitRunMax: 10
visualData: 2453.6739999982688/56.064695172864425/330/201//
'[K1c4QxjVPd1FSmRCFwWrD]:prompt "Prompt"':
data:
computeTokenCount: true
enableFunctionCall: false
promptText: >-
QUESTION: {{input}}, generate a Laravel Filament 3 Resource and
its default Pages based on the specified model.
Requirements:
Output: JSON object with an array named "files". Each element in the array should have "path" and "content" keys. The content of each file should be properly formatted with real line breaks and correct indentation.
File Structure:
Resource: {ResourcePath}/{ModelName}Resource.php
Pages: {ResourcePath}/{ModelName}Resource/Pages/Create{ModelName}.php, {ResourcePath}/{ModelName}Resource/Pages/Edit{ModelName}.php, {ResourcePath}/{ModelName}Resource/Pages/List{ModelName}s.php
Instructions:
Replace {ModelName} with the actual model name.
Implement form(), table() and getPages() methods in the Resource using all fields and columns from the model’s migration and model, ensuring to include the appropriate field types as specified in the Filament 3 documentation.
Pages should follow the provided PHP class pattern and be tailored based on the specific task requirements.
Ensure all paths reflect the standard Laravel directory structure as specified in the Filament documentation. Use laravel/app/Filament for a standard directory structure or laravel/Modules/{ModuleName}/Filament if you are working with the nwidart package.
Replace CONTENT with the actual content for the Filament Resource or Filament Page, implementing all Filament methods.
Example JSON structure:
json
{
"files": [
{
"path": "laravel/app/Filament/Resources/ExampleResource.php",
"content": "<?php\n\nnamespace App\\Filament\\Resources;\n\nuse Filament\\Resources\\Resource;\nuse App\\Models\\Example;\n\nclass ExampleResource extends Resource\n{\n // Resource implementation with all fields and columns from the 'Example' model\n}"
},
{
"path": "laravel/app/Filament/Resources/ExampleResource/Pages/CreateExample.php",
"content": "<?php\n\nnamespace App\\Filament\\Resources\\ExampleResource\\Pages;\n\nuse Filament\\Pages\\Actions;\nuse Filament\\Resources\\Pages\\CreateRecord;\n\nclass CreateExample extends CreateRecord\n{\n protected static string $resource = ExampleResource::class;\n}"
}
]
}
Follow PSR-4 standard rules for autoloading.
Use this template to implement all stub methods with appropriate fields, columns, etc.
Include any specific methods or class details required by the task.
text: ""
type: system
useTypeInput: false
outgoingConnections:
- output->"Chat" l_RA_rhpwrQIfSEoAxRNu/systemPrompt
visualData: 1715.3292515653582/1002.0897602941379/280/358//
'[L19IEEAiyY1lanRaje3mG]:text "Content"':
data:
text: "{{input}}"
isSplitRun: true
outgoingConnections:
- output->"Write File" Z6zzofm0BRvQwAjynWlLP/content
splitRunMax: 10
visualData: 3000.434150014748/648.739308015342/330/254//
'[LsXhg5eaLET1s-dy7EOGV]:text "Task Rewriter"':
data:
text: Reformulate the task well.
outgoingConnections:
- output->"Chat" GQwV2mceZ5_vuqfM3vPrF/systemPrompt
visualData: -574.682995084806/-18.99563461877151/330/353//
'[McQyyHtU6z25VJf7j85dC]:text "Text"':
data:
text: >-
Assume the role of a senior developer proficient in Laravel 11.
You will be asked technical questions about creating various
Laravel components such as models, controllers, and middleware
within a module named "Test".
Your responses should include a well-formatted JSON containing the file path and the PHP source code content. The PHP code must have comprehensive PHPDoc comments compatible with PHPStan, detailing the function of each property and method.
IMPORTANT: ALWAYS THE ROOT PATH IS laravel/{{subpath}}
Example of a question:
QUESTION: Can you create the Model?
Expected output:
json
{
"path": "laravel/{{subpath}}Models/MyModel.php",
"content": "
<?php
namespace NS;
use Illuminate\\Database\\Eloquent\\Model;
/**
* Class MyModel
* @package App\\Models
*
*/
class MyModel extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = ['attribute1', 'attribute2'];
/**
* Detailed description of what this method does.
*
* @return void
*/
public function someMethod()
{
// Method implementation
}
}
"
}
Instructions:
Replace 'MyModel' with the actual name of the model based on the question.
Replace 'NS' with the namespace with the standard psr-4 rules
Document each method and property in English, clearly explaining their purpose and use.
Maintain a professional and technically accurate tone to reflect your expertise as a senior developer.
Ensure proper formatting of the file content to align with Laravel and PHP standards.
outgoingConnections:
- output->"Assemble Message" zthfNVwit30h0Wn7zsBTU/part1
visualData: 361.06055325010055/-317.9516936577806/330/127//
'[Pm1NgYTkwGzBIKGa4MTZW]:text "Text"':
data:
text: >-
QUESTION: Generate an Update{ModelName}Request PHP class file for
a Laravel application, ensuring it conforms to the appropriate
directory structure based on the project setup.
Instructions:
File Path Decision:
Standard Laravel Installation: Use the path laravel/app/Http/Requests/{ModelName}/Update{ModelName}Request.php.
If using the nwidart package: Replace {ModuleName} with the appropriate module name and use the path laravel/Modules/{ModuleName}/Http/Requests/{ModelName}/Update{ModelName}Request.php.
Important: Confirm whether you are operating within a standard or modular setup (nwidart package) before deciding on the file path. Ensuring the correct file location is crucial for maintaining proper project structure.
Validation Rules:
Use the sometimes rule for all fields, which is particularly suitable for PATCH operations where only specific fields might be updated.
Include additional relevant validation rules for each field to ensure thorough validation and compliance with application standards. Consider constraints such as min, max, email, unique, etc., depending on the field type and requirements.
Details to Include:
Rule Inference: Automatically derive validation rules based on the model's defined fields. This should take into account the partial update nature of PATCH requests.
Output Formatting: The output should be formatted as a PHP class file, properly formatted with the correct namespace and extending FormRequest to utilize Laravel’s robust request validation system.
Class Naming: The class should be named Update{ModelName}Request, reflecting its function as a handler for update requests specific to {ModelName}.
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message8
visualData: 364.2119383472972/2131.3160743511567/330/367//
'[PnRwl9vgDR5aFTqim3_r4]:destructure "Destructure"':
data:
paths:
- $.files[*].path
- $.files[*].content
- ""
outgoingConnections:
- match_0->"Path" cH3AeZEhb4syhH-G5MhWO/input
- match_1->"Content" fDOMSPyyGcwJeL8ahGwEt/input
visualData: 2979.657997594888/1057.011371185719/280/295//
'[RFs0dqw80evMO4f1hMh7X]:extractJson "Extract JSON"':
isSplitRun: true
outgoingConnections:
- output->"Destructure" pqIM2Mcm6IaQ5hTYAPEvX/object
splitRunMax: 10
visualData: 1745.0141373753654/-74.82357642565627/280/198//
'[RZjPxmQJUfm-HLvSd16pA]:extractJson "Extract JSON"':
outgoingConnections:
- output->"Destructure" PnRwl9vgDR5aFTqim3_r4/object
visualData: 2569.5400865091656/1037.3192530621304/280/296//
'[T-gHRG8UBzX0ZLJZCp1HT]:chat "Chat"':
data:
cache: false
enableFunctionUse: false
headers: []
maxTokens: 1024
model: gpt-3.5-turbo
parallelFunctionCalling: true
responseFormat: json
stop: ""
temperature: 0.8
top_p: 1
useAsGraphPartialOutput: true
useFrequencyPenaltyInput: false
useMaxTokensInput: false
useModelInput: false
usePresencePenaltyInput: false
useStop: false
useStopInput: false
useTemperatureInput: false
useTopP: false
useTopPInput: false
useUseTopPInput: false
useUserInput: false
isSplitRun: true
outgoingConnections:
- response->"Extract JSON" IYeOVFRVn9BuIW2nenkPB/input
splitRunMax: 10
visualData: 1725.656029525627/646.6981024337641/230/338//
'[TafGdIQZL4qlRThxZ3Ctq]:text "Path"':
data:
text: "{{input}}"
isSplitRun: true
outgoingConnections:
- output->"Write File" pj5mvJJ6NNZmQ0mwewvDZ/path
splitRunMax: 10
visualData: 2463.0217321136124/-160.93299410080203/345.20791372941176/253//
'[TjZjhAsAqa-dI3ldYtO0N]:assemblePrompt "Assemble Prompt"':
data:
computeTokenCount: false
outgoingConnections:
- prompt->"Chat" EY0-JFFxxvNkFIuJ9a5y-/prompt
visualData: 789.6432642750901/411.23493735556355/280/302//
'[Vq_ve8ry7fnWe661nMynR]:userInput "User Input"':
data:
prompt: Do you want to make livewire components to handle the task? (Yes / No)
useInput: false
disabled: true
visualData: -613.3393599681517/579.8919647284977/280/326//
'[Y4m9Libmrt79ovG5uRy10]:text "Text"':
data:
text: >-
QUESTION: Generate a dynamic route configuration file for a
Laravel application:
File Creation:
Location: Create a new route configuration file within the 'routes' sub-directory.
Naming: The filename should include the current date and time, formatted as 'api_Y_m_d-H_i_s.php', where 'Y', 'm', 'd', 'H', 'i', and 's' should be dynamically replaced with the actual year, month, day, hour, minute, and second at the time of file creation. This ensures each configuration file is unique and easily identifiable by its creation timestamp.
Purpose: This file will serve as a container for all new route definitions applicable to the application.
Routing Definitions:
Define routes that appropriately direct requests to their respective controller actions. Ensure each route is correctly configured to handle the intended functionality within your application.
Nested Routes:
For hierarchical resources, configure nested routes that reflect the relationship between parent and child resources. Ensure these routes are defined to accurately represent the resource hierarchy in your application's domain.
Non-Nested Routes:
Set up routes for resources or actions that operate independently of any hierarchical relationships. These routes should handle functionalities that are standalone within the application context.
Dynamic Route Configuration:
Routes should be flexible enough to adapt to different controllers and actions based on the application’s evolving needs. Configure these routes to be modifiable with ease, ensuring they can be updated or redefined as required by changes within the application or its data model.
Placeholder Replacement Instructions:
When configuring routes, replace placeholders for resources, resource IDs, actions, controllers, and methods with actual values specific to your application. This replacement is crucial for the routes to function correctly and should reflect the real entities and operations they are designed to handle.
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message1
visualData: 347.9825367487916/331.65357741073296/330/327//
'[Z6zzofm0BRvQwAjynWlLP]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace
content: ""
path: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: true
isSplitRun: true
splitRunMax: 10
visualData: 3421.503864659122/452.66741919291127/238.46814092869363/254//
'[ZwbTcUhFMlDi6Rr1-g3KT]:text "Text"':
data:
text: >-
QUESTION: Develop a Laravel API Resource Controller for a
specified model, adhering strictly to the guidelines below:
Controller Dynamics: The controller should be designed to dynamically manage the specified model, adapting its behavior based on the context of the request.
Return Type: It is essential that all methods in the controller consistently return a JsonResponse to maintain a uniform interface across the API.
CRUD Methods: Each method in the controller should use a specific request object tailored to that method’s needs for data validation and handling:
Index Method: Implement a method to retrieve all instances of the model, presenting them in a resource collection format.
Store Method: This method should validate incoming data using a dedicated request object designed for the creation process. The method then creates the model instance and returns it using a resource class, integrating any custom logic as requested.
Update Method: Utilize a specialized request object for validating incoming data appropriate for updating existing records. Update the model instance as specified and return it through a resource class, including any necessary custom logic.
Show Method: Develop a method to display a single model instance, using a resource class for clear presentation.
Destroy Method: This method should delete a model instance and confirm the deletion with a JSON response.
Parameter Handling: Manage parameters effectively, paying special attention to the handling of nested resources if applicable.
PHPDoc Compliance: Each method should be annotated with PHPDoc comments to meet PHPStan standards, ensuring code readability and maintainability.
Custom Method Logic: Integrate additional custom methods or logic within the standard CRUD operations as specified by the task. This customization should be designed to handle specific conditions or actions based on the data received in requests.
Additional Instructions:
Type Hinting: Ensure all method signatures and responses are appropriately type-hinted for reliability and ease of maintenance.
Laravel Best Practices: Adhere strictly to Laravel's best practices for API development, with a focus on secure and validated data handling.
Controller Path Considerations: Be aware of the potential variations in the controller's file path:
For standard Laravel projects, the path should be laravel/app/Http/Controllers/{ControllerName}.php.
For projects using the nwidart package, adjust the path to laravel/Modules/{ModuleName}/Http/Controllers/{ControllerName}.php, replacing {ModuleName} with the appropriate module name if working within a modular structure.
Note: All methods must be fully implemented using their respective dedicated request objects (not generic Request), incorporating custom logic where needed and ensuring responses are delivered through a Resource class.
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message4
visualData: 354.1526695301603/1294.0395659348696/330/350//
'[cH3AeZEhb4syhH-G5MhWO]:text "Path"':
data:
text: "{{input}}"
isSplitRun: true
outgoingConnections:
- output->"Write File" zXV45tE9O0xNYEJ2BowPQ/path
splitRunMax: 10
visualData: 3592.1537453558244/989.62644429569/345.20791372941176/294//
'[eWx337N91cvDojFOBdPa8]:destructure "Destructure"':
data:
paths:
- $.path
- $.content
- ""
isSplitRun: true
outgoingConnections:
- match_0->"Path" nEyVuexgUzJa9Nu6WjXqS/input
- match_1->"Content" L19IEEAiyY1lanRaje3mG/input
splitRunMax: 10
visualData: 2647.4830219984/535.0743743140677/280/254//
'[fDOMSPyyGcwJeL8ahGwEt]:text "Content"':
data:
text: "{{input}}"
isSplitRun: true
outgoingConnections:
- output->"Write File" zXV45tE9O0xNYEJ2BowPQ/content
splitRunMax: 10
visualData: 3582.806013240481/1206.6241335693562/330/294//
'[hIiUKidLyxiYIK-21gOcB]:text "Text"':
data:
text: Yes
outgoingConnections:
- output->"Compare" 8SFhcv_ZtRLa3wCVA0z6y/a
- output->"If" wD6eALCT4fmDJeY4hkCgd/value
visualData: 877.0224125553384/789.7068283176743/286.87047994740306/356//
'[h_Fk-zAh42N1GqM1r7MCd]:userInput "User Input"':
data:
prompt: Do you want to make Filament Fabricator components to call the livewire
components inside the view? (Yes / No)
useInput: false
disabled: true
visualData: -627/767/280/264//
'[hifUE-tnBYImhrsRKCJ2K]:text "Text"':
data:
text: >
QUESTION: Write Unit Tests in Laravel for this file "content".
Always return a JSON with the path and content.
The file path should be ./tests/Unit/{Filename}Test.php (replace this path with the absolute path)
Replace '{Filename}' with the actual name of the file.
Additional Instructions:
- Ensure that the file names for tests always end with "Test.php". For example, if the file being tested is named "Content.php", the test file should be named "ContentTest.php".
Example of output:
json
{
"path": "PATH",
"content": "// Test code for Content file\n"
}
This example outlines how the unit tests should be structured in a Laravel application and ensures clarity and alignment with JSON path specifications.
Instructions:
- replace PATH with the right path. the path is laravel/tests or laravel/Modules/Test/FilenameTest.php if i'm working with nwidart package
outgoingConnections:
- output->"Chat" T-gHRG8UBzX0ZLJZCp1HT/systemPrompt
visualData: 1706.9187167312166/217.16707933777752/330/248//
'[k0fnsHUddSuOA4yA6e3oB]:userInput "User Input"':
data:
prompt: Do you want to make Filament resources? (Yes / No)
text: ""
useInput: false
outgoingConnections:
- output->"Compare" 8SFhcv_ZtRLa3wCVA0z6y/b
visualData: 880.1835631040638/1009.4197904226277/280/360//
'[l5gAk5NtKrY9Fhldt1DES]:text "Text"':
data:
text: "QUESTION: Generate the Factory for the model specified, ensuring the path
follows the guidelines. For example, if the model is 'Product',
the factory file should be named ProductFactory"
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message5
visualData: 355.68965580458206/1641.6215829768018/330/351//
'[l_RA_rhpwrQIfSEoAxRNu]:chat "Chat"':
data:
cache: false
enableFunctionUse: false
headers: []
maxTokens: 4096
model: gpt-3.5-turbo
parallelFunctionCalling: true
responseFormat: json
stop: ""
temperature: 0.8
top_p: 1
useAsGraphPartialOutput: true
useFrequencyPenaltyInput: false
useMaxTokensInput: false
useModelInput: false
usePresencePenaltyInput: false
useStop: false
useStopInput: false
useTemperatureInput: false
useTopP: false
useTopPInput: false
useUseTopPInput: false
useUserInput: false
outgoingConnections:
- response->"Extract JSON" RZjPxmQJUfm-HLvSd16pA/input
visualData: 2065.3700859262935/1007.1339540372504/407.8106340809072/299//
'[nEyVuexgUzJa9Nu6WjXqS]:text "Path"':
data:
text: "{{input}}"
isSplitRun: true
outgoingConnections:
- output->"Write File" Z6zzofm0BRvQwAjynWlLP/path
splitRunMax: 10
visualData: 3009.7818821300916/431.7416187416755/345.20791372941176/254//
'[pj5mvJJ6NNZmQ0mwewvDZ]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace
content: ""
path: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: true
isSplitRun: true
splitRunMax: 10
visualData: 2874.7437146426428/-140.00719364956632/238.46814092869363/203//
'[pqIM2Mcm6IaQ5hTYAPEvX]:destructure "Destructure"':
data:
paths:
- $.path
- $.content
- ""
isSplitRun: true
outgoingConnections:
- match_0->"Path" TafGdIQZL4qlRThxZ3Ctq/input
- match_1->"Content" JDgNiSDQpWlGM3EdRYcBQ/input
splitRunMax: 10
visualData: 2100.722871981921/-57.60023852840983/280/252//
'[qTKPdxQMQ1wbc_9rQ0dmg]:text "Text"':
data:
text: >-
QUESTION: Generate a Laravel Resource with a JsonResponse.
- Include the PHPDoc mixin annotation for a specific model.
- For instance, if you're handling profile management and the model is called "Profile," the annotation should be @mixin Profile.
- Example: If you're working on profile management, you would create a resource file named ProfileResource.php and add @mixin Profile at the beginning of the code.
- Example path: laravel/app/Http/Resources/etc... or laravel/Modules/Module/Resources/etc... replacing Module with module name if i'm working with nwidart package
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message6
visualData: 352.95260549086703/1754.170875154715/330/352//
'[wD6eALCT4fmDJeY4hkCgd]:if "If"':
data:
unconnectedControlFlowExcluded: true
outgoingConnections:
- output->"Prompt" K1c4QxjVPd1FSmRCFwWrD/input
visualData: 1511.1835631040635/1015.4197904226277/155/286//
'[wb-EGUkEA3pN82rRakryh]:text "Text"':
data:
text: >-
QUESTION: Generate the Migration.
- File Naming: Create a new migration file. The file name should follow the format YYYY_MM_DD_HHMMSS_create_modelname_table.php, where:
YYYY, MM, and DD represent the current year, month, and day.
HHMMSS represents the current time in hours, minutes, and seconds.
modelname should be replaced with the singular, lowercase name of the model the migration is intended for.
- For example, if you are creating a migration for a Movements table on March 25, 2024, at 3:04 PM and 00 seconds, the file name should be 2024_03_25_150400_create_movements_table.php.
- Migration Content: The migration file should contain SQL or equivalent Laravel migration commands to create the specified table with appropriate fields and data types as required by the model.
outgoingConnections:
- output->"Assemble Prompt" TjZjhAsAqa-dI3ldYtO0N/message2
visualData: 350.9126124687716/610.9245412069964/330/347//
'[zXV45tE9O0xNYEJ2BowPQ]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace
content: ""
path: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: true
isSplitRun: true
splitRunMax: 10
visualData: 4003.8757278848548/1010.5522447469258/238.46814092869363/294//
'[zthfNVwit30h0Wn7zsBTU]:assembleMessage "Assemble Message"':
data:
toolCallId: ""
type: user
useToolCallIdInput: false
useTypeInput: false
outgoingConnections:
- message->"Chat" EY0-JFFxxvNkFIuJ9a5y-/systemPrompt
visualData: 789.8104868343679/-76.19359279714763/280/303//
cLKjBsCFJzd4Ha2Q-DM-G:
metadata:
description: ""
id: cLKjBsCFJzd4Ha2Q-DM-G
name: 01 - Laravel Environment Installer
nodes:
'[6nIy-bKiRVq8IFaRxj6yg]:shellCommand "Shell Command"':
data:
command: '[ -d "workspace" ] && rm -r workspace; mkdir workspace; cd workspace;
composer create-project laravel/laravel laravel; cd laravel;
composer require filament/filament:"^3.2" -W --no-interaction; php
artisan filament:install --panels --no-interaction; composer
config --no-plugins allow-plugins.wikimedia/composer-merge-plugin
true; composer require nwidart/laravel-modules --no-interaction;
php artisan module:make Test; mv Modules/Test/app/* Modules/Test/;
cd Modules/Test; rm -R app database tests; mv resources Resources;
mv routes Routes; rm Http/Controllers/TestController.php '
errorOnNonZeroExitCode: false
useCommandInput: false
useWorkingDirectoryInput: false
workingDirectory: /home/dade/rivet
visualData: 528.8917483030207/-33.12980473893697/1962.6410474948784/4//
jdGAcOeu9sLlKhADaEdof:
metadata:
description: ""
id: jdGAcOeu9sLlKhADaEdof
name: 02 - Validation Environment
nodes:
'[4LuzAc927GVOqEQLB59GU]:text "phpstan_constants"':
data:
content: ""
text: |
<?php
declare(strict_types=1);
// https://phpstan.org/user-guide/discovering-symbols
define('LARAVEL_DIR', __DIR__);
outgoingConnections:
- output->"Write File" En_61reetJgwfxHhDuSK-/content
visualData: 498.52085843610075/612.8742052972032/330/349//
'[5mWSQRQmTMri9J0xHoIVu]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace/laravel
content: ""
path: composer.json
text: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: false
visualData: 1012.2985707621012/935.2884219985732/230/352//
'[B1m7ykGdZOjdQM1PwQ5y4]:text "api.php"':
data:
text: >-
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\TestController;
/*
*--------------------------------------------------------------------------
* API Routes
*--------------------------------------------------------------------------
*
* Here is where you can register API routes for your application. These
* routes are loaded by the RouteServiceProvider within a group which
* is assigned the "api" middleware group. Enjoy building your API!
*
*/
outgoingConnections:
- output->"Write File" Lk_rKVlPQ9oCVOJOGX2kY/content
visualData: 453.81456809987526/2089.722529586629/330/369//
'[En_61reetJgwfxHhDuSK-]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace/laravel
content: ""
path: phpstan_constants.php
text: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: false
visualData: 1008.6987367994811/648.1282045684547/230/333//
'[KLc7ghhVGpl6i50lEnJpD]:text "RouteServiceProvider"':
data:
text: >
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*/
public function boot(): void
{
parent::boot();
}
/**
* Define the routes for the application.
*/
public function map(): void
{
$this->mapApiRoutes();
$this->mapWebRoutes();
}
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*/
protected function mapWebRoutes(): void
{
Route::middleware('web')->group(module_path('Test', '/Routes/web.php'));
}
/**
* Define the "api" routes for the application.
*
* These routes are typically stateless.
*/
protected function mapApiRoutes(): void
{
Route::middleware('api')->prefix('api')->name('api.')->group(module_path('Test', '/Routes/api.php'));
}
}
outgoingConnections:
- output->"Write File" m043iS8rHiY79aywjwGMp/content
visualData: 487.9217094931546/1309.7680659390899/330/359//
'[Lk_rKVlPQ9oCVOJOGX2kY]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace/laravel/
content: ""
path: Modules/Test/Routes/api.php
text: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: false
visualData: 970.8443568795516/2222.5954181139214/230/369//
'[OoysLXppInkchWw2m_LFm]:text "web.php"':
data:
text: >-
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\TestController;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
outgoingConnections:
- output->"Write File" Pn8NbwJOJgtq6QV9Pw0Ks/content
visualData: 456.2038599663048/1703.851893158285/330/367//
'[Pn8NbwJOJgtq6QV9Pw0Ks]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace/laravel/
content: ""
path: Modules/Test/Routes/web.php
text: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: false
visualData: 973.2336487459812/1836.7247816855772/230/365//
'[gCpu1Hc1dPcjPQESvb1GD]:writeFile "Write File"':
data:
baseDirectory: /home/dade/rivet/workspace/laravel
content: ""
path: phpstan.neon.dist
text: ""
useBaseDirectoryInput: false
useContentInput: true
usePathInput: false
visualData: 983.339842881312/327.8545934137103/230/333//
'[kmnawYdLIK9iCgW4BTnC6]:text "composer.json"':
data:
content: ""
text: >
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.2",
"laravel/framework": "^11.0",
"laravel/tinker": "^2.9",
"nwidart/laravel-modules": "^11.0"
},
"require-dev": {
"fakerphp/faker": "^1.23",
"larastan/larastan": "^2.0",
"laravel/pint": "^1.13",
"laravel/sail": "^1.26",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.0",
"phpunit/phpunit": "^11.0.1",
"spatie/laravel-ignition": "^2.4"
},
"autoload": {
"psr-4": {
"App\\": "app/",