bhavin-gajjar/laravel-coder-lora-train huggingface dataset:
[Laravel 13] Explain search: Full-Text Search

When you need keyword relevance ranking — where the database scores and sorts results based on how well they match the search terms — Laravel's whereFullText query builder method leverages native full-text indexes on MariaDB, MySQL, and PostgreSQL. Full-text search understands word boundaries and stemming, so a search for "running" can match records containing "run". No external service is required.

<a name="introduction-semantic-vector-search"></a>
[Laravel 13] Explain search: Semantic / Vector Search

For AI-powered semantic search that matches results by *meaning* rather than exact keywords, the whereVectorSimilarTo query builder method uses vector embeddings stored in PostgreSQL with the pgvector extension. For example, a search for "best wineries in Napa Valley" can surface an article titled "Top Vineyards to Visit" — even though the words don't overlap. Vector search requires PostgreSQL with the pgvector extension and the Laravel AI SDK.

<a name="introduction-reranking"></a>
[Laravel 13] Explain seeding: Introduction

Laravel includes the ability to seed your database with data using seed classes. All seed classes are stored in the database/seeders directory. By default, a DatabaseSeeder class is defined for you. From this class, you may use the call method to run other seed classes, allowing you to control the seeding order.

> [!NOTE]
> Mass assignment protection is automatically disabled during database seeding.

<a name="writing-seeders"></a>
[Laravel 13] Explain seeding: Writing Seeders

To generate a seeder, execute the make:seeder Artisan command. All seeders generated by the framework will be placed in the database/seeders directory:

A seeder class only contains one method by default: run. This method is called when the db:seed Artisan command is executed. Within the run method, you may insert data into your database however you wish. You may use the query builder to manually insert data or you may use Eloquent model factories.

As an example, let's modify the default DatabaseSeeder class and add a database insert statement to the run method:

> [!NOTE]
> You may type-hint any dependencies you need within the run method's signature. They will automatically be resolved via the Laravel service container.

<a name="using-model-factories"></a>
[Laravel 13] Explain session: HTTP Session

- Introduction
    - Configuration
    - Driver Prerequisites
- Interacting With the Session
    - Retrieving Data
    - Storing Data
    - Flash Data
    - Deleting Data
    - Regenerating the Session ID
- Session Cache
- Session Blocking
- Adding Custom Session Drivers
    - Implementing the Driver
    - Registering the Driver

<a name="introduction"></a>
[Laravel 13] Explain session: Configuration

Your application's session configuration file is stored at config/session.php. Be sure to review the options available to you in this file. By default, Laravel is configured to use the database session driver.

The session driver configuration option defines where session data will be stored for each request. Laravel includes a variety of drivers:

<div class="content-list" markdown="1">

- file - sessions are stored in storage/framework/sessions.
- cookie - sessions are stored in secure, encrypted cookies.
- database - sessions are stored in a relational database.
- memcached / redis - sessions are stored in one of these fast, cache-based stores.
- dynamodb - sessions are stored in AWS DynamoDB.
- array - sessions are stored in a PHP array and will not be persisted.

</div>

> [!NOTE]
> The array driver is primarily used during testing and prevents the data stored in the session from being persisted.

<a name="driver-prerequisites"></a>
[Laravel 13] Explain session: Database

When using the database session driver, you will need to ensure that you have a database table to contain the session data. Typically, this is included in Laravel's default 0001_01_01_000000_create_users_table.php database migration; however, if for any reason you do not have a sessions table, you may use the make:session-table Artisan command to generate this migration:

<a name="redis"></a>
[Laravel 13] Explain session: Redis

Before using Redis sessions with Laravel, you will need to either install the PhpRedis PHP extension via PECL or install the predis/predis package (~1.0) via Composer. For more information on configuring Redis, consult Laravel's Redis documentation.

> [!NOTE]
> The SESSION_CONNECTION environment variable, or the connection option in the session.php configuration file, may be used to specify which Redis connection is used for session storage.

<a name="interacting-with-the-session"></a>
[Laravel 13] Explain session: Retrieving Data

There are two primary ways of working with session data in Laravel: the global session helper and via a Request instance. First, let's look at accessing the session via a Request instance, which can be type-hinted on a route closure or controller method. Remember, controller method dependencies are automatically injected via the Laravel service container:

