bhavin-gajjar/laravel-coder-lora-train huggingface dataset:
[Laravel 11] Explain upgrade: Composer Dependencies

You should update the following dependencies in your application's composer.json file:

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

- laravel/framework to ^11.0
- nunomaduro/collision to ^8.1
- laravel/breeze to ^2.0 (If installed)
- laravel/cashier to ^15.0 (If installed)
- laravel/dusk to ^8.0 (If installed)
- laravel/jetstream to ^5.0 (If installed)
- laravel/octane to ^2.3 (If installed)
- laravel/passport to ^12.0 (If installed)
- laravel/sanctum to ^4.0 (If installed)
- laravel/scout to ^10.0 (If installed)
- laravel/spark-stripe to ^5.0 (If installed)
- laravel/telescope to ^5.0 (If installed)
- livewire/livewire to ^3.4 (If installed)
- inertiajs/inertia-laravel to ^1.0 (If installed)

</div>

If your application is using Laravel Cashier Stripe, Passport, Sanctum, Spark Stripe, or Telescope, you will need to publish their migrations to your application. Cashier Stripe, Passport, Sanctum, Spark Stripe, and Telescope **no longer automatically load migrations from their own migrations** directory. Therefore, you should run the following command to publish their migrations to your application:

In addition, you should review the upgrade guides for each of these packages to ensure you are aware of any additional breaking changes:

- Laravel Cashier Stripe
- Laravel Passport
- Laravel Sanctum
- Laravel Spark Stripe
- Laravel Telescope

If you have manually installed the Laravel installer, you should update the installer via Composer:

Finally, you may remove the doctrine/dbal Composer dependency if you have previously added it to your application, as Laravel is no longer dependent on this package.

<a name="application-structure"></a>
[Laravel 11] 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:

    $post = App\Models\Post::find(1);

    echo url("/posts/{$post->id}");

    // http://example.com/posts/1

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

    echo url()->query('/posts', ['search' => 'Laravel']);

    // https://example.com/posts?search=Laravel

    echo url()->query('/posts?sort=latest', ['search' => 'Laravel']);

    // http://example.com/posts?sort=latest&search=Laravel

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

    echo url()->query('/posts?sort=latest', ['sort' => 'oldest']);

    // http://example.com/posts?sort=oldest

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

    echo $url = url()->query('/posts', ['columns' => ['title', 'body']]);

    // http://example.com/posts?columns%5B0%5D=title&columns%5B1%5D=body

    echo urldecode($url);

    // http://example.com/posts?columns[0]=title&columns[1]=body

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

If no path is provided to the url helper, an Illuminate\Routing\UrlGenerator instance is returned, allowing you to access information about the current URL:

    // Get the current URL without the query string...
    echo url()->current();

    // Get the current URL including the query string...
    echo url()->full();

    // Get the full URL for the previous request...
    echo url()->previous();

    // Get the path for the previous request...
    echo url()->previousPath();

Each of these methods may also be accessed via the URL facade:

    use Illuminate\Support\Facades\URL;

    echo URL::current();

<a name="urls-for-named-routes"></a>
[Laravel 11] 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:

    Route::get('/post/{post}', function (Post $post) {
        // ...
    })->name('post.show');

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

    echo route('post.show', ['post' => 1]);

    // http://example.com/post/1

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

    Route::get('/post/{post}/comment/{comment}', function (Post $post, Comment $comment) {
        // ...
    })->name('comment.show');

    echo route('comment.show', ['post' => 1, 'comment' => 3]);

    // http://example.com/post/1/comment/3

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

    echo route('post.show', ['post' => 1, 'search' => 'rocket']);

    // http://example.com/post/1?search=rocket

<a name="eloquent-models"></a>
[Laravel 11] Explain valet: Laravel Valet

- Introduction
- Installation
    - Upgrading Valet
- Serving Sites
    - The "Park" Command
    - The "Link" Command
    - Securing Sites With TLS
    - Serving a Default Site
    - Per-Site PHP Versions
