File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed
app/Services/PersonalDataSelection/Exporters Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 5
5
namespace App \Services \PersonalDataSelection \Exporters \Base ;
6
6
7
7
use App \Models \User ;
8
- use Illuminate \Database \Eloquent \Collection ;
9
8
10
9
abstract class AbstractExporter
11
10
{
@@ -24,5 +23,13 @@ public function getFileName(): string {
24
23
return $ this ->fileName ;
25
24
}
26
25
27
- abstract protected function exportData (): array |string |Collection ;
26
+ public function getData (): array |string {
27
+ $ this ->onExportValidation ();
28
+
29
+ return $ this ->exportData ();
30
+ }
31
+
32
+ abstract protected function exportData (): array |string ;
33
+
34
+ abstract protected function onExportValidation (): void ;
28
35
}
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ public function export(array $exporters): void {
29
29
/** @var AbstractExporter $exporter */
30
30
foreach ($ this ->exporters as $ exporter ) {
31
31
$ exporter = new $ exporter ($ this ->user );
32
- $ this ->personalDataSelection ->add ($ exporter ->getFileName (), $ exporter ->exportData ());
32
+ $ this ->personalDataSelection ->add ($ exporter ->getFileName (), $ exporter ->getData ());
33
33
}
34
34
}
35
35
Original file line number Diff line number Diff line change 6
6
7
7
trait ModelExportable
8
8
{
9
-
9
+ protected function onExportValidation (): void {
10
+ // todo check for model + columns
11
+ }
10
12
}
Original file line number Diff line number Diff line change 5
5
namespace App \Services \PersonalDataSelection \Exporters ;
6
6
7
7
use App \Services \PersonalDataSelection \Exporters \Base \AbstractExporter ;
8
+ use App \Services \PersonalDataSelection \Exporters \Base \ModelExportable ;
8
9
9
10
class StatusExporter extends AbstractExporter
10
11
{
12
+ use ModelExportable;
13
+
11
14
protected string $ fileName = 'statuses.json ' ;
12
15
13
- public function exportData (): array |string {
16
+ protected function exportData (): array |string {
14
17
return $ this ->user ->statuses ()->with ('tags ' )->get ()->toArray (); // todo: columns definieren
15
18
}
16
19
}
You can’t perform that action at this time.
0 commit comments