Skip to content

Commit

Permalink
feat: add pirsch (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Feb 18, 2024
1 parent 182dec6 commit 03195ba
Show file tree
Hide file tree
Showing 9 changed files with 194 additions and 42 deletions.
11 changes: 11 additions & 0 deletions app/Console/Commands/SetupApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function handle(): void
$this->migrate();
$this->cacheConfig();
$this->scout();
$this->cloudflare();
}
}

Expand Down Expand Up @@ -108,4 +109,14 @@ protected function scout(): void
{
$this->artisan('✓ Setup scout', 'scout:setup', ['--force' => true]);
}

/**
* Reload cloudflare ips.
*/
protected function cloudflare(): void
{
if ((bool) config('laravelcloudflare.enabled')) {
$this->artisan('✓ Reload cloudflare ips', 'cloudflare:reload');
}
}
}
2 changes: 1 addition & 1 deletion app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule): void
{
// $schedule->command('inspire')->hourly();
$schedule->command('cloudflare:reload')->daily();
}

/**
Expand Down
5 changes: 5 additions & 0 deletions app/Http/Controllers/Auth/RegisteredUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
use Pirsch\Facades\Pirsch;

class RegisteredUserController extends Controller
{
Expand All @@ -32,6 +33,10 @@ public function create(): View
*/
public function store(Request $request): RedirectResponse
{
Pirsch::track('Action', [
'Label' => 'register',
]);

$request->validate([
'email' => [
'required',
Expand Down
3 changes: 2 additions & 1 deletion app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Kernel extends HttpKernel
* @var array<int, class-string|string>
*/
protected $middleware = [
\App\Http\Middleware\TrustProxies::class,
\Monicahq\Cloudflare\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
Expand All @@ -35,6 +35,7 @@ class Kernel extends HttpKernel
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
\Pirsch\Http\Middleware\TrackPageview::class,
],

'api' => [
Expand Down
28 changes: 0 additions & 28 deletions app/Http/Middleware/TrustProxies.php

This file was deleted.

2 changes: 1 addition & 1 deletion app/Http/ViewModels/Home/HomeViewModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static function adminLists(): Collection
->map(fn (NameList $list) => [
'id' => $list->id,
'name' => $list->name,
'total' => Number::format($list->names_count, locale: 'fr'),
'total' => Number::format($list->names_count),
'names' => $list->names()
->inRandomOrder()
->take(4)
Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"laravel/sanctum": "^3.3",
"laravel/scout": "^10.6",
"laravel/tinker": "^2.8",
"mauricius/laravel-htmx": "^0.5.0",
"openai-php/laravel": "^0.8.0",
"mauricius/laravel-htmx": "^0",
"monicahq/laravel-cloudflare": "^3.5",
"openai-php/laravel": "^0",
"pirsch-analytics/laravel-pirsch": "^0",
"spatie/laravel-sitemap": "^7.0",
"spatie/simple-excel": "^3.2"
},
Expand Down Expand Up @@ -60,6 +62,7 @@
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postUpdate",
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
]
},
Expand Down
176 changes: 168 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
|
*/

'name' => env('APP_NAME', 'Tous les prénoms'),
'name' => env('APP_REALNAME', env('APP_NAME', 'Tous les prénoms')),

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 03195ba

Please sign in to comment.