- Sharing Sites
    - Sharing Sites on Your Local Network
- Site Specific Environment Variables
- Proxying Services
- Custom Valet Drivers
    - Local Drivers
- Other Valet Commands
- Valet Directories and Files
    - Disk Access

<a name="introduction"></a>
[Laravel 11] Explain valet: Introduction

> [!NOTE]  
> Looking for an even easier way to develop Laravel applications on macOS or Windows? Check out Laravel Herd. Herd includes everything you need to get started with Laravel development, including Valet, PHP, and Composer.

Laravel Valet is a development environment for macOS minimalists. Laravel Valet configures your Mac to always run Nginx in the background when your machine starts. Then, using DnsMasq, Valet proxies all requests on the *.test domain to point to sites installed on your local machine.

In other words, Valet is a blazing fast Laravel development environment that uses roughly 7 MB of RAM. Valet isn't a complete replacement for Sail or Homestead, but provides a great alternative if you want flexible basics, prefer extreme speed, or are working on a machine with a limited amount of RAM.

Out of the box, Valet support includes, but is not limited to:

<style>
    #valet-support > ul {
        column-count: 3; -moz-column-count: 3; -webkit-column-count: 3;
        line-height: 1.9;
    }
</style>

<div id="valet-support" markdown="1">

- Laravel
- Bedrock
- CakePHP 3
- ConcreteCMS
- Contao
- Craft
- Drupal
- ExpressionEngine
- Jigsaw
- Joomla
- Katana
- Kirby
- Magento
- OctoberCMS
- Sculpin
- Slim
- Statamic
- Static HTML
- Symfony
- WordPress
- Zend

</div>

However, you may extend Valet with your own custom drivers.

<a name="installation"></a>
[Laravel 11] Explain valet: Installation

> [!WARNING]  
> Valet requires macOS and Homebrew. Before installation, you should make sure that no other programs such as Apache or Nginx are binding to your local machine's port 80.

To get started, you first need to ensure that Homebrew is up to date using the update command:

Next, you should use Homebrew to install PHP:

After installing PHP, you are ready to install the Composer package manager. In addition, you should make sure the $HOME/.composer/vendor/bin directory is in your system's "PATH". After Composer has been installed, you may install Laravel Valet as a global Composer package:

Finally, you may execute Valet's install command. This will configure and install Valet and DnsMasq. In addition, the daemons Valet depends on will be configured to launch when your system starts:

Once Valet is installed, try pinging any *.test domain on your terminal using a command such as ping foobar.test. If Valet is installed correctly you should see this domain responding on 127.0.0.1.

Valet will automatically start its required services each time your machine boots.

<a name="php-versions"></a>
[Laravel 11] Explain valet: PHP Versions

> [!NOTE]  
> Instead of modifying your global PHP version, you can instruct Valet to use per-site PHP versions via the isolate command.

Valet allows you to switch PHP versions using the valet use php@version command. Valet will install the specified PHP version via Homebrew if it is not already installed:

You may also create a .valetrc file in the root of your project. The .valetrc file should contain the PHP version the site should use:

Once this file has been created, you may simply execute the valet use command and the command will determine the site's preferred PHP version by reading the file.

> [!WARNING]  
> Valet only serves one PHP version at a time, even if you have multiple PHP versions installed.

<a name="database"></a>
[Laravel 11] Explain validation: Validation

- Introduction
- Validation Quickstart
    - Defining the Routes
    - Creating the Controller
    - Writing the Validation Logic
    - Displaying the Validation Errors
    - Repopulating Forms
    - A Note on Optional Fields
    - Validation Error Response Format
- Form Request Validation
    - Creating Form Requests
    - Authorizing Form Requests
    - Customizing the Error Messages
    - Preparing Input for Validation
- Manually Creating Validators
    - Automatic Redirection
    - Named Error Bags
    - Customizing the Error Messages
    - Performing Additional Validation
- Working With Validated Input
- Working With Error Messages
    - Specifying Custom Messages in Language Files
    - Specifying Attributes in Language Files
    - Specifying Values in Language Files
