From 00b1eadcbafafd8807ac17d5956b160709d8e53d Mon Sep 17 00:00:00 2001 From: Ana Ruiz Date: Fri, 21 Apr 2023 11:59:38 -0400 Subject: [PATCH] init commit --- test-angular.ts | 14 ++++ test-laravel.php | 194 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 165 insertions(+), 43 deletions(-) diff --git a/test-angular.ts b/test-angular.ts index 7f6628a..745dee0 100644 --- a/test-angular.ts +++ b/test-angular.ts @@ -42,6 +42,20 @@ import { BehaviorSubject, catchError, map, of, tap, retry } from 'rxjs'; * to the ChangeContentComponent." */ + +// Archivo: ./app.component.css + +.card-title { + text-transform: uppercase; +} +.card-body { + text-transform: lowecase; +} +.card-footer { + text-transform: capitalize; +} + +// Angular @Component({ selector: 'app-root', template: ` diff --git a/test-laravel.php b/test-laravel.php index f8a7366..5f4e14a 100644 --- a/test-laravel.php +++ b/test-laravel.php @@ -10,32 +10,45 @@ ~~~ hasOne(User::class); - } -} + + }//end user() + + +}//end class + ?> ~~~ ~~~ find($id); return $post; - } -} + + }//end show() + + +}//end class + ?> ~~~ @@ -54,31 +67,46 @@ public function show($id) ~~~ data; - for($element in $data){ - $user = User::find($element['User_Id']); - if($user){ - $post = Post::create([ - 'title' => $element['Tittle_Post'], - ]) - DB->connection('data_base')->table('comments')->insert([ - 'comment' => $element['Comment'], - 'post_id' => $post->id, - 'user_id' => $user->id - ]); + * User has relationship one to many with Post + * Post has relationship one to many with Comments + * User has relationship one to many with Comments + * $request = []; + * + */ + public function setData(Request $request) + { + $minRecords = 10000; + $data = $request->data; + if (count($data) >= $minRecords) { + foreach ($data as $key => $element) { + $user = User::find($element['User_Id']); + if ($user) { + $post = Post::create( + [ + 'title' => $element['Tittle_Post'], + ] + ) + DB->connection('data_base')->table('comments')->insert( + [ + 'comment' => $element['Comment'], + 'post_id' => $post->id, + 'user_id' => $user->id, + ] + ); + } } + } else { + throw new \Exception("¡El número de registros sea mínimo 10000!"); } - } -} + + }//end setData() + + +}//end class + ?> ~~~ @@ -92,26 +120,106 @@ public function setData(Request $request){ the number of alert records exceeds 6k records. Explain the code below and what you need to adding to make it work. */ ~~~ + +//EVENTO ids = $ids; + $this->systemReports = $systemReports; + } +} + +//LISTENER + [ + SystemReportNotification::class, + ], +]; + + +// Funciones del controlador, por ejemplo +ids = Id's of the Users that i want to see in the report. * -*/ + */ public function downloadAlerts(Request $request) - { +{ + $systemReports = $this->getSystemReports(); ImportAlerts::dispatch( - $request->ids + $request->ids, + $systemReports ); - $response = new \stdClass(); - $response->status = 200; - $response->message = 'The report is being generated, you will receive an email when finished.'; + $response = new \stdClass(); + $response->status = 200; + $response->message = 'The report is being generated, you will receive an email when finished.'; return response()->json( $response, 200 ); - } + +}//end downloadAlerts() + ?> ~~~