tinker-usage
Laravel Tinker best practices for debugging, testing ideas, and data exploration. When and how to use safely.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Laravel Tinker best practices for debugging, testing ideas, and data exploration. When and how to use safely.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
PHP Artisan CLI patterns including make commands, flags, custom commands, and AI-friendly usage.
Advanced Eloquent ORM patterns including relationships, eager loading, factories, and query optimization.
Laravel development best practices covering service providers, dependency injection, facades, and the Laravel Way.
Laravel-native error handling patterns. Renderable exceptions, Livewire traits strategies, and user-facing notifications.
Integrate Anthropic Claude API with Laravel. HTTP client, message format, error handling. Use when calling Claude models from Laravel applications.
API security patterns for Laravel. Rate limiting, headers, CORS, Sanctum tokens, input validation. Use when building or securing API endpoints.
SOC 職業分類に基づく
| name | tinker-usage |
| description | Laravel Tinker best practices for debugging, testing ideas, and data exploration. When and how to use safely. |
| Use Tinker | Use Tests Instead |
|---|---|
| Quick debugging | Repeatable verification |
| Data exploration | Creating production data |
| Testing one-liners | Complex logic validation |
| Checking relationships | Testing side effects |
// ❌ DANGEROUS in production
User::where('role', 'admin')->delete();
// ✅ Read-only exploration
User::where('role', 'admin')->count();
User::where('role', 'admin')->pluck('email');
// Wrap experiments in transactions
DB::beginTransaction();
$user = User::factory()->create();
$user->posts()->createMany([...]);
// Inspect results...
$user->posts()->count();
// Rollback everything
DB::rollBack();
// Check eager loading
User::with('posts')->first()->posts;
// Debug relationship SQL
DB::enableQueryLog();
User::with('posts.comments')->first();
dd(DB::getQueryLog());
// Get fillable/guarded
(new Post)->getFillable();
(new Post)->getGuarded();
// Get casts
(new Post)->getCasts();
// Get relationships
collect((new ReflectionClass(Post::class))->getMethods())
->filter(fn($m) => $m->class === Post::class)
->pluck('name');
// Preview factory output
Post::factory()->make();
Post::factory()->make(['title' => 'Custom']);
// Test factory states
Post::factory()->published()->make();
config('app.name');
config('database.default');
config('queue.default');
// config/tinker.php
'alias' => [
'User' => App\Models\User::class,
'Post' => App\Models\Post::class,
],
// config/tinker.php
'dont_alias' => [
App\Services\PaymentService::class,
],
// ~/.config/psysh/config.php
return [
'defaultIncludes' => [
__DIR__.'/tinker_helpers.php',
],
'historySize' => 1000,
];