bhavin-gajjar/laravel-coder-lora-train huggingface dataset:
[Laravel 10] 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, twitter (OAuth 1.0), twitter-oauth-2 (OAuth 2.0), linkedin-openid, google, github, gitlab, bitbucket, or slack, depending on the providers your application requires:

    'github' => [
        'client_id' => env('GITHUB_CLIENT_ID'),
        'client_secret' => env('GITHUB_CLIENT_SECRET'),
        'redirect' => 'http://example.com/callback-url',
    ],

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

<a name="authentication"></a>
[Laravel 10] Explain starter kits: Introduction

To give you a head start building your new Laravel application, we are happy to offer authentication and application starter kits. These kits automatically scaffold your application with the routes, controllers, and views you need to register and authenticate your application's users.

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="laravel-breeze"></a>
[Laravel 10] Explain starter kits: Laravel Breeze

Laravel Breeze is a minimal, simple implementation of all of Laravel's authentication features, including login, registration, password reset, email verification, and password confirmation. In addition, Breeze includes a simple "profile" page where the user may update their name, email address, and password.

Laravel Breeze's default view layer is made up of simple Blade templates styled with Tailwind CSS. Additionally, Breeze provides scaffolding options based on Livewire or Inertia, with the choice of using Vue or React for the Inertia-based scaffolding.

<img src="https://laravel.com/img/docs/breeze-register.png">
[Laravel 10] Explain starter kits: Installation

First, you should create a new Laravel application, configure your database, and run your database migrations. Once you have created a new Laravel application, you may install Laravel Breeze using Composer:

After Composer has installed the Laravel Breeze package, you may run the breeze:install Artisan command. This command publishes the authentication views, routes, controllers, and other resources to your application. Laravel Breeze publishes all of its code to your application so that you have full control and visibility over its features and implementation.

The breeze:install command will prompt you for your preferred frontend stack and testing framework:

<a name="breeze-and-blade"></a>
[Laravel 10] 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 10] 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::contains
Str::containsAll
Str::endsWith
Str::excerpt
Str::finish
Str::headline
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::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::toHtmlString
Str::ucfirst
Str::ucsplit
Str::upper
Str::ulid
Str::unwrap
Str::uuid
Str::wordCount
Str::wordWrap
Str::words
Str::wrap
str
trans
trans_choice

</div>

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

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

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

</div>

<a name="strings"></a>
[Laravel 10] Explain strings: `__()` {.collection-method}

The __ function translates the given translation string or translation key using your language files:

    echo __('Welcome to our application');

    echo __('messages.welcome');

If the specified translation string or key does not exist, the __ function will return the given value. So, using the example above, the __ function would return messages.welcome if that translation key does not exist.

<a name="method-class-basename"></a>
[Laravel 10] 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 10] Explain structure: Introduction

The default Laravel application structure is intended to provide a great starting point for both large and small applications. But you are free to organize your application however you like. Laravel imposes almost no restrictions on where any given class is located - as long as Composer can autoload the class.

> [!NOTE]  
> New to Laravel? Check out the Laravel Bootcamp for a hands-on tour of the framework while we walk you through building your first Laravel application.

<a name="the-root-directory"></a>
[Laravel 10] 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 10] Explain telescope: Installation

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

After installing Telescope, publish its assets 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="migration-customization"></a>
[Laravel 10] 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 config/app.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:

    /**
     * Register any application services.
     */
    public function register(): void
    {
        if ($this->app->environment('local')) {
            $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
            $this->app->register(TelescopeServiceProvider::class);
        }
    }

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 10] Explain testing: Introduction

Laravel is built with testing in mind. In fact, support for testing with 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/phpunit or php artisan test commands to run your tests.

<a name="environment"></a>
[Laravel 10] 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 10] Explain upgrade: Low Impact Changes

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

- Closure Validation Rule Messages
- Form Request after Method
- Public Path Binding
- Query Exception Constructor
- Rate Limiter Return Values
- The Redirect::home Method
- The Bus::dispatchNow Method
- The registerPolicies Method
- ULID Columns

</div>

<a name="upgrade-10.0"></a>
[Laravel 10] 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 ^10.0
- laravel/sanctum to ^3.2
- doctrine/dbal to ^3.0
- spatie/laravel-ignition to ^2.0
- laravel/passport to ^11.0 (Upgrade Guide)
- laravel/ui to ^4.0

</div>

If you are upgrading to Sanctum 3.x from the 2.x release series, please consult the Sanctum upgrade guide.

Furthermore, if you wish to use PHPUnit 10, you should delete the processUncoveredFiles attribute from the <coverage> section of your application's phpunit.xml configuration file. Then, update the following dependencies in your application's composer.json file:

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

- nunomaduro/collision to ^7.0
- phpunit/phpunit to ^10.0

</div>

Finally, examine any other third-party packages consumed by your application and verify you are using the proper version for Laravel 10 support.

<a name="updating-minimum-stability"></a>
[Laravel 10] 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

<a name="accessing-the-current-url"></a>
[Laravel 10] 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();

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 10] 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 10] 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 10] Explain valet: Introduction

> [!NOTE]  
> Looking for an even easier way to develop Laravel applications on macOS? 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 10] 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 10] 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 10] 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 10] 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 10] 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 10] 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 10] 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 10] 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. As you can see by examining your application's App\Providers\EventServiceProvider, Laravel already contains a SendEmailVerificationNotification listener that is attached to the Illuminate\Auth\Events\Registered event. This event listener will send the email verification link to the user.

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>