- Available Validation Rules
- Conditionally Adding Rules
- Validating Arrays
    - Validating Nested Array Input
    - Error Message Indexes and Positions
- Validating Files
- Validating Passwords
- Custom Validation Rules
    - Using Rule Objects
    - Using Closures
    - Implicit Rules

<a name="introduction"></a>
[Laravel 11] Explain validation: Introduction

Laravel provides several different approaches to validate your application's incoming data. It is most common to use the validate method available on all incoming HTTP requests. However, we will discuss other approaches to validation as well.

Laravel includes a wide variety of convenient validation rules that you may apply to data, even providing the ability to validate if values are unique in a given database table. We'll cover each of these validation rules in detail so that you are familiar with all of Laravel's validation features.

<a name="validation-quickstart"></a>
[Laravel 11] Explain validation: Defining the Routes

First, let's assume we have the following routes defined in our routes/web.php file:

    use App\Http\Controllers\PostController;

    Route::get('/post/create', [PostController::class, 'create']);
    Route::post('/post', [PostController::class, 'store']);

The GET route will display a form for the user to create a new blog post, while the POST route will store the new blog post in the database.

<a name="quick-creating-the-controller"></a>
[Laravel 11] Explain validation: Creating the Controller

Next, let's take a look at a simple controller that handles incoming requests to these routes. We'll leave the store method empty for now:

    <?php

    namespace App\Http\Controllers;

    use Illuminate\Http\RedirectResponse;
    use Illuminate\Http\Request;
    use Illuminate\View\View;

    class PostController extends Controller
    {
        /**
         * Show the form to create a new blog post.
         */
        public function create(): View
        {
            return view('post.create');
        }

        /**
         * Store a new blog post.
         */
        public function store(Request $request): RedirectResponse
        {
            // Validate and store the blog post...

            $post = /** ... */

            return to_route('post.show', ['post' => $post->id]);
        }
    }

<a name="quick-writing-the-validation-logic"></a>
[Laravel 11] Explain verification: Introduction

Many web applications require users to verify their email addresses before using the application. Rather than forcing you to re-implement this feature by hand for each application you create, Laravel provides convenient built-in services for sending and verifying email verification requests.

> [!NOTE]  
> Want to get started fast? Install one of the Laravel application starter kits in a fresh Laravel application. The starter kits will take care of scaffolding your entire authentication system, including email verification support.

<a name="model-preparation"></a>
[Laravel 11] Explain verification: Model Preparation

Before getting started, verify that your App\Models\User model implements the Illuminate\Contracts\Auth\MustVerifyEmail contract:

    <?php

    namespace App\Models;

    use Illuminate\Contracts\Auth\MustVerifyEmail;
    use Illuminate\Foundation\Auth\User as Authenticatable;
    use Illuminate\Notifications\Notifiable;

    class User extends Authenticatable implements MustVerifyEmail
    {
        use Notifiable;

        // ...
    }

Once this interface has been added to your model, newly registered users will automatically be sent an email containing an email verification link. This happens seamlessly because Laravel automatically registers the Illuminate\Auth\Listeners\SendEmailVerificationNotification listener for the Illuminate\Auth\Events\Registered event.

If you are manually implementing registration within your application instead of using a starter kit, you should ensure that you are dispatching the Illuminate\Auth\Events\Registered event after a user's registration is successful:

    use Illuminate\Auth\Events\Registered;

    event(new Registered($user));

<a name="database-preparation"></a>
[Laravel 11] Explain verification: Routing

To properly implement email verification, three routes will need to be defined. First, a route will be needed to display a notice to the user that they should click the email verification link in the verification email that Laravel sent them after registration.

Second, a route will be needed to handle requests generated when the user clicks the email verification link in the email.

Third, a route will be needed to resend a verification link if the user accidentally loses the first verification link.

<a name="the-email-verification-notice"></a>
[Laravel 11] Explain views: Introduction

Of course, it's not practical to return entire HTML documents strings directly from your routes and controllers. Thankfully, views provide a convenient way to place all of our HTML in separate files.