When you retrieve an item from the session, you may also pass a default value as the second argument to the get method. This default value will be returned if the specified key does not exist in the session. If you pass a closure as the default value to the get method and the requested key does not exist, the closure will be executed and its result returned:

<a name="the-global-session-helper"></a>
[Laravel 13] Explain socialite: Introduction

In addition to typical, form based authentication, Laravel also provides a simple, convenient way to authenticate with OAuth providers using Laravel Socialite. Socialite currently supports authentication via Facebook, X, LinkedIn, Google, GitHub, GitLab, Bitbucket, and Slack.

> [!NOTE]
> Adapters for other platforms are available via the community driven Socialite Providers website.

<a name="installation"></a>
[Laravel 13] Explain socialite: Configuration

Before using Socialite, you will need to add credentials for the OAuth providers your application utilizes. Typically, these credentials may be retrieved by creating a "developer application" within the dashboard of the service you will be authenticating with.

These credentials should be placed in your application's config/services.php configuration file, and should use the key facebook, x, linkedin-openid, google, github, gitlab, bitbucket, slack, or slack-openid, depending on the providers your application requires:

> [!NOTE]
> If the redirect option contains a relative path, it will automatically be resolved to a fully qualified URL.

<a name="authentication"></a>
[Laravel 13] Explain socialite: Routing

To authenticate users using an OAuth provider, you will need two routes: one for redirecting the user to the OAuth provider, and another for receiving the callback from the provider after authentication. The example routes below demonstrate the implementation of both routes:

The redirect method provided by the Socialite facade takes care of redirecting the user to the OAuth provider, while the user method will examine the incoming request and retrieve the user's information from the provider after they have approved the authentication request.

<a name="authentication-and-storage"></a>
[Laravel 13] Explain starter kits: Starter Kits

- Introduction
- Creating an Application Using a Starter Kit
- Available Starter Kits
    - React
    - Svelte
    - Vue
    - Livewire
- Starter Kit Customization
    - React
    - Svelte
    - Vue
    - Livewire
- Authentication
    - Enabling and Disabling Features
    - Customizing User Creation and Password Reset
    - Two-Factor Authentication
    - Rate Limiting
- Teams
- WorkOS AuthKit Authentication
- Inertia SSR
- Community Maintained Starter Kits
- Frequently Asked Questions

<a name="introduction"></a>
[Laravel 13] Explain starter kits: Introduction

To give you a head start building your new Laravel application, we are happy to offer application starter kits. These starter kits give you a head start on building your next Laravel application, and include the routes, controllers, and views you need to register and authenticate your application's users. The starter kits use Laravel Fortify to provide authentication.

While you are welcome to use these starter kits, they are not required. You are free to build your own application from the ground up by simply installing a fresh copy of Laravel. Either way, we know you will build something great!

<a name="creating-an-application"></a>
[Laravel 13] Explain starter kits: Creating an Application Using a Starter Kit

To create a new Laravel application using one of our starter kits, you should first install PHP and the Laravel CLI tool. If you already have PHP and Composer installed, you may install the Laravel installer CLI tool via Composer:

Then, create a new Laravel application using the Laravel installer CLI. The Laravel installer will prompt you to select your preferred starter kit:

After creating your Laravel application, you only need to install its frontend dependencies via NPM and start the Laravel development server:

Once you have started the Laravel development server, your application will be accessible in your web browser at http://localhost:8000.

<a name="available-starter-kits"></a>
[Laravel 13] Explain starter kits: React

Our React starter kit provides a robust, modern starting point for building Laravel applications with a React frontend using Inertia.

Inertia allows you to build modern, single-page React applications using classic server-side routing and controllers. This lets you enjoy the frontend power of React combined with the incredible backend productivity of Laravel and lightning-fast Vite compilation.

The React starter kit utilizes React 19, TypeScript, Tailwind, and the shadcn/ui component library.

<a name="svelte"></a>
[Laravel 13] Explain starter kits: Svelte

Our Svelte starter kit provides a robust, modern starting point for building Laravel applications with a Svelte frontend using Inertia.

Inertia allows you to build modern, single-page Svelte applications using classic server-side routing and controllers. This lets you enjoy the frontend power of Svelte combined with the incredible backend productivity of Laravel and lightning-fast Vite compilation.

