laravel
Laravel v12 - The PHP Framework For Web Artisans

Установить laravel в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Laravel Skill
Comprehensive assistance with Laravel 12.x development, including routing, Eloquent ORM, migrations, authentication, API development, and modern PHP patterns.
When to Use This Skill
This skill should be triggered when:
- Building Laravel applications or APIs
- Working with Eloquent models, relationships, and queries
- Setting up authentication, authorization, or API tokens
- Creating database migrations, seeders, or factories
- Implementing middleware, service providers, or events
- Using Laravel's built-in features (queues, cache, validation, etc.)
- Troubleshooting Laravel errors or performance issues
- Following Laravel best practices and conventions
- Implementing RESTful APIs with Laravel Sanctum or Passport
- Working with Laravel Mix, Vite, or frontend assets
Quick Reference
Basic Routing
// Basic routes
Route::get('/users', [UserController::class, 'index']);
Route::post('/users', [UserController::class, 'store']);
// Route parameters
Route::get('/users/{id}', function ($id) {
return User::find($id);
});
// Named routes
Route::get('/profile', ProfileController::class)->name('profile');
// Route groups with middleware
Route::middleware(['auth'])->group(function () {
Route::get('/dashboard', [DashboardController::class, 'index']);
Route::resource('posts', PostController::class);
});
Eloquent Model Basics
// Define a model with relationships
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Post extends Model
{
protected $fillable = ['title', 'content', 'user_id'];
protected $casts = [
'published_at' => 'datetime',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function comments(): HasMany
{
return $this->hasMany(Comment::class);
}
}
Database Migrations
// Create a migration
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->string('title');
$table->text('content');
$table->timestamp('published_at')->nullable();
$table->timestamps();
$table->index(['user_id', 'published_at']);
});
}
public function down(): void
{
Schema::dropIfExists('posts');
}
};
Form Validation
// Controller validation
public function store(Request $request)
{
$validated = $request->validate([
'title' => 'required|max:255',
'content' => 'required',
'email' => 'required|email|unique:users',
'tags' => 'array|min:1',
'tags.*' => 'string|max:50',
]);
return Post::create($validated);
}
// Form Request validation
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StorePostRequest extends FormRequest
{
public function rules(): array
{
return [
'title' => 'required|max:255',
'content' => 'required|min:100',
];
}
}
Eloquent Query Builder
// Common query patterns
// Eager loading to avoid N+1 queries
$posts = Post::with(['user', 'comments'])
->where('published_at', '<=', now())
->orderBy('published_at', 'desc')
->paginate(15);
// Conditional queries
$query = Post::query();
if ($request->has('search')) {
$query->where('title', 'like', "%{$request->search}%");
}
if ($request->has('author')) {
$query->whereHas('user', function ($q) use ($request) {
$q->where('name', $request->author);
});
}
$posts = $query->get();
API Resource Controllers
namespace App\Http\Controllers\Api;
use App\Models\Post;
use App\Http\Resources\PostResource;
use Illuminate\Http\Request;
class PostController extends Controller
{
public function index()
{
return PostResource::collection(
Post::with('user')->latest()->paginate()
);
}
public function store(Request $request)
{
$post = Post::create($request->validated());
return new PostResource($post);
}
public function show(Post $post)
{
return new PostResource($post->load('user', 'comments'));
}
public function update(Request $request, Post $post)
{
$post->update($request->validated());
return new PostResource($post);
}
}
API Resources (Transformers)
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class PostResource extends JsonResource
{
public function toArray($request): array
{
return [
'id
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- plugin.json
- references/index.md
- references/other.md
FAQ
Что делает скилл laravel?
Laravel v12 - The PHP Framework For Web Artisans
Как установить скилл laravel?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл laravel запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