Views separate your controller / application logic from your presentation logic and are stored in the resources/views directory. When using Laravel, view templates are usually written using the Blade templating language. A simple view might look something like this:

Since this view is stored at resources/views/greeting.blade.php, we may return it using the global view helper like so:

    Route::get('/', function () {
        return view('greeting', ['name' => 'James']);
    });

> [!NOTE]  
> Looking for more information on how to write Blade templates? Check out the full Blade documentation to get started.

<a name="writing-views-in-react-or-vue"></a>
[Laravel 11] Explain views: Writing Views in React / Vue

Instead of writing their frontend templates in PHP via Blade, many developers have begun to prefer to write their templates using React or Vue. Laravel makes this painless thanks to Inertia, a library that makes it a cinch to tie your React / Vue frontend to your Laravel backend without the typical complexities of building an SPA.

Our Breeze and Jetstream starter kits give you a great starting point for your next Laravel application powered by Inertia. In addition, the Laravel Bootcamp provides a full demonstration of building a Laravel application powered by Inertia, including examples in Vue and React.

<a name="creating-and-rendering-views"></a>
[Laravel 11] Explain views: Creating and Rendering Views

You may create a view by placing a file with the .blade.php extension in your application's resources/views directory or by using the make:view Artisan command:

The .blade.php extension informs the framework that the file contains a Blade template. Blade templates contain HTML as well as Blade directives that allow you to easily echo values, create "if" statements, iterate over data, and more.

Once you have created a view, you may return it from one of your application's routes or controllers using the global view helper:

    Route::get('/', function () {
        return view('greeting', ['name' => 'James']);
    });

Views may also be returned using the View facade:

    use Illuminate\Support\Facades\View;

    return View::make('greeting', ['name' => 'James']);

As you can see, the first argument passed to the view helper corresponds to the name of the view file in the resources/views directory. The second argument is an array of data that should be made available to the view. In this case, we are passing the name variable, which is displayed in the view using Blade syntax.

<a name="nested-view-directories"></a>
[Laravel 11] Explain views: Nested View Directories

Views may also be nested within subdirectories of the resources/views directory. "Dot" notation may be used to reference nested views. For example, if your view is stored at resources/views/admin/profile.blade.php, you may return it from one of your application's routes / controllers like so:

    return view('admin.profile', $data);

> [!WARNING]  
> View directory names should not contain the . character.

<a name="creating-the-first-available-view"></a>
[Laravel 11] Explain vite: Asset Bundling (Vite)

- Introduction
- Installation & Setup
  - Installing Node
  - Installing Vite and the Laravel Plugin
  - Configuring Vite
  - Loading Your Scripts and Styles
- Running Vite
- Working With JavaScript
  - Aliases
  - Vue
  - React
  - Inertia
  - URL Processing
- Working With Stylesheets
- Working With Blade and Routes
  - Processing Static Assets With Vite
  - Refreshing on Save
  - Aliases
- Asset Prefetching
- Custom Base URLs
- Environment Variables
- Disabling Vite in Tests
- Server-Side Rendering (SSR)
- Script and Style Tag Attributes
  - Content Security Policy (CSP) Nonce
  - Subresource Integrity (SRI)
  - Arbitrary Attributes
- Advanced Customization
  - Dev Server Cross-Origin Resource Sharing (CORS)
  - Correcting Dev Server URLs

<a name="introduction"></a>
[Laravel 11] Explain vite: Introduction

Vite is a modern frontend build tool that provides an extremely fast development environment and bundles your code for production. When building applications with Laravel, you will typically use Vite to bundle your application's CSS and JavaScript files into production ready assets.

Laravel integrates seamlessly with Vite by providing an official plugin and Blade directive to load your assets for development and production.

> [!NOTE]  
> Are you running Laravel Mix? Vite has replaced Laravel Mix in new Laravel installations. For Mix documentation, please visit the Laravel Mix website. If you would like to switch to Vite, please see our migration guide.

