| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 13 | public function __invoke(Request $request): Response |
||
| 14 | { |
||
| 15 | if ($request->file('file')->getClientOriginalExtension() !== 'ged') { |
||
| 16 | return response([ |
||
| 17 | 'msg' => 'file type invalid', |
||
| 18 | ], 422); |
||
| 19 | } |
||
| 20 | |||
| 21 | $request->validate([ |
||
| 22 | 'slug' => 'required|string', |
||
| 23 | 'file' => 'required', |
||
| 24 | ]); |
||
| 25 | $slug = $request->slug; |
||
| 26 | $file = $request->file('file'); |
||
| 27 | \Log::info(json_encode($request->user()->company(), JSON_THROW_ON_ERROR)); |
||
| 28 | $manager = Manager::fromModel($request->user()->company(), $request->user()); |
||
| 29 | $path = $manager->storage()->putFile('imports', $file); |
||
| 30 | |||
| 31 | ImportGedcom::dispatch($request->user(), $manager->storagePath($path), $slug); |
||
|
|
|||
| 32 | |||
| 33 | return response([ |
||
| 34 | 'message' => 'Gedcom Import Dispatched', |
||
| 35 | ]); |
||
| 38 |