| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
-
- namespace App\Http\Controllers;
-
- use Illuminate\Support\Carbon;
- use Inertia\Inertia;
- use Inertia\Response;
-
- /**
- * Our privacy policy and terms of service. The wording lives in the React pages; this sends the facts
- * that can change: who runs the service, how to reach us, the trial length and which AI companies we use.
- */
- class LegalController extends Controller
- {
- public function privacy(): Response
- {
- return Inertia::render('legal/privacy', $this->details());
- }
-
- public function terms(): Response
- {
- return Inertia::render('legal/terms', $this->details());
- }
-
- /**
- * @return array<string, mixed>
- */
- private function details(): array
- {
- return [
- 'operator' => config('legal.operator'),
- 'registration' => config('legal.registration'),
- 'email' => config('legal.email'),
- 'address' => config('legal.address'),
- 'updated' => Carbon::parse(config('legal.updated'))->format('j F Y'),
- 'trialDays' => (int) config('plans.trial_days'),
- 'aiCompanies' => self::aiCompanies(),
- ];
- }
-
- /**
- * The companies behind the AI providers the tasks use right now, each named once.
- * The fake provider (tests, no keys) has no company and is left out.
- *
- * @return list<array{name: string, country: string}>
- */
- public static function aiCompanies(): array
- {
- return collect(config('ai.tasks'))
- ->pluck('provider')
- ->unique()
- ->map(fn (string $provider) => config("legal.ai_companies.{$provider}"))
- ->filter()
- ->unique('name')
- ->values()
- ->all();
- }
- }
|