The Svelte starter kit utilizes Svelte 5, TypeScript, Tailwind, and the shadcn-svelte component library.

<a name="vue"></a>
[Laravel 13] Explain starter kits: Vue

Our Vue starter kit provides a great starting point for building Laravel applications with a Vue frontend using Inertia.

Inertia allows you to build modern, single-page Vue applications using classic server-side routing and controllers. This lets you enjoy the frontend power of Vue combined with the incredible backend productivity of Laravel and lightning-fast Vite compilation.

The Vue starter kit utilizes the Vue Composition API, TypeScript, Tailwind, and the shadcn-vue component library.

<a name="livewire"></a>
[Laravel 13] Explain strings: Available Methods

<style>
    .collection-method-list > p {
        columns: 10.8em 3; -moz-columns: 10.8em 3; -webkit-columns: 10.8em 3;
    }

    .collection-method-list a {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
</style>

<a name="strings-method-list"></a>
[Laravel 13] Explain strings: Strings

<div class="collection-method-list" markdown="1">

\__
class_basename
e
preg_replace_array
Str::after
Str::afterLast
Str::apa
Str::ascii
Str::before
Str::beforeLast
Str::between
Str::betweenFirst
Str::camel
Str::charAt
Str::chopStart
Str::chopEnd
Str::contains
Str::containsAll
Str::doesntContain
Str::doesntEndWith
Str::doesntStartWith
Str::deduplicate
Str::endsWith
Str::excerpt
Str::finish
Str::fromBase64
Str::headline
Str::initials
Str::inlineMarkdown
Str::is
Str::isAscii
Str::isJson
Str::isUlid
Str::isUrl
Str::isUuid
Str::kebab
Str::lcfirst
Str::length
Str::limit
Str::lower
Str::markdown
Str::mask
Str::match
Str::matchAll
Str::isMatch
Str::orderedUuid
Str::padBoth
Str::padLeft
Str::padRight
Str::password
Str::plural
Str::pluralStudly
Str::position
Str::random
Str::remove
Str::repeat
Str::replace
Str::replaceArray
Str::replaceFirst
Str::replaceLast
Str::replaceMatches
Str::replaceStart
Str::replaceEnd
Str::reverse
Str::singular
Str::slug
Str::snake
Str::squish
Str::start
Str::startsWith
Str::studly
Str::substr
Str::substrCount
Str::substrReplace
Str::swap
Str::take
Str::title
Str::toBase64
Str::transliterate
Str::trim
Str::ltrim
Str::rtrim
Str::ucfirst
Str::ucsplit
Str::ucwords
Str::upper
Str::ulid
Str::unwrap
Str::uuid
Str::uuid7
Str::wordCount
Str::wordWrap
Str::words
Str::wrap
str
trans
trans_choice

</div>

<a name="fluent-strings-method-list"></a>
[Laravel 13] Explain strings: Fluent Strings

<div class="collection-method-list" markdown="1">

after
afterLast
apa
append
ascii
basename
before
beforeLast
between
betweenFirst
camel
charAt
classBasename
chopStart
chopEnd
contains
containsAll
decrypt
deduplicate
dirname
doesntContain
doesntEndWith
doesntStartWith
encrypt
endsWith
exactly
excerpt
explode
finish
fromBase64
hash
headline
initials
inlineMarkdown
is
isAscii
isEmpty
isNotEmpty
isJson
isUlid
isUrl
isUuid
kebab
lcfirst
length
limit
lower
markdown
mask
match
matchAll
isMatch
newLine
padBoth
padLeft
padRight
pipe
plural
position
prepend
remove
repeat
replace
replaceArray
replaceFirst
replaceLast
replaceMatches
replaceStart
replaceEnd
scan
singular
slug
snake
split
squish
start
startsWith
stripTags
studly
substr
substrReplace
swap
take
tap
test
title
toBase64
toHtmlString
toUri
transliterate
trim
ltrim
rtrim
ucfirst
ucsplit
ucwords
unwrap
upper
when
whenContains
whenContainsAll
whenDoesntEndWith
whenDoesntStartWith
whenEmpty
whenNotEmpty
whenStartsWith
whenEndsWith
whenExactly
whenNotExactly
whenIs
whenIsAscii
whenIsUlid
whenIsUuid
whenTest
wordCount
words
wrap

</div>

<a name="strings"></a>
[Laravel 13] Explain structure: Directory Structure

- Introduction
- The Root Directory
    - The app Directory
    - The bootstrap Directory
    - The config Directory
    - The database Directory
    - The public Directory
    - The resources Directory
    - The routes Directory
    - The storage Directory
    - The tests Directory
    - The vendor Directory
- The App Directory
    - The Broadcasting Directory
    - The Console Directory
    - The Events Directory
    - The Exceptions Directory
    - The Http Directory
    - The Jobs Directory
    - The Listeners Directory
    - The Mail Directory
    - The Models Directory
    - The Notifications Directory
    - The Policies Directory
    - The Providers Directory
    - The Rules Directory

<a name="introduction"></a>
[Laravel 13] Explain telescope: Laravel Telescope

- Introduction
- Installation
    - Local Only Installation
    - Configuration
    - Data Pruning
    - Dashboard Authorization
- Upgrading Telescope
- Filtering
    - Entries
    - Batches
- Tagging
- Available Watchers
    - Batch Watcher
    - Cache Watcher
    - Command Watcher
    - Dump Watcher
    - Event Watcher
    - Exception Watcher
    - Gate Watcher
    - HTTP Client Watcher
    - Job Watcher
    - Log Watcher
    - Mail Watcher
    - Model Watcher
    - Notification Watcher
    - Query Watcher
    - Redis Watcher
    - Request Watcher
    - Schedule Watcher
    - View Watcher
- Displaying User Avatars

<a name="introduction"></a>
[Laravel 13] Explain telescope: Installation

You may use the Composer package manager to install Telescope into your Laravel project:

After installing Telescope, publish its assets and migrations using the telescope:install Artisan command. After installing Telescope, you should also run the migrate command in order to create the tables needed to store Telescope's data:

Finally, you may access the Telescope dashboard via the /telescope route.

<a name="local-only-installation"></a>
[Laravel 13] Explain telescope: Local Only Installation

If you plan to only use Telescope to assist your local development, you may install Telescope using the --dev flag:

After running telescope:install, you should remove the TelescopeServiceProvider service provider registration from your application's bootstrap/providers.php configuration file. Instead, manually register Telescope's service providers in the register method of your App\Providers\AppServiceProvider class. We will ensure the current environment is local before registering the providers:

Finally, you should also prevent the Telescope package from being auto-discovered by adding the following to your composer.json file:

<a name="configuration"></a>
[Laravel 13] Explain telescope: Data Pruning

Without pruning, the telescope_entries table can accumulate records very quickly. To mitigate this, you should schedule the telescope:prune Artisan command to run daily:

By default, all entries older than 24 hours will be pruned. You may use the hours option when calling the command to determine how long to retain Telescope data. For example, the following command will delete all records created over 48 hours ago:

<a name="dashboard-authorization"></a>
[Laravel 13] Explain testing: Introduction

Laravel is built with testing in mind. In fact, support for testing with Pest and PHPUnit is included out of the box and a phpunit.xml file is already set up for your application. The framework also ships with convenient helper methods that allow you to expressively test your applications.

By default, your application's tests directory contains two directories: Feature and Unit. Unit tests are tests that focus on a very small, isolated portion of your code. In fact, most unit tests probably focus on a single method. Tests within your "Unit" test directory do not boot your Laravel application and therefore are unable to access your application's database or other framework services.

Feature tests may test a larger portion of your code, including how several objects interact with each other or even a full HTTP request to a JSON endpoint. **Generally, most of your tests should be feature tests. These types of tests provide the most confidence that your system as a whole is functioning as intended.**

An ExampleTest.php file is provided in both the Feature and Unit test directories. After installing a new Laravel application, execute the vendor/bin/pest, vendor/bin/phpunit, or php artisan test commands to run your tests.

<a name="environment"></a>
[Laravel 13] Explain testing: Environment

When running tests, Laravel will automatically set the configuration environment to testing because of the environment variables defined in the phpunit.xml file. Laravel also automatically configures the session and cache to the array driver so that no session or cache data will be persisted while testing.

You are free to define other testing environment configuration values as necessary. The testing environment variables may be configured in your application's phpunit.xml file, but make sure to clear your configuration cache using the config:clear Artisan command before running your tests!

<a name="the-env-testing-environment-file"></a>
[Laravel 13] Explain testing: Creating Tests

To create a new test case, use the make:test Artisan command. By default, tests will be placed in the tests/Feature directory:

If you would like to create a test within the tests/Unit directory, you may use the --unit option when executing the make:test command:

If you have a test class that mostly relies on Laravel's testing features, but a specific test method does not need the framework booted, you may apply the #[UnitTest] attribute to that method to skip booting the application for just that test.

> [!NOTE]
> Test stubs may be customized using stub publishing.

Once the test has been generated, you may define test as you normally would using Pest or PHPUnit. To run your tests, execute the vendor/bin/pest, vendor/bin/phpunit, or php artisan test command from your terminal:

> [!WARNING]
> If you define your own setUp / tearDown methods within a test class, be sure to call the respective parent::setUp() / parent::tearDown() methods on the parent class. Typically, you should invoke parent::setUp() at the start of your own setUp method, and parent::tearDown() at the end of your tearDown method.

<a name="running-tests"></a>
[Laravel 13] Explain testing: Running Tests

As mentioned previously, once you've written tests, you may run them using pest or phpunit:

In addition to the pest or phpunit commands, you may use the test Artisan command to run your tests. The Artisan test runner provides verbose test reports in order to ease development and debugging:

Any arguments that can be passed to the pest or phpunit commands may also be passed to the Artisan test command:

<a name="running-tests-in-parallel"></a>
[Laravel 13] Explain upgrade: Low Impact Changes

<div class="content-list" markdown="1">

- Cache Prefixes and Session Cookie Names
- Collection Model Serialization Restores Eager-Loaded Relations
- Container::call and Nullable Class Defaults
- Domain Route Registration Precedence
- JobAttempted Event Exception Payload
- Manager extend Callback Binding
- MySQL DELETE Queries With JOIN, ORDER BY, and LIMIT
- Pagination Bootstrap View Names
- Polymorphic Pivot Table Name Generation
- QueueBusy Event Property Rename
- Str Factories Reset Between Tests

</div>

<a name="upgrade-13.0"></a>
[Laravel 13] Explain upgrade: Estimated Upgrade Time: 10 Minutes

> [!NOTE]
> We attempt to document every possible breaking change. Since some of these breaking changes are in obscure parts of the framework only a portion of these changes may actually affect your application. To save time, you may use Shift. Shift is a community-maintained service that automates Laravel upgrades.

<a name="upgrading-using-ai"></a>
[Laravel 13] Explain upgrade: Upgrading Using AI

You can automate your upgrade using Laravel Boost. Boost is a first-party MCP server that provides your AI assistant with guided upgrade prompts — once installed in any Laravel 12 application, use the /upgrade-laravel-v13 slash command in Claude Code, Cursor, OpenCode, Gemini, or VS Code to begin the upgrade to Laravel 13. This command requires Laravel Boost ^2.0.

<a name="updating-dependencies"></a>
[Laravel 13] Explain urls: Generating URLs

The url helper may be used to generate arbitrary URLs for your application. The generated URL will automatically use the scheme (HTTP or HTTPS) and host from the current request being handled by the application:

To generate a URL with query string parameters, you may use the query method:

Providing query string parameters that already exist in the path will overwrite their existing value:

Arrays of values may also be passed as query parameters. These values will be properly keyed and encoded in the generated URL:

<a name="accessing-the-current-url"></a>
[Laravel 13] Explain urls: Accessing the Previous URL

Sometimes it is helpful to know the previous URL that the user is visiting from. You can access the previous URL via the url helper's previous and previousPath methods:

Or, via the session, you may access the previous URL as a fluent URI instance:

It is also possible to retrieve the route name for the previously visited URL via the session:

<a name="urls-for-named-routes"></a>
[Laravel 13] Explain urls: URLs for Named Routes

The route helper may be used to generate URLs to named routes. Named routes allow you to generate URLs without being coupled to the actual URL defined on the route. Therefore, if the route's URL changes, no changes need to be made to your calls to the route function. For example, imagine your application contains a route defined like the following:

To generate a URL to this route, you may use the route helper like so:

Of course, the route helper may also be used to generate URLs for routes with multiple parameters:

Any additional array elements that do not correspond to the route's definition parameters will be added to the URL's query string:

<a name="eloquent-models"></a>