id stringlengths 6 6 | text stringlengths 20 17.2k | title stringclasses 1
value |
|---|---|---|
243002 | # Views
- [Introduction](#introduction)
- [Writing Views in React / Vue](#writing-views-in-react-or-vue)
- [Creating and Rendering Views](#creating-and-rendering-views)
- [Nested View Directories](#nested-view-directories)
- [Creating the First Available View](#creating-the-first-available-view)
- [Det... | |
243004 | # Middleware
- [Introduction](#introduction)
- [Defining Middleware](#defining-middleware)
- [Registering Middleware](#registering-middleware)
- [Global Middleware](#global-middleware)
- [Assigning Middleware to Routes](#assigning-middleware-to-routes)
- [Middleware Groups](#middleware-groups)
- [Middl... | |
243005 | ## Registering Middleware
<a name="global-middleware"></a>
### Global Middleware
If you want a middleware to run during every HTTP request to your application, you may append it to the global middleware stack in your application's `bootstrap/app.php` file:
use App\Http\Middleware\EnsureTokenIsValid;
->withM... | |
243006 | ### Middleware Aliases
You may assign aliases to middleware in your application's `bootstrap/app.php` file. Middleware aliases allow you to define a short alias for a given middleware class, which can be especially useful for middleware with long class names:
use App\Http\Middleware\EnsureUserIsSubscribed;
-... | |
243007 | # Database: Pagination
- [Introduction](#introduction)
- [Basic Usage](#basic-usage)
- [Paginating Query Builder Results](#paginating-query-builder-results)
- [Paginating Eloquent Results](#paginating-eloquent-results)
- [Cursor Pagination](#cursor-pagination)
- [Manually Creating a Paginator](#manuall... | |
243008 | ## Basic Usage
<a name="paginating-query-builder-results"></a>
### Paginating Query Builder Results
There are several ways to paginate items. The simplest is by using the `paginate` method on the [query builder](/docs/{{version}}/queries) or an [Eloquent query](/docs/{{version}}/eloquent). The `paginate` method autom... | |
243009 | ### Customizing Pagination URLs
By default, links generated by the paginator will match the current request's URI. However, the paginator's `withPath` method allows you to customize the URI used by the paginator when generating links. For example, if you want the paginator to generate links like `http://example.com/ad... | |
243012 | ## Routing
To properly implement support for allowing users to reset their passwords, we will need to define several routes. First, we will need a pair of routes to handle allowing the user to request a password reset link via their email address. Second, we will need a pair of routes to handle actually resetting the ... | |
243014 | # Laravel Telescope
- [Introduction](#introduction)
- [Installation](#installation)
- [Local Only Installation](#local-only-installation)
- [Configuration](#configuration)
- [Data Pruning](#data-pruning)
- [Dashboard Authorization](#dashboard-authorization)
- [Upgrading Telescope](#upgrading-telescope)... | |
243017 | # Error Handling
- [Introduction](#introduction)
- [Configuration](#configuration)
- [Handling Exceptions](#handling-exceptions)
- [Reporting Exceptions](#reporting-exceptions)
- [Exception Log Levels](#exception-log-levels)
- [Ignoring Exceptions by Type](#ignoring-exceptions-by-type)
- [Rendering Exc... | |
243018 | ### Rendering Exceptions
By default, the Laravel exception handler will convert exceptions into an HTTP response for you. However, you are free to register a custom rendering closure for exceptions of a given type. You may accomplish this by using the `render` exception method in your application's `bootstrap/app.php`... | |
243019 | ## HTTP Exceptions
Some exceptions describe HTTP error codes from the server. For example, this may be a "page not found" error (404), an "unauthorized error" (401), or even a developer generated 500 error. In order to generate such a response from anywhere in your application, you may use the `abort` helper:
abo... | |
243021 | # URL Generation
- [Introduction](#introduction)
- [The Basics](#the-basics)
- [Generating URLs](#generating-urls)
- [Accessing the Current URL](#accessing-the-current-url)
- [URLs for Named Routes](#urls-for-named-routes)
- [Signed URLs](#signed-urls)
- [URLs for Controller Actions](#urls-for-controller-a... | |
243022 | ## Default Values
For some applications, you may wish to specify request-wide default values for certain URL parameters. For example, imagine many of your routes define a `{locale}` parameter:
Route::get('/{locale}/posts', function () {
// ...
})->name('post.index');
It is cumbersome to always pass t... | |
243024 | ## Writing Commands
In addition to the commands provided with Artisan, you may build your own custom commands. Commands are typically stored in the `app/Console/Commands` directory; however, you are free to choose your own storage location as long as your commands can be loaded by Composer.
<a name="generating-comman... | |
243026 | ## Command I/O
<a name="retrieving-input"></a>
### Retrieving Input
While your command is executing, you will likely need to access the values for the arguments and options accepted by your command. To do so, you may use the `argument` and `option` methods. If an argument or option does not exist, `null` will be retu... | |
243028 | # Laravel Folio
- [Introduction](#introduction)
- [Installation](#installation)
- [Page Paths / URIs](#page-paths-uris)
- [Subdomain Routing](#subdomain-routing)
- [Creating Routes](#creating-routes)
- [Nested Routes](#nested-routes)
- [Index Routes](#index-routes)
- [Route Parameters](#route-parameter... | |
243030 | # Testing: Getting Started
- [Introduction](#introduction)
- [Environment](#environment)
- [Creating Tests](#creating-tests)
- [Running Tests](#running-tests)
- [Running Tests in Parallel](#running-tests-in-parallel)
- [Reporting Test Coverage](#reporting-test-coverage)
- [Profiling Tests](#profiling-tests... | |
243033 | ## Interacting With The Request
<a name="accessing-the-request"></a>
### Accessing the Request
To obtain an instance of the current HTTP request via dependency injection, you should type-hint the `Illuminate\Http\Request` class on your route closure or controller method. The incoming request instance will automatical... | |
243034 | ## Input
<a name="retrieving-input"></a>
### Retrieving Input
<a name="retrieving-all-input-data"></a>
#### Retrieving All Input Data
You may retrieve all of the incoming request's input data as an `array` using the `all` method. This method may be used regardless of whether the incoming request is from an HTML form... | |
243035 | ### Input Presence
You may use the `has` method to determine if a value is present on the request. The `has` method returns `true` if the value is present on the request:
if ($request->has('name')) {
// ...
}
When given an array, the `has` method will determine if all of the specified values are pres... | |
243037 | # Laravel Reverb
- [Introduction](#introduction)
- [Installation](#installation)
- [Configuration](#configuration)
- [Application Credentials](#application-credentials)
- [Allowed Origins](#allowed-origins)
- [Additional Applications](#additional-applications)
- [SSL](#ssl)
- [Running the Server](#runn... | |
243042 | ### Selling Subscriptions
> [!NOTE]
> Before utilizing Stripe Checkout, you should define Products with fixed prices in your Stripe dashboard. In addition, you should [configure Cashier's webhook handling](#handling-stripe-webhooks).
Offering product and subscription billing via your application can be intimidating... | |
243052 | ## Invoices
<a name="retrieving-invoices"></a>
### Retrieving Invoices
You may easily retrieve an array of a billable model's invoices using the `invoices` method. The `invoices` method returns a collection of `Laravel\Cashier\Invoice` instances:
$invoices = $user->invoices();
If you would like to include pendi... | |
243064 | ### Job Chaining
Job chaining allows you to specify a list of queued jobs that should be run in sequence after the primary job has executed successfully. If one job in the sequence fails, the rest of the jobs will not be run. To execute a queued job chain, you may use the `chain` method provided by the `Bus` facade. L... | |
243065 | ### Specifying Max Job Attempts / Timeout Values
<a name="max-attempts"></a>
#### Max Attempts
If one of your queued jobs is encountering an error, you likely do not want it to keep retrying indefinitely. Therefore, Laravel provides various ways to specify how many times or for how long a job may be attempted.
One a... | |
243068 | ## Running the Queue Worker
<a name="the-queue-work-command"></a>
### The `queue:work` Command
Laravel includes an Artisan command that will start a queue worker and process new jobs as they are pushed onto the queue. You may run the worker using the `queue:work` Artisan command. Note that once the `queue:work` comma... | |
243069 | ### Job Expirations and Timeouts
<a name="job-expiration"></a>
#### Job Expiration
In your `config/queue.php` configuration file, each queue connection defines a `retry_after` option. This option specifies how many seconds the queue connection should wait before retrying a job that is being processed. For example, if... | |
243076 | # Laravel Passport
- [Introduction](#introduction)
- [Passport or Sanctum?](#passport-or-sanctum)
- [Installation](#installation)
- [Deploying Passport](#deploying-passport)
- [Upgrading Passport](#upgrading-passport)
- [Configuration](#configuration)
- [Client Secret Hashing](#client-secret-hashing)
... | |
243078 | ### Requesting Tokens
<a name="requesting-tokens-redirecting-for-authorization"></a>
#### Redirecting for Authorization
Once a client has been created, developers may use their client ID and secret to request an authorization code and access token from your application. First, the consuming application should make a ... | |
243081 | ## Client Credentials Grant Tokens
The client credentials grant is suitable for machine-to-machine authentication. For example, you might use this grant in a scheduled job which is performing maintenance tasks over an API.
Before your application can issue tokens via the client credentials grant, you will need to cre... | |
243082 | ## Token Scopes
Scopes allow your API clients to request a specific set of permissions when requesting authorization to access an account. For example, if you are building an e-commerce application, not all API consumers will need the ability to place orders. Instead, you may allow the consumers to only request author... | |
243087 | # Deployment
- [Introduction](#introduction)
- [Server Requirements](#server-requirements)
- [Server Configuration](#server-configuration)
- [Nginx](#nginx)
- [FrankenPHP](#frankenphp)
- [Directory Permissions](#directory-permissions)
- [Optimization](#optimization)
- [Caching Configuration](#optimizin... | |
243089 | # CSRF Protection
- [Introduction](#csrf-introduction)
- [Preventing CSRF Requests](#preventing-csrf-requests)
- [Excluding URIs](#csrf-excluding-uris)
- [X-CSRF-Token](#csrf-x-csrf-token)
- [X-XSRF-Token](#csrf-x-xsrf-token)
<a name="csrf-introduction"></a>
## Introduction
Cross-site request forgeries are a typ... | |
243091 | ## Environment Configuration
It is often helpful to have different configuration values based on the environment where the application is running. For example, you may wish to use a different cache driver locally than you do on your production server.
To make this a cinch, Laravel utilizes the [DotEnv](https://github... | |
243092 | ## Configuration Caching
To give your application a speed boost, you should cache all of your configuration files into a single file using the `config:cache` Artisan command. This will combine all of the configuration options for your application into a single file which can be quickly loaded by the framework.
You sh... | |
243093 | # Logging
- [Introduction](#introduction)
- [Configuration](#configuration)
- [Available Channel Drivers](#available-channel-drivers)
- [Channel Prerequisites](#channel-prerequisites)
- [Logging Deprecation Warnings](#logging-deprecation-warnings)
- [Building Log Stacks](#building-log-stacks)
- [Writing Lo... | |
243094 | ## Building Log Stacks
As mentioned previously, the `stack` driver allows you to combine multiple channels into a single log channel for convenience. To illustrate how to use log stacks, let's take a look at an example configuration that you might see in a production application:
```php
'channels' => [
'stack' =>... | |
243095 | ## Monolog Channel Customization
<a name="customizing-monolog-for-channels"></a>
### Customizing Monolog for Channels
Sometimes you may need complete control over how Monolog is configured for an existing channel. For example, you may want to configure a custom Monolog `FormatterInterface` implementation for Laravel'... | |
243096 | # Database: Seeding
- [Introduction](#introduction)
- [Writing Seeders](#writing-seeders)
- [Using Model Factories](#using-model-factories)
- [Calling Additional Seeders](#calling-additional-seeders)
- [Muting Model Events](#muting-model-events)
- [Running Seeders](#running-seeders)
<a name="introduction"... | |
243101 | ## Custom Cards
Pulse allows you to build custom cards to display data relevant to your application's specific needs. Pulse uses [Livewire](https://livewire.laravel.com), so you may want to [review its documentation](https://livewire.laravel.com/docs) before building your first custom card.
<a name="custom-card-compo... | |
243103 | # Starter Kits
- [Introduction](#introduction)
- [Laravel Breeze](#laravel-breeze)
- [Installation](#laravel-breeze-installation)
- [Breeze and Blade](#breeze-and-blade)
- [Breeze and Livewire](#breeze-and-livewire)
- [Breeze and React / Vue](#breeze-and-inertia)
- [Breeze and Next.js / API](#breez... | |
243112 | ## Writing Mailables
Once you have generated a mailable class, open it up so we can explore its contents. Mailable class configuration is done in several methods, including the `envelope`, `content`, and `attachments` methods.
The `envelope` method returns an `Illuminate\Mail\Mailables\Envelope` object that defines t... | |
243114 | ### Tags and Metadata
Some third-party email providers such as Mailgun and Postmark support message "tags" and "metadata", which may be used to group and track emails sent by your application. You may add tags and metadata to an email message via your `Envelope` definition:
use Illuminate\Mail\Mailables\Envelope;... | |
243120 | ## Redirects
Redirect responses are instances of the `Illuminate\Http\RedirectResponse` class, and contain the proper headers needed to redirect the user to another URL. There are several ways to generate a `RedirectResponse` instance. The simplest method is to use the global `redirect` helper:
Route::get('/dashb... | |
243121 | ## Other Response Types
The `response` helper may be used to generate other types of response instances. When the `response` helper is called without arguments, an implementation of the `Illuminate\Contracts\Routing\ResponseFactory` [contract](/docs/{{version}}/contracts) is returned. This contract provides several he... | |
243123 | ## Making Requests
To make requests, you may use the `head`, `get`, `post`, `put`, `patch`, and `delete` methods provided by the `Http` facade. First, let's examine how to make a basic `GET` request to another URL:
use Illuminate\Support\Facades\Http;
$response = Http::get('http://example.com');
The `get` m... | |
243124 | ### Retries
If you would like the HTTP client to automatically retry the request if a client or server error occurs, you may use the `retry` method. The `retry` method accepts the maximum number of times the request should be attempted and the number of milliseconds that Laravel should wait in between attempts:
$... | |
243128 | # Package Development
- [Introduction](#introduction)
- [A Note on Facades](#a-note-on-facades)
- [Package Discovery](#package-discovery)
- [Service Providers](#service-providers)
- [Resources](#resources)
- [Configuration](#configuration)
- [Migrations](#migrations)
- [Routes](#routes)
- [Language... | |
243129 | ## Resources
<a name="configuration"></a>
### Configuration
Typically, you will need to publish your package's configuration file to the application's `config` directory. This will allow users of your package to easily override your default configuration options. To allow your configuration files to be published, cal... | |
243130 | ### View Components
If you are building a package that utilizes Blade components or placing components in non-conventional directories, you will need to manually register your component class and its HTML tag alias so that Laravel knows where to find the component. You should typically register your components in the ... | |
243133 | # Laravel Sail
- [Introduction](#introduction)
- [Installation and Setup](#installation)
- [Installing Sail Into Existing Applications](#installing-sail-into-existing-applications)
- [Rebuilding Sail Images](#rebuilding-sail-images)
- [Configuring A Shell Alias](#configuring-a-shell-alias)
- [Starting and ... | |
243134 | ## Executing Commands
When using Laravel Sail, your application is executing within a Docker container and is isolated from your local computer. However, Sail provides a convenient way to run various commands against your application such as arbitrary PHP commands, Artisan commands, Composer commands, and Node / NPM c... | |
243135 | ## Running Tests
Laravel provides amazing testing support out of the box, and you may use Sail's `test` command to run your applications [feature and unit tests](/docs/{{version}}/testing). Any CLI options that are accepted by Pest / PHPUnit may also be passed to the `test` command:
```shell
sail test
sail test --gr... | |
243137 | # Blade Templates
- [Introduction](#introduction)
- [Supercharging Blade With Livewire](#supercharging-blade-with-livewire)
- [Displaying Data](#displaying-data)
- [HTML Entity Encoding](#html-entity-encoding)
- [Blade and JavaScript Frameworks](#blade-and-javascript-frameworks)
- [Blade Directives](#blade... | |
243138 | ## Blade Directives
In addition to template inheritance and displaying data, Blade also provides convenient shortcuts for common PHP control structures, such as conditional statements and loops. These shortcuts provide a very clean, terse way of working with PHP control structures while also remaining familiar to thei... | |
243139 | ### Additional Attributes
For convenience, you may use the `@checked` directive to easily indicate if a given HTML checkbox input is "checked". This directive will echo `checked` if the provided condition evaluates to `true`:
```blade
<input
type="checkbox"
name="active"
value="active"
@checked(old('a... | |
243141 | ### Passing Data to Components
You may pass data to Blade components using HTML attributes. Hard-coded, primitive values may be passed to the component using simple HTML attribute strings. PHP expressions and variables should be passed to the component via attributes that use the `:` character as a prefix:
```blade
<... | |
243142 | ### Component Attributes
We've already examined how to pass data attributes to a component; however, sometimes you may need to specify additional HTML attributes, such as `class`, that are not part of the data required for a component to function. Typically, you want to pass these additional attributes down to the roo... | |
243143 | ### Slots
You will often need to pass additional content to your component via "slots". Component slots are rendered by echoing the `$slot` variable. To explore this concept, let's imagine that an `alert` component has the following markup:
```blade
<!-- /resources/views/components/alert.blade.php -->
<div class="al... | |
243144 | ## Anonymous Components
Similar to inline components, anonymous components provide a mechanism for managing a component via a single file. However, anonymous components utilize a single view file and have no associated class. To define an anonymous component, you only need to place a Blade template within your `resour... | |
243145 | ## Building Layouts
<a name="layouts-using-components"></a>
### Layouts Using Components
Most web applications maintain the same general layout across various pages. It would be incredibly cumbersome and hard to maintain our application if we had to repeat the entire layout HTML in every view we create. Thankfully, i... | |
243148 | ## Using Vue / React
Although it's possible to build modern frontends using Laravel and Livewire, many developers still prefer to leverage the power of a JavaScript framework like Vue or React. This allows developers to take advantage of the rich ecosystem of JavaScript packages and tools available via NPM.
However, ... | |
243152 | # HTTP Session
- [Introduction](#introduction)
- [Configuration](#configuration)
- [Driver Prerequisites](#driver-prerequisites)
- [Interacting With the Session](#interacting-with-the-session)
- [Retrieving Data](#retrieving-data)
- [Storing Data](#storing-data)
- [Flash Data](#flash-data)
- [D... | |
243155 | # Upgrade Guide
- [Upgrading To 11.0 From 10.x](#upgrade-11.0)
<a name="high-impact-changes"></a>
## High Impact Changes
<div class="content-list" markdown="1">
- [Updating Dependencies](#updating-dependencies)
- [Application Structure](#application-structure)
- [Floating-Point Types](#floating-point-types)
- [Modi... | |
243156 | ### Database
<a name="sqlite-minimum-version"></a>
#### SQLite 3.26.0+
**Likelihood Of Impact: High**
If your application is utilizing an SQLite database, SQLite 3.26.0 or greater is required.
<a name="eloquent-model-casts-method"></a>
#### Eloquent Model `casts` Method
**Likelihood Of Impact: Low**
The base Eloq... | |
243157 | #### Schema Builder `getColumnType()` Method
**Likelihood Of Impact: Very Low**
The `Schema::getColumnType()` method now always returns actual type of the given column, not the Doctrine DBAL equivalent type.
<a name="database-connection-interface"></a>
#### Database Connection Interface
**Likelihood Of Impact: Very... | |
243162 | ### Search
If you have a lot of options for the user to select from, the `search` function allows the user to type a search query to filter the results before using the arrow keys to select an option:
```php
use function Laravel\Prompts\search;
$id = search(
label: 'Search for the user that should receive the ma... | |
243168 | # Laravel Scout
- [Introduction](#introduction)
- [Installation](#installation)
- [Queueing](#queueing)
- [Driver Prerequisites](#driver-prerequisites)
- [Algolia](#algolia)
- [Meilisearch](#meilisearch)
- [Typesense](#typesense)
- [Configuration](#configuration)
- [Configuring Model Indexes](#conf... | |
243169 | ## Driver Prerequisites
<a name="algolia"></a>
### Algolia
When using the Algolia driver, you should configure your Algolia `id` and `secret` credentials in your `config/scout.php` configuration file. Once your credentials have been configured, you will also need to install the Algolia PHP SDK via the Composer packag... | |
243170 | ## Configuration
<a name="configuring-model-indexes"></a>
### Configuring Model Indexes
Each Eloquent model is synced with a given search "index", which contains all of the searchable records for that model. In other words, you can think of each index like a MySQL table. By default, each model will be persisted to an... | |
243173 | ## Searching
You may begin searching a model using the `search` method. The search method accepts a single string that will be used to search your models. You should then chain the `get` method onto the search query to retrieve the Eloquent models that match the given search query:
use App\Models\Order;
$ord... | |
243174 | # Eloquent: API Resources
- [Introduction](#introduction)
- [Generating Resources](#generating-resources)
- [Concept Overview](#concept-overview)
- [Resource Collections](#resource-collections)
- [Writing Resources](#writing-resources)
- [Data Wrapping](#data-wrapping)
- [Pagination](#pagination)
- [Co... | |
243175 | ## Writing Resources
> [!NOTE]
> If you have not read the [concept overview](#concept-overview), you are highly encouraged to do so before proceeding with this documentation.
Resources only need to transform a given model into an array. So, each resource contains a `toArray` method which translates your model's att... | |
243176 | ### Pagination
You may pass a Laravel paginator instance to the `collection` method of a resource or to a custom resource collection:
use App\Http\Resources\UserCollection;
use App\Models\User;
Route::get('/users', function () {
return new UserCollection(User::paginate());
});
Paginated resp... | |
243177 | ### Conditional Relationships
In addition to conditionally loading attributes, you may conditionally include relationships on your resource responses based on if the relationship has already been loaded on the model. This allows your controller to decide which relationships should be loaded on the model and your resou... | |
243178 | # Database Testing
- [Introduction](#introduction)
- [Resetting the Database After Each Test](#resetting-the-database-after-each-test)
- [Model Factories](#model-factories)
- [Running Seeders](#running-seeders)
- [Available Assertions](#available-assertions)
<a name="introduction"></a>
## Introduction
Laravel pr... | |
243179 | # Installation
- [Meet Laravel](#meet-laravel)
- [Why Laravel?](#why-laravel)
- [Creating a Laravel Application](#creating-a-laravel-project)
- [Installing PHP and the Laravel Installer](#installing-php)
- [Creating an Application](#creating-an-application)
- [Initial Configuration](#initial-configuration)... | |
243180 | ## Initial Configuration
All of the configuration files for the Laravel framework are stored in the `config` directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.
Laravel needs almost no additional configuration out of the box. You are free to... | |
243183 | # Laravel Fortify
- [Introduction](#introduction)
- [What is Fortify?](#what-is-fortify)
- [When Should I Use Fortify?](#when-should-i-use-fortify)
- [Installation](#installation)
- [Fortify Features](#fortify-features)
- [Disabling Views](#disabling-views)
- [Authentication](#authentication)
- [Cu... | |
243184 | ## Authentication
To get started, we need to instruct Fortify how to return our "login" view. Remember, Fortify is a headless authentication library. If you would like a frontend implementation of Laravel's authentication features that are already completed for you, you should use an [application starter kit](/docs/{{... | |
243185 | ## Two Factor Authentication
When Fortify's two factor authentication feature is enabled, the user is required to input a six digit numeric token during the authentication process. This token is generated using a time-based one-time password (TOTP) that can be retrieved from any TOTP compatible mobile authentication a... | |
243186 | ## Password Reset
<a name="requesting-a-password-reset-link"></a>
### Requesting a Password Reset Link
To begin implementing our application's password reset functionality, we need to instruct Fortify how to return our "forgot password" view. Remember, Fortify is a headless authentication library. If you would like a... | |
243188 | # Events
- [Introduction](#introduction)
- [Generating Events and Listeners](#generating-events-and-listeners)
- [Registering Events and Listeners](#registering-events-and-listeners)
- [Event Discovery](#event-discovery)
- [Manually Registering Events](#manually-registering-events)
- [Closure Listeners](#c... | |
243193 | # Controllers
- [Introduction](#introduction)
- [Writing Controllers](#writing-controllers)
- [Basic Controllers](#basic-controllers)
- [Single Action Controllers](#single-action-controllers)
- [Controller Middleware](#controller-middleware)
- [Resource Controllers](#resource-controllers)
- [Partial Resour... | |
243194 | ## Resource Controllers
If you think of each Eloquent model in your application as a "resource", it is typical to perform the same sets of actions against each resource in your application. For example, imagine your application contains a `Photo` model and a `Movie` model. It is likely that users can create, read, upd... | |
243195 | ### Naming Resource Route Parameters
By default, `Route::resource` will create the route parameters for your resource routes based on the "singularized" version of the resource name. You can easily override this on a per resource basis using the `parameters` method. The array passed into the `parameters` method should... | |
243196 | ## Dependency Injection and Controllers
<a name="constructor-injection"></a>
#### Constructor Injection
The Laravel [service container](/docs/{{version}}/container) is used to resolve all Laravel controllers. As a result, you are able to type-hint any dependencies your controller may need in its constructor. The decl... | |
243197 | # Laravel Sanctum
- [Introduction](#introduction)
- [How it Works](#how-it-works)
- [Installation](#installation)
- [Configuration](#configuration)
- [Overriding Default Models](#overriding-default-models)
- [API Token Authentication](#api-token-authentication)
- [Issuing API Tokens](#issuing-api-tokens)
... | |
243198 | ## API Token Authentication
> [!NOTE]
> You should not use API tokens to authenticate your own first-party SPA. Instead, use Sanctum's built-in [SPA authentication features](#spa-authentication).
<a name="issuing-api-tokens"></a>
### Issuing API Tokens
Sanctum allows you to issue API tokens / personal access token... | |
243199 | ## SPA Authentication
Sanctum also exists to provide a simple method of authenticating 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.
For this feature, Sanctum d... | |
243200 | ## Mobile Application Authentication
You may also use Sanctum tokens to authenticate your mobile application's requests to your API. The process for authenticating mobile application requests is similar to authenticating third-party API requests; however, there are small differences in how you will issue the API token... | |
243202 | ## Serving Sites
Once Valet is installed, you're ready to start serving your Laravel applications. Valet provides two commands to help you serve your applications: `park` and `link`.
<a name="the-park-command"></a>
### The `park` Command
The `park` command registers a directory on your machine that contains your app... | |
243203 | ## Site Specific Environment Variables
Some applications using other frameworks may depend on server environment variables but do not provide a way for those variables to be configured within your project. Valet allows you to configure site specific environment variables by adding a `.valet-env.php` file within the ro... | |
243207 | ### Per Project Installation
Instead of installing Homestead globally and sharing the same Homestead virtual machine across all of your projects, you may instead configure a Homestead instance for each project you manage. Installing Homestead per project may be beneficial if you wish to ship a `Vagrantfile` with your ... | |
243208 | ## Daily Usage
<a name="connecting-via-ssh"></a>
### Connecting via SSH
You can SSH into your virtual machine by executing the `vagrant ssh` terminal command from your Homestead directory.
<a name="adding-additional-sites"></a>
### Adding Additional Sites
Once your Homestead environment is provisioned and running, ... | |
243212 | # Eloquent: Mutators & Casting
- [Introduction](#introduction)
- [Accessors and Mutators](#accessors-and-mutators)
- [Defining an Accessor](#defining-an-accessor)
- [Defining a Mutator](#defining-a-mutator)
- [Attribute Casting](#attribute-casting)
- [Array and JSON Casting](#array-and-json-casting)
- ... | |
243213 | ## Attribute Casting
Attribute casting provides functionality similar to accessors and mutators without requiring you to define any additional methods on your model. Instead, your model's `casts` method provides a convenient way of converting attributes to common data types.
The `casts` method should return an array ... | |
243214 | ### Date Casting
By default, Eloquent will cast the `created_at` and `updated_at` columns to instances of [Carbon](https://github.com/briannesbitt/Carbon), which extends the PHP `DateTime` class and provides an assortment of helpful methods. You may cast additional date attributes by defining additional date casts wit... | |
243215 | ## Custom Casts
Laravel has a variety of built-in, helpful cast types; however, you may occasionally need to define your own cast types. To create a cast, execute the `make:cast` Artisan command. The new cast class will be placed in your `app/Casts` directory:
```shell
php artisan make:cast Json
```
All custom cast ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.