<a name="vite-or-mix"></a>
[Laravel 11] Explain vite: Choosing Between Vite and Laravel Mix

Before transitioning to Vite, new Laravel applications utilized Mix, which is powered by webpack, when bundling assets. Vite focuses on providing a faster and more productive experience when building rich JavaScript applications. If you are developing a Single Page Application (SPA), including those developed with tools like Inertia, Vite will be the perfect fit.

Vite also works well with traditional server-side rendered applications with JavaScript "sprinkles", including those using Livewire. However, it lacks some features that Laravel Mix supports, such as the ability to copy arbitrary assets into the build that are not referenced directly in your JavaScript application.

<a name="migrating-back-to-mix"></a>
[Laravel 12] Explain ai sdk: Laravel AI SDK

- Introduction
- Installation
    - Configuration
    - Custom Base URLs
    - Provider Support
- Agents
    - Prompting
    - Conversation Context
    - Structured Output
    - Attachments
    - Streaming
    - Broadcasting
    - Queueing
    - Tools
    - Provider Tools
    - Middleware
    - Anonymous Agents
    - Agent Configuration
    - Provider Options
- Images
- Audio (TTS)
- Transcription (STT)
- Embeddings
    - Querying Embeddings
    - Caching Embeddings
- Reranking
- Files
- Vector Stores
    - Adding Files to Stores
- Failover
- Testing
    - Agents
    - Images
    - Audio
    - Transcriptions
    - Embeddings
    - Reranking
    - Files
    - Vector Stores
- Events

<a name="introduction"></a>
[Laravel 12] Explain ai sdk: Custom Base URLs

By default, the Laravel AI SDK connects directly to each provider's public API endpoint. However, you may need to route requests through a different endpoint - for example, when using a proxy service to centralize API key management, implement rate limiting, or route traffic through a corporate gateway.

You may configure custom base URLs by adding a url parameter to your provider configuration:

This is useful when routing requests through a proxy service (such as LiteLLM or Azure OpenAI Gateway) or using alternative endpoints.

Custom base URLs are supported for the following providers: OpenAI, Anthropic, Gemini, Groq, Cohere, DeepSeek, xAI, and OpenRouter.

<a name="provider-support"></a>
[Laravel 12] Explain ai: Introduction

Laravel is uniquely positioned to be the best framework for AI assisted and agentic development. The rise of AI coding agents like Claude Code, OpenCode, Cursor, and GitHub Copilot has transformed how developers write code. These tools can generate entire features, debug complex issues, and refactor code at unprecedented speed - but their effectiveness depends heavily on how well they understand your codebase.

<a name="why-laravel-for-ai-development"></a>
[Laravel 12] Explain ai: Why Laravel for AI Development?

Laravel's opinionated conventions and well-defined structure make it an ideal framework for AI assisted development. When you ask an AI agent to add a controller, it knows exactly where to place it. When you need a new migration, the naming conventions and file locations are predictable. This consistency eliminates the guesswork that often trips up AI tools in more flexible frameworks.

Beyond file organization, Laravel's expressive syntax and comprehensive documentation give AI agents the context they need to generate accurate, idiomatic code. Features like Eloquent relationships, form requests, and middleware follow patterns that agents can reliably understand and replicate. The result is AI-generated code that looks like it was written by a seasoned Laravel developer, not stitched together from generic PHP snippets.

<a name="laravel-boost"></a>
[Laravel 12] Explain ai: Laravel Boost

Laravel Boost bridges the gap between AI coding agents and your Laravel application. Boost is an MCP (Model Context Protocol) server equipped with over 15 specialized tools that provide AI agents with deep insight into your application's structure, database, routes, and more. When you install Boost, your AI agent transforms from a general-purpose code assistant into a Laravel expert that understands your specific application.

Boost provides three major capabilities: a suite of MCP tools for inspecting and interacting with your application, composable AI guidelines crafted specifically for the Laravel ecosystem, and a powerful documentation API containing over 17,000 pieces of Laravel-specific knowledge.

<a name="installation"></a>