bhavin-gajjar/laravel-coder-lora-train huggingface dataset:
[Laravel 12] Explain sanctum: SPA Authentication

Second, Sanctum exists to offer a simple way to authenticate single page applications (SPAs) that need to communicate with a Laravel powered API. These SPAs might exist in the same repository as your Laravel application or might be an entirely separate repository, such as an SPA created using Next.js or Nuxt.

For this feature, Sanctum does not use tokens of any kind. Instead, Sanctum uses Laravel's built-in cookie based session authentication services. Typically, Sanctum utilizes Laravel's web authentication guard to accomplish this. This provides the benefits of CSRF protection, session authentication, as well as protects against leakage of the authentication credentials via XSS.

Sanctum will only attempt to authenticate using cookies when the incoming request originates from your own SPA frontend. When Sanctum examines an incoming HTTP request, it will first check for an authentication cookie and, if none is present, Sanctum will then examine the Authorization header for a valid API token.

> [!NOTE]
> It is perfectly fine to use Sanctum only for API token authentication or only for SPA authentication. Just because you use Sanctum does not mean you are required to use both features it offers.

<a name="installation"></a>
[Laravel 12] Explain scheduling: Task Scheduling

- Introduction
- Defining Schedules
    - Scheduling Artisan Commands
    - Scheduling Queued Jobs
    - Scheduling Shell Commands
    - Schedule Frequency Options
    - Timezones
    - Preventing Task Overlaps
    - Running Tasks on One Server
    - Background Tasks
    - Maintenance Mode
    - Schedule Groups
- Running the Scheduler
    - Sub-Minute Scheduled Tasks
    - Running the Scheduler Locally
- Task Output
- Task Hooks
- Events

<a name="introduction"></a>
[Laravel 12] Explain scheduling: Introduction

In the past, you may have written a cron configuration entry for each task you needed to schedule on your server. However, this can quickly become a pain because your task schedule is no longer in source control and you must SSH into your server to view your existing cron entries or add additional entries.

Laravel's command scheduler offers a fresh approach to managing scheduled tasks on your server. The scheduler allows you to fluently and expressively define your command schedule within your Laravel application itself. When using the scheduler, only a single cron entry is needed on your server. Your task schedule is typically defined in your application's routes/console.php file.

<a name="defining-schedules"></a>
[Laravel 12] Explain scheduling: Defining Schedules

You may define all of your scheduled tasks in your application's routes/console.php file. To get started, let's take a look at an example. In this example, we will schedule a closure to be called every day at midnight. Within the closure we will execute a database query to clear a table:

In addition to scheduling using closures, you may also schedule invokable objects. Invokable objects are simple PHP classes that contain an __invoke method:

If you prefer to reserve your routes/console.php file for command definitions only, you may use the withSchedule method in your application's bootstrap/app.php file to define your scheduled tasks. This method accepts a closure that receives an instance of the scheduler:

If you would like to view an overview of your scheduled tasks and the next time they are scheduled to run, you may use the schedule:list Artisan command:

<a name="scheduling-artisan-commands"></a>
[Laravel 12] Explain scheduling: Scheduling Artisan Commands

In addition to scheduling closures, you may also schedule Artisan commands and system commands. For example, you may use the command method to schedule an Artisan command using either the command's name or class.

When scheduling Artisan commands using the command's class name, you may pass an array of additional command-line arguments that should be provided to the command when it is invoked:

<a name="scheduling-artisan-closure-commands"></a>
[Laravel 12] Explain scout: Laravel Scout

- Introduction
- Installation
    - Queueing
- Driver Prerequisites
- Configuration
    - Configuring Searchable Data
- Database / Collection Engines
    - Database Engine
    - Collection Engine
- Third-Party Engine Configuration
    - Configuring Model Indexes
    - Algolia
    - Meilisearch
    - Typesense
- Third-Party Engine Indexing
    - Batch Import
    - Adding Records
    - Updating Records
    - Removing Records
    - Pausing Indexing
    - Conditionally Searchable Model Instances
- Searching
    - Where Clauses
    - Pagination
    - Soft Deleting
    - Customizing Engine Searches
- Custom Engines

<a name="introduction"></a>
[Laravel 12] Explain scout: Introduction

Laravel Scout provides a simple, driver-based solution for adding full-text search to your Eloquent models. Using model observers, Scout will automatically keep your search indexes in sync with your Eloquent records.

Scout ships with a built-in database engine that uses MySQL / PostgreSQL full-text indexes and LIKE clauses to search your existing database — no external service required. For most applications, this is all you need. For an overview of all search options available in Laravel, consult the search documentation.

Scout also includes drivers for Algolia, Meilisearch, and Typesense when you need features like typo tolerance, faceted filtering, or geo-search at massive scale. A "collection" driver is also available for local development, and you are free to write custom engines as well.

<a name="installation"></a>
[Laravel 12] Explain scout: Installation

First, install Scout via the Composer package manager:

After installing Scout, you should publish the Scout configuration file using the vendor:publish Artisan command. This command will publish the scout.php configuration file to your application's config directory:

Finally, add the Laravel\Scout\Searchable trait to the model you would like to make searchable. This trait will register a model observer that will automatically keep the model in sync with your search driver:

<a name="queueing"></a>
[Laravel 12] Explain scout: Queueing

When using an engine that is not the database or collection engine, you should strongly consider configuring a queue driver before using the library. Running a queue worker will allow Scout to queue all operations that sync your model information to your search indexes, providing much better response times for your application's web interface.

Once you have configured a queue driver, set the value of the queue option in your config/scout.php configuration file to true:

Even when the queue option is set to false, it's important to remember that some Scout drivers like Algolia and Meilisearch always index records asynchronously. In other words, even though the index operation has completed within your Laravel application, the search engine itself may not reflect the new and updated records immediately.

To specify the connection and queue that your Scout jobs utilize, you may define the queue configuration option as an array:

Of course, if you customize the connection and queue that Scout jobs utilize, you should run a queue worker to process jobs on that connection and queue:

<a name="driver-prerequisites"></a>
[Laravel 12] Explain search: Search

- Introduction
    - Full-Text Search
    - Semantic / Vector Search
    - Reranking
    - Scout Search Engines
- Full-Text Search
    - Adding Full-Text Indexes
    - Running Full-Text Queries
- Semantic / Vector Search
    - Generating Embeddings
    - Storing and Indexing Vectors
    - Querying by Similarity
- Reranking Results
- Laravel Scout
    - Database Engine
    - Third-Party Engines
- Combining Techniques

<a name="introduction"></a>
[Laravel 12] Explain search: Introduction

Almost every application needs search. Whether your users are searching a knowledge base for relevant articles, exploring a product catalog, or asking natural-language questions against a corpus of documents, Laravel provides built-in tools to handle each of these scenarios — and you often don't need any external services to get there.

Most applications will find that the built-in database-powered options provided by Laravel are more than sufficient — external search services are only necessary when you need features like typo tolerance, faceted filtering, or geo-search at massive scale.

<a name="introduction-full-text-search"></a>
[Laravel 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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
- WorkOS AuthKit Authentication
- Inertia SSR
- Community Maintained Starter Kits
- Frequently Asked Questions

<a name="introduction"></a>
[Laravel 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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 12] 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>