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 페이지를 검토하고 설치를 진행할 수 있습니다.
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,
];
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.