Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Laravel Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-laravel-knowledge-patch)
---
name: laravel-knowledge-patch
description: Laravel
version: "13.43.0"
license: MIT
metadata:
author: Nevaberry
---
# Laravel Knowledge Patch
Use this skill when upgrading Laravel or working with the APIs and behavior in
the topic index. The references contain detailed configuration, commands,
examples, and version-specific guidance.
## Topic index
| Reference | Topics |
| --- | --- |
| [Upgrades and core](references/upgrades-and-core.md) | Runtime and package requirements, contracts, bootstrap, maintenance, reloads |
| [Container, authentication, and routing](references/container-auth-routing.md) | Dependency injection, controller attributes, authentication, request forgery, routing, context |
| [Database and schema](references/database-and-schema.md) | Connections, query builder, migrations, indexes, transactions, vectors |
| [Eloquent and resources](references/eloquent-and-resources.md) | Models, scopes, casts, relationships, factories, resources, pagination |
| [Cache, filesystem, and Redis](references/cache-filesystem-redis.md) | Cache stores, locks, disks, uploads, Redis, sessions |
| [HTTP, mail, and notifications](references/http-mail-notifications.md) | HTTP requests, pools, batches, mail, notifications, broadcasting, image responses |
| [Queues, concurrency, and scheduling](references/queues-concurrency-scheduling.md) | Dispatch, workers, job attributes, events, managed queues, schedules, processes |
| [Validation and testing](references/validation-and-testing.md) | Request input, validation rules, form requests, fakes, assertions, parallel tests |
| [Collections, strings, and support](references/collections-strings-support.md) | Collections, strings, numbers, translations, JSON Schema, AI SDK |
| [Blade, frontend, console, and observability](references/blade-frontend-console-observability.md) | Starter kits, Blade, Vite, Artisan, environment encryption, logs, images |
## Breaking changes and deprecations
### Runtime and Composer requirements
Laravel 13 requires PHP 8.3 or later. Set `laravel/framework` to `^13.0` in
`composer.json`. For packages in use, set `laravel/boost` to `^2.0`,
`laravel/tinker` to `^3.0`, `phpunit/phpunit` to `^12.0`, and `pestphp/pest` to `^4.0`.
Laravel 13.43 requires Horizon 5.47.0 or later when Horizon is installed.
### Cache objects and session serialization
The default application cache configuration sets `serializable_classes` to
`false`. If you cache objects, list their classes explicitly or use array payloads.
The Laravel 13 application skeleton sets `'serialization' => 'json'` in
`config/session.php`. Switching from `php` to `json` invalidates active sessions;
keep `php` if the upgrade must preserve them or the application stores PHP objects in sessions.
### Cache driver and password reset storage
The `apc` cache driver was removed; select another store if it is still used.
Cache-backed password brokers no longer use the broker's `prefix` option.
Set the broker's `store` option to a dedicated cache store to isolate reset tokens.
The `DatabaseTokenRepository` constructor takes `$expires` in seconds: pass
`3600` for a one-hour lifetime when instantiating it directly.
### Database constructors and schema inspection
Custom database code must pass an `Illuminate\Database\Connection` as the first
constructor argument to `Blueprint` and grammar classes. `Grammar::setConnection()`
and `Connection::withTablePrefix()` were removed. Replace deprecated
`Blueprint::getPrefix()` and `Grammar::getTablePrefix()` with `$connection->getTablePrefix()`.
`Schema::getTables()`, `getViews()`, and `getTypes()` inspect all schemas by default.
`Schema::getTableListing()` returns schema-qualified names by default.
### Upsert and joined deletes
Pass a non-empty `uniqueBy` to `upsert()` to avoid an `InvalidArgumentException`.
MySQL and MariaDB detect conflicts using the table's primary and unique indexes.
The MySQL grammar includes `ORDER BY` and `LIMIT` in joined deletes; engines that
reject those clauses on joined deletes can throw a `QueryException`.
### Eloquent UUIDs and local scopes
`HasUuids` generates UUIDv7 IDs and replaces the removed `HasVersion7Uuids` trait.
To retain ordered UUIDv4 IDs, import `HasVersion4Uuids as HasUuids` from
`Illuminate\Database\Eloquent\Concerns`.
The local scope attribute was renamed from `#[NamedScope]` to `#[Scope]`;
update the model attribute and import `Illuminate\Database\Eloquent\Attributes\Scope`.
### Eloquent boot and polymorphic data
Instantiating a model while its class is booting throws a `LogicException`.
Move calls such as `new static()` out of model and trait boot methods.
Inferred table names for custom polymorphic pivot models are pluralized; set
`protected $table = 'taggable';` explicitly if the existing table uses that singular name.
In 13.34, morph-map enforcement also checks stored types on reads; update legacy
type values to mapped aliases when preparing existing data for enforcement.
### OR primary-key helpers
Version 13.26.1 removes `orWhereKey()` and `orWhereKeyNot()`; use `whereKey()` or
`whereKeyNot()` inside an `orWhere()` closure to retain the OR condition there.
Laravel 13.27 restores both helpers while preserving compatibility with custom builder subclasses.
### Request input and validation
`Request::get()` is deprecated. Use `$request->input('status')` for submitted
input or `$request->query('status')` for query parameters.
The `image` rule excludes SVG by default; opt in with `image:allow_svg` or `allowSvg: true`.
`mergeIfMissing()` treats dotted keys as nested paths.
### Routing and request forgery protection
Duplicate route-name lookup selects the first registered route, matching cached routing.
Explicit-domain routes take precedence over routes without a domain.
`PreventRequestForgery` uses `Sec-Fetch-Site` to verify request origin.
Update exclusions for the deprecated `VerifyCsrfToken` and `ValidateCsrfToken`
aliases to `->withoutMiddleware([PreventRequestForgery::class])` and use
`preventRequestForgery()` for configuration. Token-based clients can continue sending CSRF tokens.
### Queue events and schedule registration
Replace `$exceptionOccurred` reads with `$event->exception !== null`;
`JobAttempted::$exception` contains the exception object or `null`.
`QueueBusy::$connection` was renamed to `$connectionName`.
`ApplicationBuilder::withScheduling()` runs its callback when `Schedule` is
resolved; move work that must happen during bootstrap outside that callback.
### Contracts and custom implementations
Custom cache stores must provide `touch($key, $seconds)`; the cache `Store` and
`Repository` contracts require `touch` to extend an item's TTL.
Custom queue implementations must provide `pendingSize`, `delayedSize`,
`reservedSize`, and `creationTimeOfOldestPendingJob`.
The references detail the additional bus, response factory, email verification,
queue monitor, enumerable, mailer, pagination, and session contract methods.
### Filesystems and authentication
If the `local` disk is omitted, `Storage::disk('local')` uses `storage/app/private`.
Explicitly set its root to `storage_path('app')` to retain the previous location.
Served disks must have distinct URIs; sharing one causes an exception.
`Auth::login($user)` regenerates the session ID and CSRF token with the session
guard; clients submitting the previous CSRF token must refresh it.
## Frequently used APIs
### Container resolution and attributes
Auto-resolved class constructor parameters honor declared defaults. Contextual
class bindings take precedence over constructor defaults.
Use `#[Singleton]` or `#[Scoped]` on classes or interfaces for container lifetimes.
`#[BindWhen]` declares a conditional binding; starting in 13.24, a previous miss
can be followed by a match on a later resolution.
### Eloquent writes and relationships
`Post::query()->fillAndInsert([['title' => 'Draft']])` applies model defaults,
casts, and timestamps for timestamped models before bulk insertion.
Use `getPrevious()` after saving for previous values and `getChanges()` for values written.
`BelongsToMany` `*OrFail` methods run pivot changes in a transaction and roll back on exceptions.
`JsonApiResource` represents model attributes and relationships in JSON:API responses.
### Queries and schema changes
Use `inOrderOf()` to order rows by a supplied value list; enum cases are accepted starting in 13.26.
On PostgreSQL with `pgvector`, `whereVectorSimilarTo()` accepts plain-text search
against an embedding column. `Str::of($text)->toEmbeddings()` generates embeddings separately.
Use `online()` for PostgreSQL concurrent or SQL Server online index creation;
PostgreSQL requires `public $withinTransaction = false;` on the migration.
### HTTP pools and batches
HTTP pools default to two simultaneous requests when `concurrency` is omitted.
Use `Http::pool($requests, concurrency: 5)` or
`Http::batch($requests)->concurrency(5)->send()` to cap concurrency at five.
Here `$requests` is the callback defining requests. Batches support outcome
callbacks, preserve request order in results, and can dispatch after the response with `->defer()`.
### Queue dispatch and attributes
Use `Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'podcasts')`
for central routing. An explicit `onQueue()` overrides the job's queue attribute.
`#[Tries(3)]`, `#[Timeout(120)]`, `#[Backoff]`, and `#[FailOnTimeout]` declare job settings.
Use `Bus::bulk([new GenerateReport, new RefreshDashboard])` for bulk dispatch.
`Bus::batch()` and `Bus::bulk()` honor `#[Delay]` starting in 13.22.
### Worker and scheduler controls
Use `php artisan queue:pause redis:emails` and `php artisan queue:continue redis:emails`
to pause and resume a queue. Managed workers disable pausing.
Use `php artisan schedule:pause` and `php artisan schedule:resume` for scheduled tasks.
`Queue::withoutInterruptionPolling()` stops worker cache polling for restart and pause signals.
Run `php artisan reload` after deploying to signal registered long-running services
to reload and the scheduler to interrupt its current loop.
### Cache, locks, and files
`Cache::memo()->flexible('report', [60, 300], $buildReport)` combines memoization
with stale-while-revalidate. `Cache::rememberWithState()` returns cache state alongside the value.
`Cache::funnel()` limits simultaneous workers through any cache driver.
Use `copyToDisk()` or `moveToDisk()` on the source filesystem adapter for transfers
to a named disk or filesystem instance starting in 13.32.
### Strict validation and tests
Use `boolean:strict` for PHP booleans and `numeric:strict` for integers and floats,
rejecting numeric strings. `Rule::numeric()->integer(strict: true)` also rejects floats.
`FormRequest::failOnUnknownFields()` rejects fields absent from validation rules;
`FormRequest::flushState()` clears the setting between tests. In 13.35, strict form
requests ignore `_token` and `_method`. `JsonSchema::rules($schema)` derives validator rules in 12.73 and 13.43.
### Blade, console, and support
`@includeIsolated('orders.summary', ['order' => $order])` keeps parent view locals
out of the partial. `php artisan dev:list` lists registered development commands and their sources.
`Number::parseInt()` and `Number::parseFloat()` can return `false`; check `=== false`
so zero remains a successful parse. `Str::containsAll($text, [])` returns `false` in 13.20.