Skip to content

Commit d78297e

Browse files
committed
wip
1 parent 243227e commit d78297e

File tree

13 files changed

+536
-103
lines changed

13 files changed

+536
-103
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,11 @@ This is done by supporting custom packages in the development app of our Monorep
143143

144144
- Do `npm run build` before committing because automated tests on GitHub needs a working vite-manifest
145145
- Do `php artisan migrate --database=sqlite` to reflect changes to the test-database
146-
- Use https://marketplace.visualstudio.com/items?itemName=adrolli.tallui-laravel-livewire-tailwind with VS Code
146+
- Use our [VS Code Extension Pack](https://marketplace.visualstudio.com/items?itemName=adrolli.tallui-laravel-livewire-tailwind) with VS Code or Cursor
147147
- Use https://github.com/mooxphp/builder to create your own packages
148+
- Use the installed Debugbar and [Telescope](https://moox.test/telescope/) to debug,
148149
- Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
150+
- Use our [Devlink package](https://github.com/mooxphp/devlink) to link package into your project
149151

150152
## Branching
151153

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\Facades\Gate;
6+
use Laravel\Telescope\IncomingEntry;
7+
use Laravel\Telescope\Telescope;
8+
use Laravel\Telescope\TelescopeApplicationServiceProvider;
9+
10+
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
11+
{
12+
/**
13+
* Register any application services.
14+
*/
15+
public function register(): void
16+
{
17+
// Telescope::night();
18+
19+
$this->hideSensitiveRequestDetails();
20+
21+
$isLocal = $this->app->environment('local');
22+
23+
Telescope::filter(function (IncomingEntry $entry) use ($isLocal) {
24+
return $isLocal ||
25+
$entry->isReportableException() ||
26+
$entry->isFailedRequest() ||
27+
$entry->isFailedJob() ||
28+
$entry->isScheduledTask() ||
29+
$entry->hasMonitoredTag();
30+
});
31+
}
32+
33+
/**
34+
* Prevent sensitive request details from being logged by Telescope.
35+
*/
36+
protected function hideSensitiveRequestDetails(): void
37+
{
38+
if ($this->app->environment('local')) {
39+
return;
40+
}
41+
42+
Telescope::hideRequestParameters(['_token']);
43+
44+
Telescope::hideRequestHeaders([
45+
'cookie',
46+
'x-csrf-token',
47+
'x-xsrf-token',
48+
]);
49+
}
50+
51+
/**
52+
* Register the Telescope gate.
53+
*
54+
* This gate determines who can access Telescope in non-local environments.
55+
*/
56+
protected function gate(): void
57+
{
58+
Gate::define('viewTelescope', function ($user) {
59+
return in_array($user->email, [
60+
//
61+
]);
62+
});
63+
}
64+
}

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,17 @@
2121
"require": {
2222
"filament/spatie-laravel-media-library-plugin": "3.x-dev",
2323
"laravel/framework": "^11.0",
24+
"laravel/telescope": "5.x-dev",
2425
"laravel/tinker": "^2.8",
2526
"moox/audit": "*",
2627
"moox/build": "*",
2728
"moox/category": "*",
2829
"moox/expiry": "*",
2930
"moox/flags": "*",
3031
"moox/frontend": "*",
32+
"moox/item": "*",
3133
"moox/jobs": "*",
3234
"moox/login-link": "*",
33-
"moox/item": "*",
3435
"moox/media": "*",
3536
"moox/notifications": "*",
3637
"moox/page": "*",
@@ -52,12 +53,13 @@
5253
"wikimedia/composer-merge-plugin": "^2.1"
5354
},
5455
"require-dev": {
55-
"moox/build": "*",
56-
"moox/devlink": "*",
56+
"barryvdh/laravel-debugbar": "^3.15@dev",
5757
"fakerphp/faker": "^1.23.1",
5858
"larastan/larastan": "^3.0",
5959
"laravel/pint": "^1.0",
6060
"laravel/sail": "^1.26",
61+
"moox/build": "*",
62+
"moox/devlink": "*",
6163
"nunomaduro/collision": "^8.0",
6264
"pestphp/pest": "^3.0",
6365
"pestphp/pest-plugin-laravel": "^3.0",
@@ -149,4 +151,4 @@
149151
},
150152
"minimum-stability": "dev",
151153
"prefer-stable": false
152-
}
154+
}

config/telescope.php

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
<?php
2+
3+
use Laravel\Telescope\Http\Middleware\Authorize;
4+
use Laravel\Telescope\Watchers;
5+
6+
return [
7+
8+
/*
9+
|--------------------------------------------------------------------------
10+
| Telescope Master Switch
11+
|--------------------------------------------------------------------------
12+
|
13+
| This option may be used to disable all Telescope watchers regardless
14+
| of their individual configuration, which simply provides a single
15+
| and convenient way to enable or disable Telescope data storage.
16+
|
17+
*/
18+
19+
'enabled' => env('TELESCOPE_ENABLED', true),
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| Telescope Domain
24+
|--------------------------------------------------------------------------
25+
|
26+
| This is the subdomain where Telescope will be accessible from. If the
27+
| setting is null, Telescope will reside under the same domain as the
28+
| application. Otherwise, this value will be used as the subdomain.
29+
|
30+
*/
31+
32+
'domain' => env('TELESCOPE_DOMAIN'),
33+
34+
/*
35+
|--------------------------------------------------------------------------
36+
| Telescope Path
37+
|--------------------------------------------------------------------------
38+
|
39+
| This is the URI path where Telescope will be accessible from. Feel free
40+
| to change this path to anything you like. Note that the URI will not
41+
| affect the paths of its internal API that aren't exposed to users.
42+
|
43+
*/
44+
45+
'path' => env('TELESCOPE_PATH', 'telescope'),
46+
47+
/*
48+
|--------------------------------------------------------------------------
49+
| Telescope Storage Driver
50+
|--------------------------------------------------------------------------
51+
|
52+
| This configuration options determines the storage driver that will
53+
| be used to store Telescope's data. In addition, you may set any
54+
| custom options as needed by the particular driver you choose.
55+
|
56+
*/
57+
58+
'driver' => env('TELESCOPE_DRIVER', 'database'),
59+
60+
'storage' => [
61+
'database' => [
62+
'connection' => env('DB_CONNECTION', 'mysql'),
63+
'chunk' => 1000,
64+
],
65+
],
66+
67+
/*
68+
|--------------------------------------------------------------------------
69+
| Telescope Queue
70+
|--------------------------------------------------------------------------
71+
|
72+
| This configuration options determines the queue connection and queue
73+
| which will be used to process ProcessPendingUpdate jobs. This can
74+
| be changed if you would prefer to use a non-default connection.
75+
|
76+
*/
77+
78+
'queue' => [
79+
'connection' => env('TELESCOPE_QUEUE_CONNECTION', null),
80+
'queue' => env('TELESCOPE_QUEUE', null),
81+
'delay' => env('TELESCOPE_QUEUE_DELAY', 10),
82+
],
83+
84+
/*
85+
|--------------------------------------------------------------------------
86+
| Telescope Route Middleware
87+
|--------------------------------------------------------------------------
88+
|
89+
| These middleware will be assigned to every Telescope route, giving you
90+
| the chance to add your own middleware to this list or change any of
91+
| the existing middleware. Or, you can simply stick with this list.
92+
|
93+
*/
94+
95+
'middleware' => [
96+
'web',
97+
Authorize::class,
98+
],
99+
100+
/*
101+
|--------------------------------------------------------------------------
102+
| Allowed / Ignored Paths & Commands
103+
|--------------------------------------------------------------------------
104+
|
105+
| The following array lists the URI paths and Artisan commands that will
106+
| not be watched by Telescope. In addition to this list, some Laravel
107+
| commands, like migrations and queue commands, are always ignored.
108+
|
109+
*/
110+
111+
'only_paths' => [
112+
// 'api/*'
113+
],
114+
115+
'ignore_paths' => [
116+
'livewire*',
117+
'nova-api*',
118+
'pulse*',
119+
],
120+
121+
'ignore_commands' => [
122+
//
123+
],
124+
125+
/*
126+
|--------------------------------------------------------------------------
127+
| Telescope Watchers
128+
|--------------------------------------------------------------------------
129+
|
130+
| The following array lists the "watchers" that will be registered with
131+
| Telescope. The watchers gather the application's profile data when
132+
| a request or task is executed. Feel free to customize this list.
133+
|
134+
*/
135+
136+
'watchers' => [
137+
Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true),
138+
139+
Watchers\CacheWatcher::class => [
140+
'enabled' => env('TELESCOPE_CACHE_WATCHER', true),
141+
'hidden' => [],
142+
],
143+
144+
Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
145+
146+
Watchers\CommandWatcher::class => [
147+
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
148+
'ignore' => [],
149+
],
150+
151+
Watchers\DumpWatcher::class => [
152+
'enabled' => env('TELESCOPE_DUMP_WATCHER', true),
153+
'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false),
154+
],
155+
156+
Watchers\EventWatcher::class => [
157+
'enabled' => env('TELESCOPE_EVENT_WATCHER', true),
158+
'ignore' => [],
159+
],
160+
161+
Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true),
162+
163+
Watchers\GateWatcher::class => [
164+
'enabled' => env('TELESCOPE_GATE_WATCHER', true),
165+
'ignore_abilities' => [],
166+
'ignore_packages' => true,
167+
'ignore_paths' => [],
168+
],
169+
170+
Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true),
171+
172+
Watchers\LogWatcher::class => [
173+
'enabled' => env('TELESCOPE_LOG_WATCHER', true),
174+
'level' => 'error',
175+
],
176+
177+
Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true),
178+
179+
Watchers\ModelWatcher::class => [
180+
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
181+
'events' => ['eloquent.*'],
182+
'hydrations' => true,
183+
],
184+
185+
Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true),
186+
187+
Watchers\QueryWatcher::class => [
188+
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
189+
'ignore_packages' => true,
190+
'ignore_paths' => [],
191+
'slow' => 100,
192+
],
193+
194+
Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true),
195+
196+
Watchers\RequestWatcher::class => [
197+
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
198+
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
199+
'ignore_http_methods' => [],
200+
'ignore_status_codes' => [],
201+
],
202+
203+
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
204+
Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
205+
],
206+
];
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Get the migration connection name.
11+
*/
12+
public function getConnection(): ?string
13+
{
14+
return config('telescope.storage.database.connection');
15+
}
16+
17+
/**
18+
* Run the migrations.
19+
*/
20+
public function up(): void
21+
{
22+
$schema = Schema::connection($this->getConnection());
23+
24+
$schema->create('telescope_entries', function (Blueprint $table) {
25+
$table->bigIncrements('sequence');
26+
$table->uuid('uuid');
27+
$table->uuid('batch_id');
28+
$table->string('family_hash')->nullable();
29+
$table->boolean('should_display_on_index')->default(true);
30+
$table->string('type', 20);
31+
$table->longText('content');
32+
$table->dateTime('created_at')->nullable();
33+
34+
$table->unique('uuid');
35+
$table->index('batch_id');
36+
$table->index('family_hash');
37+
$table->index('created_at');
38+
$table->index(['type', 'should_display_on_index']);
39+
});
40+
41+
$schema->create('telescope_entries_tags', function (Blueprint $table) {
42+
$table->uuid('entry_uuid');
43+
$table->string('tag');
44+
45+
$table->primary(['entry_uuid', 'tag']);
46+
$table->index('tag');
47+
48+
$table->foreign('entry_uuid')
49+
->references('uuid')
50+
->on('telescope_entries')
51+
->onDelete('cascade');
52+
});
53+
54+
$schema->create('telescope_monitoring', function (Blueprint $table) {
55+
$table->string('tag')->primary();
56+
});
57+
}
58+
59+
/**
60+
* Reverse the migrations.
61+
*/
62+
public function down(): void
63+
{
64+
$schema = Schema::connection($this->getConnection());
65+
66+
$schema->dropIfExists('telescope_entries_tags');
67+
$schema->dropIfExists('telescope_entries');
68+
$schema->dropIfExists('telescope_monitoring');
69+
}
70+
};

0 commit comments

Comments
 (0)