diff --git a/artisan.md b/artisan.md index f2c40fc96a3..41b080c86be 100644 --- a/artisan.md +++ b/artisan.md @@ -62,7 +62,7 @@ All Laravel applications include Tinker by default. However, you may install Tin composer require laravel/tinker ``` -> [!NOTE] +> [!NOTE] > Looking for hot reloading, multiline code editing, and autocompletion when interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)! @@ -80,7 +80,7 @@ You can publish Tinker's configuration file using the `vendor:publish` command: php artisan vendor:publish --provider="Laravel\Tinker\TinkerServiceProvider" ``` -> [!WARNING] +> [!WARNING] > The `dispatch` helper function and `dispatch` method on the `Dispatchable` class depends on garbage collection to place the job on the queue. Therefore, when using tinker, you should use `Bus::dispatch` or `Queue::push` to dispatch jobs. @@ -161,7 +161,7 @@ class SendEmails extends Command } ``` -> [!NOTE] +> [!NOTE] > For greater code reuse, it is good practice to keep your console commands light and let them defer to application services to accomplish their tasks. In the example above, note that we inject a service class to do the "heavy lifting" of sending the e-mails. @@ -224,7 +224,7 @@ Artisan::command('mail:send {user}', function (string $user) { ### Isolatable Commands -> [!WARNING] +> [!WARNING] > To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server. Sometimes you may wish to ensure that only one instance of a command can run at a time. To accomplish this, you may implement the `Illuminate\Contracts\Console\Isolatable` interface on your command class: @@ -499,7 +499,7 @@ return [ ]; ``` -> [!NOTE] +> [!NOTE] The comprehensive [Laravel Prompts](/docs/{{version}}/prompts) documentation includes additional information on the available prompts and their usage. If you wish to prompt the user to select or enter [options](#options), you may include prompts in your command's `handle` method. However, if you only wish to prompt the user when they have also been automatically prompted for missing arguments, then you may implement the `afterPromptingForMissingArguments` method: @@ -560,7 +560,7 @@ $options = $this->options(); ### Prompting for Input -> [!NOTE] +> [!NOTE] > [Laravel Prompts](/docs/{{version}}/prompts) is a PHP package for adding beautiful and user-friendly forms to your command-line applications, with browser-like features including placeholder text and validation. In addition to displaying output, you may also ask the user to provide input during the execution of your command. The `ask` method will prompt the user with the given question, accept their input, and then return the user's input back to your command: @@ -734,7 +734,7 @@ foreach ($users as $user) { $bar->finish(); ``` -> [!NOTE] +> [!NOTE] > For more advanced options, check out the [Symfony Progress Bar component documentation](https://symfony.com/doc/7.0/components/console/helpers/progressbar.html). diff --git a/authentication.md b/authentication.md index a06f281b202..cea323fada4 100644 --- a/authentication.md +++ b/authentication.md @@ -40,7 +40,7 @@ Providers define how users are retrieved from your persistent storage. Laravel s Your application's authentication configuration file is located at `config/auth.php`. This file contains several well-documented options for tweaking the behavior of Laravel's authentication services. -> [!NOTE] +> [!NOTE] > Guards and providers should not be confused with "roles" and "permissions". To learn more about authorizing user actions via permissions, please refer to the [authorization](/docs/{{version}}/authorization) documentation. @@ -110,7 +110,7 @@ And, if you would like to get started quickly, we are pleased to recommend [our ## Authentication Quickstart -> [!WARNING] +> [!WARNING] > This portion of the documentation discusses authenticating users via the [Laravel application starter kits](/docs/{{version}}/starter-kits), which includes UI scaffolding to help you get started quickly. If you would like to integrate with Laravel's authentication systems directly, check out the documentation on [manually authenticating users](#authenticating-users). @@ -172,7 +172,7 @@ if (Auth::check()) { } ``` -> [!NOTE] +> [!NOTE] > Even though it is possible to determine if a user is authenticated using the `check` method, you will typically use a middleware to verify that the user is authenticated before allowing the user access to certain routes / controllers. To learn more about this, check out the documentation on [protecting routes](/docs/{{version}}/authentication#protecting-routes). @@ -218,7 +218,7 @@ Route::get('/flights', function () { If you are using one of our [application starter kits](/docs/{{version}}/starter-kits), rate limiting will automatically be applied to login attempts. By default, the user will not be able to login for one minute if they fail to provide the correct credentials after several attempts. The throttling is unique to the user's username / email address and their IP address. -> [!NOTE] +> [!NOTE] > If you would like to rate limit other routes in your application, check out the [rate limiting documentation](/docs/{{version}}/routing#rate-limiting). @@ -295,7 +295,7 @@ if (Auth::attempt([ } ``` -> [!WARNING] +> [!WARNING] > In these examples, `email` is not a required option, it is merely used as an example. You should use whatever column name corresponds to a "username" in your database table. The `attemptWhen` method, which receives a closure as its second argument, may be used to perform more extensive inspection of the potential user before actually authenticating the user. The closure receives the potential user and should return `true` or `false` to indicate if the user may be authenticated: @@ -519,7 +519,7 @@ When the `logoutOtherDevices` method is invoked, the user's other sessions will While building your application, you may occasionally have actions that should require the user to confirm their password before the action is performed or before the user is redirected to a sensitive area of the application. Laravel includes built-in middleware to make this process a breeze. Implementing this feature will require you to define two routes: one route to display a view asking the user to confirm their password and another route to confirm that the password is valid and redirect the user to their intended destination. -> [!NOTE] +> [!NOTE] > The following documentation discusses how to integrate with Laravel's password confirmation features directly; however, if you would like to get started more quickly, the [Laravel application starter kits](/docs/{{version}}/starter-kits) include support for this feature! diff --git a/authorization.md b/authorization.md index 0e498b06823..fe87667dea6 100644 --- a/authorization.md +++ b/authorization.md @@ -39,7 +39,7 @@ You do not need to choose between exclusively using gates or exclusively using p ### Writing Gates -> [!WARNING] +> [!WARNING] > Gates are a great way to learn the basics of Laravel's authorization features; however, when building robust Laravel applications you should consider using [policies](#creating-policies) to organize your authorization rules. Gates are simply closures that determine if a user is authorized to perform a given action. Typically, gates are defined within the `boot` method of the `App\Providers\AppServiceProvider` class using the `Gate` facade. Gates always receive a user instance as their first argument and may optionally receive additional arguments such as a relevant Eloquent model. @@ -377,7 +377,7 @@ You may continue to define additional methods on the policy as needed for the va If you used the `--model` option when generating your policy via the Artisan console, it will already contain methods for the `viewAny`, `view`, `create`, `update`, `delete`, `restore`, and `forceDelete` actions. -> [!NOTE] +> [!NOTE] > All policies are resolved via the Laravel [service container](/docs/{{version}}/container), allowing you to type-hint any needed dependencies in the policy's constructor to have them automatically injected. @@ -525,7 +525,7 @@ public function before(User $user, string $ability): bool|null If you would like to deny all authorization checks for a particular type of user then you may return `false` from the `before` method. If `null` is returned, the authorization check will fall through to the policy method. -> [!WARNING] +> [!WARNING] > The `before` method of a policy class will not be called if the class doesn't contain a method with a name matching the name of the ability being checked. diff --git a/billing.md b/billing.md index 162272322d3..5f66343a023 100644 --- a/billing.md +++ b/billing.md @@ -81,7 +81,7 @@ When upgrading to a new version of Cashier, it's important that you carefully review [the upgrade guide](https://github.com/laravel/cashier-stripe/blob/master/UPGRADE.md). -> [!WARNING] +> [!WARNING] > To prevent breaking changes, Cashier uses a fixed Stripe API version. Cashier 15 utilizes Stripe API version `2023-10-16`. The Stripe API version will be updated on minor releases in order to make use of new Stripe features and improvements. @@ -115,7 +115,7 @@ php artisan vendor:publish --tag="cashier-config" Lastly, to ensure Cashier properly handles all Stripe events, remember to [configure Cashier's webhook handling](#handling-stripe-webhooks). -> [!WARNING] +> [!WARNING] > Stripe recommends that any column used for storing Stripe identifiers should be case-sensitive. Therefore, you should ensure the column collation for the `stripe_id` column is set to `utf8_bin` when using MySQL. More information regarding this can be found in the [Stripe documentation](https://stripe.com/docs/upgrades#what-changes-does-stripe-consider-to-be-backwards-compatible). @@ -150,7 +150,7 @@ public function boot(): void } ``` -> [!WARNING] +> [!WARNING] > If you're using a model other than Laravel's supplied `App\Models\User` model, you'll need to publish and alter the [Cashier migrations](#installation) provided to match your alternative model's table name. @@ -164,7 +164,7 @@ STRIPE_SECRET=your-stripe-secret STRIPE_WEBHOOK_SECRET=your-stripe-webhook-secret ``` -> [!WARNING] +> [!WARNING] > You should ensure that the `STRIPE_WEBHOOK_SECRET` environment variable is defined in your application's `.env` file, as this variable is used to ensure that incoming webhooks are actually from Stripe. @@ -182,7 +182,7 @@ In addition to configuring Cashier's currency, you may also specify a locale to CASHIER_CURRENCY_LOCALE=nl_BE ``` -> [!WARNING] +> [!WARNING] > In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server. @@ -253,7 +253,7 @@ public function boot(): void ### Selling Products -> [!NOTE] +> [!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. However, thanks to Cashier and [Stripe Checkout](https://stripe.com/payments/checkout), you can easily build modern, robust payment integrations. @@ -346,7 +346,7 @@ Please refer to Stripe's documentation for more information on the [data contain ### Selling Subscriptions -> [!NOTE] +> [!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. However, thanks to Cashier and [Stripe Checkout](https://stripe.com/payments/checkout), you can easily build modern, robust payment integrations. @@ -456,7 +456,7 @@ Route::get('/billing', function (Request $request) { })->middleware(['auth'])->name('billing'); ``` -> [!NOTE] +> [!NOTE] > As long as you have configured Cashier's webhook handling, Cashier will automatically keep your application's Cashier-related database tables in sync by inspecting the incoming webhooks from Stripe. So, for example, when a user cancels their subscription via Stripe's Customer Billing Portal, Cashier will receive the corresponding webhook and mark the subscription as "canceled" in your application's database. @@ -717,7 +717,7 @@ cardButton.addEventListener('click', async (e) => { After the card has been verified by Stripe, you may pass the resulting `setupIntent.payment_method` identifier to your Laravel application, where it can be attached to the customer. The payment method can either be [added as a new payment method](#adding-payment-methods) or [used to update the default payment method](#updating-the-default-payment-method). You can also immediately use the payment method identifier to [create a new subscription](#creating-subscriptions). -> [!NOTE] +> [!NOTE] > If you would like more information about Setup Intents and gathering customer payment details please [review this overview provided by Stripe](https://stripe.com/docs/payments/save-and-reuse#php). @@ -843,7 +843,7 @@ To sync your default payment method information with the customer's default paym $user->updateDefaultPaymentMethodFromStripe(); ``` -> [!WARNING] +> [!WARNING] > The default payment method on a customer can only be used for invoicing and creating new subscriptions. Due to limitations imposed by Stripe, it may not be used for single charges. @@ -855,7 +855,7 @@ To add a new payment method, you may call the `addPaymentMethod` method on the b $user->addPaymentMethod($paymentMethod); ``` -> [!NOTE] +> [!NOTE] > To learn how to retrieve payment method identifiers please review the [payment method storage documentation](#storing-payment-methods). @@ -885,7 +885,7 @@ By default, this method will delete payment methods of every type. To delete pay $user->deletePaymentMethods('sepa_debit'); ``` -> [!WARNING] +> [!WARNING] > If a user has an active subscription, your application should not allow them to delete their default payment method. @@ -914,7 +914,7 @@ The first argument passed to the `newSubscription` method should be the internal The `create` method, which accepts [a Stripe payment method identifier](#storing-payment-methods) or Stripe `PaymentMethod` object, will begin the subscription as well as update your database with the billable model's Stripe customer ID and other relevant billing information. -> [!WARNING] +> [!WARNING] > Passing a payment method identifier directly to the `create` subscription method will also automatically add it to the user's stored payment methods. @@ -1134,7 +1134,7 @@ if ($user->subscription('default')->recurring()) { } ``` -> [!WARNING] +> [!WARNING] > If a user has two subscriptions with the same type, the most recent subscription will always be returned by the `subscription` method. For example, a user might have two subscription records with the type of `default`; however, one of the subscriptions may be an old, expired subscription, while the other is the current, active subscription. The most recent subscription will always be returned while older subscriptions are kept in the database for historical review. @@ -1204,7 +1204,7 @@ public function register(): void } ``` -> [!WARNING] +> [!WARNING] > When a subscription is in an `incomplete` state it cannot be changed until the payment is confirmed. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in an `incomplete` state. @@ -1278,7 +1278,7 @@ $user->subscription('default')->noProrate()->swap('price_yearly'); For more information on subscription proration, consult the [Stripe documentation](https://stripe.com/docs/billing/subscriptions/prorations). -> [!WARNING] +> [!WARNING] > Executing the `noProrate` method before the `swapAndInvoice` method will have no effect on proration. An invoice will always be issued. @@ -1383,7 +1383,7 @@ You may remove prices from subscriptions using the `removePrice` method: $user->subscription('default')->removePrice('price_chat'); ``` -> [!WARNING] +> [!WARNING] > You may not remove the last price on a subscription. Instead, you should simply cancel the subscription. @@ -1446,7 +1446,7 @@ $user->subscription('default')->decrementQuantity(3, 'price_chat'); $user->subscription('default')->updateQuantity(10, 'price_chat'); ``` -> [!WARNING] +> [!WARNING] > When a subscription has multiple prices the `stripe_price` and `quantity` attributes on the `Subscription` model will be `null`. To access the individual price attributes, you should use the `items` relationship available on the `Subscription` model. @@ -1579,7 +1579,7 @@ $user->meters(); ### Subscription Taxes -> [!WARNING] +> [!WARNING] > Instead of calculating Tax Rates manually, you can [automatically calculate taxes using Stripe Tax](#tax-configuration) To specify the tax rates a user pays on a subscription, you should implement the `taxRates` method on your billable model and return an array containing the Stripe tax rate IDs. You can define these tax rates in [your Stripe dashboard](https://dashboard.stripe.com/test/tax-rates): @@ -1614,7 +1614,7 @@ public function priceTaxRates(): array } ``` -> [!WARNING] +> [!WARNING] > The `taxRates` method only applies to subscription charges. If you use Cashier to make "one-off" charges, you will need to manually specify the tax rate at that time. @@ -1643,7 +1643,7 @@ $user->isNotTaxExempt(); $user->reverseChargeApplies(); ``` -> [!WARNING] +> [!WARNING] > These methods are also available on any `Laravel\Cashier\Invoice` object. However, when invoked on an `Invoice` object, the methods will determine the exemption status at the time the invoice was created. @@ -1749,7 +1749,7 @@ Route::post('/user/subscribe', function (Request $request) { This method will set the trial period ending date on the subscription record within the database and instruct Stripe to not begin billing the customer until after this date. When using the `trialDays` method, Cashier will overwrite any default trial period configured for the price in Stripe. -> [!WARNING] +> [!WARNING] > If the customer's subscription is not canceled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date. The `trialUntil` method allows you to provide a `DateTime` instance that specifies when the trial period should end: @@ -1811,7 +1811,7 @@ $user = User::create([ ]); ``` -> [!WARNING] +> [!WARNING] > Be sure to add a [date cast](/docs/{{version}}/eloquent-mutators#date-casting) for the `trial_ends_at` attribute within your billable model's class definition. Cashier refers to this type of trial as a "generic trial", since it is not attached to any existing subscription. The `onTrial` method on the billable model instance will return `true` if the current date is not past the value of `trial_ends_at`: @@ -1870,7 +1870,7 @@ $subscription->extendTrial( ## Handling Stripe Webhooks -> [!NOTE] +> [!NOTE] > You may use [the Stripe CLI](https://stripe.com/docs/stripe-cli) to help test webhooks during local development. Stripe can notify your application of a variety of events via webhooks. By default, a route that points to Cashier's webhook controller is automatically registered by the Cashier service provider. This controller will handle all incoming webhook requests. @@ -1912,7 +1912,7 @@ After creation, the webhook will be immediately active. If you wish to create th php artisan cashier:webhook --disabled ``` -> [!WARNING] +> [!WARNING] > Make sure you protect incoming Stripe webhook requests with Cashier's included [webhook signature verification](#verifying-webhook-signatures) middleware. @@ -2012,7 +2012,7 @@ try { } ``` -> [!WARNING] +> [!WARNING] > The `charge` method accepts the payment amount in the lowest denominator of the currency used by your application. For example, if customers are paying in United States Dollars, amounts should be specified in pennies. @@ -2052,7 +2052,7 @@ $user->invoiceFor('One Time Fee', 500); Although the `invoiceFor` method is available for you to use, it is recommended that you use the `invoicePrice` and `tabPrice` methods with pre-defined prices. By doing so, you will have access to better analytics and data within your Stripe dashboard regarding your sales on a per-product basis. -> [!WARNING] +> [!WARNING] > The `invoice`, `invoicePrice`, and `invoiceFor` methods will create a Stripe invoice which will retry failed billing attempts. If you do not want invoices to retry failed charges, you will need to close them using the Stripe API after the first failed charge. @@ -2088,7 +2088,7 @@ Route::post('/pay', function (Request $request) { }); ``` -> [!WARNING] +> [!WARNING] > The `pay` and `payWith` methods accept the payment amount in the lowest denominator of the currency used by your application. For example, if customers are paying in United States Dollars, amounts should be specified in pennies. @@ -2329,13 +2329,13 @@ Route::get('/charge-checkout', function (Request $request) { }); ``` -> [!WARNING] +> [!WARNING] > When using the `checkoutCharge` method, Stripe will always create a new product and price in your Stripe dashboard. Therefore, we recommend that you create the products up front in your Stripe dashboard and use the `checkout` method instead. ### Subscription Checkouts -> [!WARNING] +> [!WARNING] > Using Stripe Checkout for subscriptions requires you to enable the `customer.subscription.created` webhook in your Stripe dashboard. This webhook will create the subscription record in your database and store all of the relevant subscription items. You may also use Stripe Checkout to initiate subscriptions. After defining your subscription with Cashier's subscription builder methods, you may call the `checkout `method. When a customer visits this route they will be redirected to Stripe's Checkout page: @@ -2378,7 +2378,7 @@ Route::get('/subscription-checkout', function (Request $request) { }); ``` -> [!WARNING] +> [!WARNING] > Unfortunately Stripe Checkout does not support all subscription billing options when starting subscriptions. Using the `anchorBillingCycleOn` method on the subscription builder, setting proration behavior, or setting payment behavior will not have any effect during Stripe Checkout sessions. Please consult [the Stripe Checkout Session API documentation](https://stripe.com/docs/api/checkout/sessions/create) to review which parameters are available. @@ -2410,7 +2410,7 @@ $checkout = $user->collectTaxIds()->checkout('price_tshirt'); When this method is invoked, a new checkbox will be available to the customer that allows them to indicate if they're purchasing as a company. If so, they will have the opportunity to provide their Tax ID number. -> [!WARNING] +> [!WARNING] > If you have already configured [automatic tax collection](#tax-configuration) in your application's service provider then this feature will be enabled automatically and there is no need to invoke the `collectTaxIds` method. @@ -2538,7 +2538,7 @@ You may consult the [Stripe API documentation](https://stripe.com/docs/api/payme If your business or one of your customers is based in Europe you will need to abide by the EU's Strong Customer Authentication (SCA) regulations. These regulations were imposedĀ in September 2019 by the European Union to prevent payment fraud. Luckily, Stripe and Cashier are prepared for building SCA compliant applications. -> [!WARNING] +> [!WARNING] > Before getting started, review [Stripe's guide on PSD2 and SCA](https://stripe.com/guides/strong-customer-authentication) as well as their [documentation on the new SCA APIs](https://stripe.com/docs/strong-customer-authentication). @@ -2566,7 +2566,7 @@ CASHIER_PAYMENT_NOTIFICATION=Laravel\Cashier\Notifications\ConfirmPayment To ensure that off-session payment confirmation notifications are delivered, verify that [Stripe webhooks are configured](#handling-stripe-webhooks) for your application and the `invoice.payment_action_required` webhook is enabled in your Stripe dashboard. In addition, your `Billable` model should also use Laravel's `Illuminate\Notifications\Notifiable` trait. -> [!WARNING] +> [!WARNING] > Notifications will be sent even when customers are manually making a payment that requires additional confirmation. Unfortunately, there is no way for Stripe to know that the payment was done manually or "off-session". But, a customer will simply see a "Payment Successful" message if they visit the payment page after already confirming their payment. The customer will not be allowed to accidentally confirm the same payment twice and incur an accidental second charge. @@ -2611,5 +2611,5 @@ To get started, add the **testing** version of your Stripe secret to your `phpun Now, whenever you interact with Cashier while testing, it will send actual API requests to your Stripe testing environment. For convenience, you should pre-fill your Stripe testing account with subscriptions / prices that you may use during testing. -> [!NOTE] +> [!NOTE] > In order to test a variety of billing scenarios, such as credit card denials and failures, you may use the vast range of [testing card numbers and tokens](https://stripe.com/docs/testing) provided by Stripe. diff --git a/blade.md b/blade.md index 082402b9986..30389aed49e 100644 --- a/blade.md +++ b/blade.md @@ -81,7 +81,7 @@ You may display the contents of the `name` variable like so: Hello, {{ $name }}. ``` -> [!NOTE] +> [!NOTE] > Blade's `{{ }}` echo statements are automatically sent through PHP's `htmlspecialchars` function to prevent XSS attacks. You are not limited to displaying the contents of the variables passed to the view. You may also echo the results of any PHP function. In fact, you can put any PHP code you wish inside of a Blade echo statement: @@ -124,7 +124,7 @@ By default, Blade `{{ }}` statements are automatically sent through PHP's `htmls Hello, {!! $name !!}. ``` -> [!WARNING] +> [!WARNING] > Be very careful when echoing content that is supplied by users of your application. You should typically use the escaped, double curly brace syntax to prevent XSS attacks when displaying user supplied data. @@ -177,7 +177,7 @@ The latest versions of the Laravel application skeleton include a `Js` facade, w ``` -> [!WARNING] +> [!WARNING] > You should only use the `Js::from` method to render existing variables as JSON. The Blade templating is based on regular expressions and attempts to pass a complex expression to the directive may cause unexpected failures. @@ -366,7 +366,7 @@ In addition to conditional statements, Blade provides simple directives for work @endwhile ``` -> [!NOTE] +> [!NOTE] > While iterating through a `foreach` loop, you may use the [loop variable](#the-loop-variable) to gain valuable information about the loop, such as whether you are in the first or last iteration through the loop. When using loops you may also skip the current iteration or end the loop using the `@continue` and `@break` directives: @@ -540,7 +540,7 @@ In addition, the `@required` directive may be used to indicate if a given elemen ### Including Subviews -> [!NOTE] +> [!NOTE] > While you're free to use the `@include` directive, Blade [components](#components) provide similar functionality and offer several benefits over the `@include` directive such as data and attribute binding. Blade's `@include` directive allows you to include a Blade view from within another view. All variables that are available to the parent view will be made available to the included view: @@ -581,7 +581,7 @@ To include the first view that exists from a given array of views, you may use t @includeFirst(['custom.admin', 'admin'], ['status' => 'complete']) ``` -> [!WARNING] +> [!WARNING] > You should avoid using the `__DIR__` and `__FILE__` constants in your Blade views, since they will refer to the location of the cached, compiled view. @@ -601,7 +601,7 @@ You may also pass a fourth argument to the `@each` directive. This argument dete @each('view.name', $jobs, 'job', 'view.empty') ``` -> [!WARNING] +> [!WARNING] > Views rendered via `@each` do not inherit the variables from the parent view. If the child view requires these variables, you should use the `@foreach` and `@include` directives instead. @@ -1014,7 +1014,7 @@ All of the attributes that are not part of the component's constructor will auto ``` -> [!WARNING] +> [!WARNING] > Using directives such as `@env` within component tags is not supported at this time. For example, `` will not be compiled. @@ -1061,7 +1061,7 @@ If you need to merge other attributes onto your component, you can chain the `me ``` -> [!NOTE] +> [!NOTE] > If you need to conditionally compile classes on other HTML elements that shouldn't receive merged attributes, you can use the [`@class` directive](#conditional-classes). @@ -1349,7 +1349,7 @@ Sometimes you may need to render a component but not know which component should ### Manually Registering Components -> [!WARNING] +> [!WARNING] > The following documentation on manually registering components is primarily applicable to those who are writing Laravel packages that include view components. If you are not writing a package, this portion of the component documentation may not be relevant to you. When writing components for your own application, components are automatically discovered within the `app/View/Components` directory and `resources/views/components` directory. @@ -1503,7 +1503,7 @@ Because the `color` prop was only passed into the parent (``), it won't ``` -> [!WARNING] +> [!WARNING] > The `@aware` directive cannot access parent data that is not explicitly passed to the parent component via HTML attributes. Default `@props` values that are not explicitly passed to the parent component cannot be accessed by the `@aware` directive. @@ -1668,7 +1668,7 @@ When defining a child view, use the `@extends` Blade directive to specify which In this example, the `sidebar` section is utilizing the `@@parent` directive to append (rather than overwriting) content to the layout's sidebar. The `@@parent` directive will be replaced by the content of the layout when the view is rendered. -> [!NOTE] +> [!NOTE] > Contrary to the previous example, this `sidebar` section ends with `@endsection` instead of `@show`. The `@endsection` directive will only define a section while `@show` will define and **immediately yield** the section. The `@yield` directive also accepts a default value as its second parameter. This value will be rendered if the section being yielded is undefined: @@ -1920,7 +1920,7 @@ As you can see, we will chain the `format` method onto whatever expression is pa format('m/d/Y H:i'); ?> ``` -> [!WARNING] +> [!WARNING] > After updating the logic of a Blade directive, you will need to delete all of the cached Blade views. The cached Blade views may be removed using the `view:clear` Artisan command. diff --git a/broadcasting.md b/broadcasting.md index a0bd1ab3e08..88869cd41ba 100644 --- a/broadcasting.md +++ b/broadcasting.md @@ -55,7 +55,7 @@ The core concepts behind broadcasting are simple: clients connect to named chann By default, Laravel includes three server-side broadcasting drivers for you to choose from: [Laravel Reverb](https://reverb.laravel.com), [Pusher Channels](https://pusher.com/channels), and [Ably](https://ably.com). -> [!NOTE] +> [!NOTE] > Before diving into event broadcasting, make sure you have read Laravel's documentation on [events and listeners](/docs/{{version}}/events). @@ -139,7 +139,7 @@ Finally, you are ready to install and configure [Laravel Echo](#client-side-inst ### Ably -> [!NOTE] +> [!NOTE] > The documentation below discusses how to use Ably in "Pusher compatibility" mode. However, the Ably team recommends and maintains a broadcaster and Echo client that is able to take advantage of the unique capabilities offered by Ably. For more information on using the Ably maintained drivers, please [consult Ably's Laravel broadcaster documentation](https://github.com/ably/laravel-broadcaster). If you plan to broadcast your events using [Ably](https://ably.com), you should install the Ably PHP SDK using the Composer package manager: @@ -199,7 +199,7 @@ Next, you should compile your application's assets: npm run build ``` -> [!WARNING] +> [!WARNING] > The Laravel Echo `reverb` broadcaster requires laravel-echo v1.16.0+. @@ -254,7 +254,7 @@ Once you have adjusted the Echo configuration according to your application's ne npm run build ``` -> [!NOTE] +> [!NOTE] > To learn more about compiling your application's JavaScript assets, please consult the documentation on [Vite](/docs/{{version}}/vite). @@ -280,7 +280,7 @@ window.Echo = new Echo({ ### Ably -> [!NOTE] +> [!NOTE] > The documentation below discusses how to use Ably in "Pusher compatibility" mode. However, the Ably team recommends and maintains a broadcaster and Echo client that is able to take advantage of the unique capabilities offered by Ably. For more information on using the Ably maintained drivers, please [consult Ably's Laravel broadcaster documentation](https://github.com/ably/laravel-broadcaster). [Laravel Echo](https://github.com/laravel/echo) is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by your server-side broadcasting driver. Echo also leverages the `pusher-js` NPM package to implement the Pusher protocol for WebSocket subscriptions, channels, and messages. @@ -319,7 +319,7 @@ Once you have adjusted the Echo configuration according to your needs, you may c npm run dev ``` -> [!NOTE] +> [!NOTE] > To learn more about compiling your application's JavaScript assets, please consult the documentation on [Vite](/docs/{{version}}/vite). @@ -616,7 +616,7 @@ class ServerCreated implements ShouldBroadcast, ShouldDispatchAfterCommit } ``` -> [!NOTE] +> [!NOTE] > To learn more about working around these issues, please review the documentation regarding [queued jobs and database transactions](/docs/{{version}}/queues#jobs-and-database-transactions). @@ -663,7 +663,7 @@ Broadcast::channel('orders.{order}', function (User $user, Order $order) { }); ``` -> [!WARNING] +> [!WARNING] > Unlike HTTP route model binding, channel model binding does not support automatic [implicit model binding scoping](/docs/{{version}}/routing#implicit-model-binding-scoping). However, this is rarely a problem because most channels can be scoped based on a single model's unique, primary key. @@ -721,7 +721,7 @@ class OrderChannel } ``` -> [!NOTE] +> [!NOTE] > Like many other classes in Laravel, channel classes will automatically be resolved by the [service container](/docs/{{version}}/container). So, you may type-hint any dependencies required by your channel in its constructor. @@ -757,7 +757,7 @@ axios.post('/task', task) However, remember that we also broadcast the task's creation. If your JavaScript application is also listening for this event in order to add tasks to the task list, you will have duplicate tasks in your list: one from the end-point and one from the broadcast. You may solve this by using the `toOthers` method to instruct the broadcaster to not broadcast the event to the current user. -> [!WARNING] +> [!WARNING] > Your event must use the `Illuminate\Broadcasting\InteractsWithSockets` trait in order to call the `toOthers` method. @@ -1027,7 +1027,7 @@ Echo.join(`chat.${roomId}`) ## Model Broadcasting -> [!WARNING] +> [!WARNING] > Before reading the following documentation about model broadcasting, we recommend you become familiar with the general concepts of Laravel's model broadcasting services as well as how to manually create and listen to broadcast events. It is common to broadcast events when your application's [Eloquent models](/docs/{{version}}/eloquent) are created, updated, or deleted. Of course, this can easily be accomplished by manually [defining custom events for Eloquent model state changes](/docs/{{version}}/eloquent#events) and marking those events with the `ShouldBroadcast` interface. @@ -1216,7 +1216,7 @@ Echo.private(`App.Models.User.${this.user.id}`) ## Client Events -> [!NOTE] +> [!NOTE] > When using [Pusher Channels](https://pusher.com/channels), you must enable the "Client Events" option in the "App Settings" section of your [application dashboard](https://dashboard.pusher.com/) in order to send client events. Sometimes you may wish to broadcast an event to other connected clients without hitting your Laravel application at all. This can be particularly useful for things like "typing" notifications, where you want to alert users of your application that another user is typing a message on a given screen. diff --git a/cache.md b/cache.md index d43cd9d3e30..b5a9d2a455f 100644 --- a/cache.md +++ b/cache.md @@ -296,7 +296,7 @@ The `forever` method may be used to store an item in the cache permanently. Sinc Cache::forever('key', 'value'); ``` -> [!NOTE] +> [!NOTE] > If you are using the Memcached driver, items that are stored "forever" may be removed when the cache reaches its size limit. @@ -322,7 +322,7 @@ You may clear the entire cache using the `flush` method: Cache::flush(); ``` -> [!WARNING] +> [!WARNING] > Flushing the cache does not respect your configured cache "prefix" and will remove all entries from the cache. Consider this carefully when clearing a cache which is shared by other applications. @@ -350,13 +350,13 @@ cache()->remember('users', $seconds, function () { }); ``` -> [!NOTE] +> [!NOTE] > When testing call to the global `cache` function, you may use the `Cache::shouldReceive` method just as if you were [testing the facade](/docs/{{version}}/mocking#mocking-facades). ## Atomic Locks -> [!WARNING] +> [!WARNING] > To utilize this feature, your application must be using the `memcached`, `redis`, `dynamodb`, `database`, `file`, or `array` cache driver as your application's default cache driver. In addition, all servers must be communicating with the same central cache server. @@ -477,7 +477,7 @@ Cache::extend('mongo', function (Application $app) { }); ``` -> [!NOTE] +> [!NOTE] > If you're wondering where to put your custom cache driver code, you could create an `Extensions` namespace within your `app` directory. However, keep in mind that Laravel does not have a rigid application structure and you are free to organize your application according to your preferences. diff --git a/cashier-paddle.md b/cashier-paddle.md index e3aa5aba613..6f2cba862a0 100644 --- a/cashier-paddle.md +++ b/cashier-paddle.md @@ -53,7 +53,7 @@ ## Introduction -> [!WARNING] +> [!WARNING] > This documentation is for Cashier Paddle 2.x's integration with Paddle Billing. If you're still using Paddle Classic, you should use [Cashier Paddle 1.x](https://github.com/laravel/cashier-paddle/tree/1.x). [Laravel Cashier Paddle](https://github.com/laravel/cashier-paddle) provides an expressive, fluent interface to [Paddle's](https://paddle.com) subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading. In addition to basic subscription management, Cashier can handle: swapping subscriptions, subscription "quantities", subscription pausing, cancelation grace periods, and more. @@ -86,7 +86,7 @@ Then, you should run your application's database migrations. The Cashier migrati php artisan migrate ``` -> [!WARNING] +> [!WARNING] > To ensure Cashier properly handles all Paddle events, remember to [set up Cashier's webhook handling](#handling-paddle-webhooks). @@ -170,7 +170,7 @@ You can specify a locale to be used when formatting money values for display on CASHIER_CURRENCY_LOCALE=nl_BE ``` -> [!WARNING] +> [!WARNING] > In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server. @@ -209,7 +209,7 @@ public function boot(): void ### Selling Products -> [!NOTE] +> [!NOTE] > Before utilizing Paddle Checkout, you should define Products with fixed prices in your Paddle dashboard. In addition, you should [configure Paddle's webhook handling](#handling-paddle-webhooks). Offering product and subscription billing via your application can be intimidating. However, thanks to Cashier and [Paddle's Checkout Overlay](https://www.paddle.com/billing/checkout), you can easily build modern, robust payment integrations. @@ -315,7 +315,7 @@ Please refer to Paddle's documentation for more information on the [data contain ### Selling Subscriptions -> [!NOTE] +> [!NOTE] > Before utilizing Paddle Checkout, you should define Products with fixed prices in your Paddle dashboard. In addition, you should [configure Paddle's webhook handling](#handling-paddle-webhooks). Offering product and subscription billing via your application can be intimidating. However, thanks to Cashier and [Paddle's Checkout Overlay](https://www.paddle.com/billing/checkout), you can easily build modern, robust payment integrations. @@ -435,7 +435,7 @@ Route::put('/subscription/cancel', function (Request $request, $price) { And now your subscription will get canceled at the end of its billing period. -> [!NOTE] +> [!NOTE] > As long as you have configured Cashier's webhook handling, Cashier will automatically keep your application's Cashier-related database tables in sync by inspecting the incoming webhooks from Paddle. So, for example, when you cancel a customer's subscription via Paddle's dashboard, Cashier will receive the corresponding webhook and mark the subscription as "canceled" in your application's database. @@ -479,7 +479,7 @@ By default, this will display the widget using Paddle's default styling. You can The Paddle checkout widget is asynchronous. Once the user creates a subscription within the widget, Paddle will send your application a webhook so that you may properly update the subscription state in your application's database. Therefore, it's important that you properly [set up webhooks](#handling-paddle-webhooks) to accommodate for state changes from Paddle. -> [!WARNING] +> [!WARNING] > After a subscription state change, the delay for receiving the corresponding webhook is typically minimal but you should account for this in your application by considering that your user's subscription might not be immediately available after completing the checkout. @@ -894,7 +894,7 @@ public function register(): void } ``` -> [!WARNING] +> [!WARNING] > When a subscription is in a `past_due` state it cannot be changed until payment information has been updated. Therefore, the `swap` and `updateQuantity` methods will throw an exception when the subscription is in a `past_due` state. @@ -1098,7 +1098,7 @@ You may remove prices from subscriptions using the `swap` method and omitting th $user->subscription()->swap(['price_original' => 2]); ``` -> [!WARNING] +> [!WARNING] > You may not remove the last price on a subscription. Instead, you should simply cancel the subscription. @@ -1173,7 +1173,7 @@ To resume a paused subscription, you may invoke the `resume` method on the subsc $user->subscription()->resume(); ``` -> [!WARNING] +> [!WARNING] > A subscription cannot be modified while it is paused. If you want to swap to a different plan or update quantities you must resume the subscription first. @@ -1207,7 +1207,7 @@ To stop a subscription on its grace period from canceling, you may invoke the `s $user->subscription()->stopCancelation(); ``` -> [!WARNING] +> [!WARNING] > Paddle's subscriptions cannot be resumed after cancelation. If your customer wishes to resume their subscription, they will have to create a new subscription. @@ -1232,7 +1232,7 @@ Route::get('/user/subscribe', function (Request $request) { When your application receives the `subscription_created` event, Cashier will set the trial period ending date on the subscription record within your application's database as well as instruct Paddle to not begin billing the customer until after this date. -> [!WARNING] +> [!WARNING] > If the customer's subscription is not canceled before the trial ending date they will be charged as soon as the trial expires, so you should be sure to notify your users of their trial ending date. You may determine if the user is within their trial period using either the `onTrial` method of the user instance: @@ -1350,7 +1350,7 @@ To ensure your application can handle Paddle webhooks, be sure to [configure the - Subscription Paused - Subscription Canceled -> [!WARNING] +> [!WARNING] > Make sure you protect incoming requests with Cashier's included [webhook signature verification](/docs/{{version}}/cashier-paddle#verifying-webhook-signatures) middleware. @@ -1492,7 +1492,7 @@ $response = $transaction->refund('Accidental charge'); For more information on refunds, please consult [Paddle's refund documentation](https://developer.paddle.com/build/transactions/create-transaction-adjustments). -> [!WARNING] +> [!WARNING] > Refunds must always be approved by Paddle before fully processing. @@ -1509,7 +1509,7 @@ $response = $transaction->credit('Compensation', 'pri_123'); For more info, [see Paddle's documentation on crediting](https://developer.paddle.com/build/transactions/create-transaction-adjustments). -> [!WARNING] +> [!WARNING] > Credits can only be applied for manually-collected transactions. Automatically-collected transactions are credited by Paddle themselves. diff --git a/collections.md b/collections.md index 45cb93525a9..5fd6ff659de 100644 --- a/collections.md +++ b/collections.md @@ -35,7 +35,7 @@ As mentioned above, the `collect` helper returns a new `Illuminate\Support\Colle $collection = collect([1, 2, 3]); ``` -> [!NOTE] +> [!NOTE] > The results of [Eloquent](/docs/{{version}}/eloquent) queries are always returned as `Collection` instances. @@ -488,7 +488,7 @@ $collection->all(); // [1, 2, 3] ``` -> [!NOTE] +> [!NOTE] > The `collect` method is especially useful when you have an instance of `Enumerable` and need a non-lazy collection instance. Since `collect()` is part of the `Enumerable` contract, you can safely use it to get a `Collection` instance. @@ -593,7 +593,7 @@ collect(['1', '2'])->containsOneItem(); This method has the same signature as the [`contains`](#method-contains) method; however, all values are compared using "strict" comparisons. -> [!NOTE] +> [!NOTE] > This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-contains). @@ -716,7 +716,7 @@ $diff->all(); // [1, 3, 5] ``` -> [!NOTE] +> [!NOTE] > This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-diff). @@ -968,7 +968,7 @@ Primitive types such as `string`, `int`, `float`, `bool`, and `array` may also b return $collection->ensure('int'); ``` -> [!WARNING] +> [!WARNING] > The `ensure` method does not guarantee that elements of different types will not be added to the collection at a later time. @@ -1013,7 +1013,7 @@ $filtered->all(); For the inverse of `except`, see the [only](#method-only) method. -> [!NOTE] +> [!NOTE] > This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-except). @@ -1228,7 +1228,7 @@ $collection->forget(['name', 'framework']); // [] ``` -> [!WARNING] +> [!WARNING] > Unlike most other collection methods, `forget` does not return a new modified collection; it modifies and returns the collection it is called on. @@ -1457,7 +1457,7 @@ $intersect->all(); // [0 => 'Desk', 2 => 'Chair'] ``` -> [!NOTE] +> [!NOTE] > This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-intersect). @@ -1714,7 +1714,7 @@ $multiplied->all(); // [2, 4, 6, 8, 10] ``` -> [!WARNING] +> [!WARNING] > Like most other collection methods, `map` returns a new collection instance; it does not modify the collection it is called on. If you want to transform the original collection, use the [`transform`](#method-transform) method. @@ -2022,7 +2022,7 @@ $filtered->all(); For the inverse of `only`, see the [except](#method-except) method. -> [!NOTE] +> [!NOTE] > This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-only). @@ -2668,7 +2668,7 @@ $subset->all(); // [3, 4] ``` -> [!WARNING] +> [!WARNING] > If the given value is not found or the callback never returns `true`, the `skipUntil` method will return an empty collection. @@ -2688,7 +2688,7 @@ $subset->all(); // [4] ``` -> [!WARNING] +> [!WARNING] > If the callback never returns `false`, the `skipWhile` method will return an empty collection. @@ -2815,7 +2815,7 @@ $sorted->values()->all(); If your sorting needs are more advanced, you may pass a callback to `sort` with your own algorithm. Refer to the PHP documentation on [`uasort`](https://secure.php.net/manual/en/function.uasort.php#refsect1-function.uasort-parameters), which is what the collection's `sort` method calls utilizes internally. -> [!NOTE] +> [!NOTE] > If you need to sort a collection of nested arrays or objects, see the [`sortBy`](#method-sortby) and [`sortByDesc`](#method-sortbydesc) methods. @@ -3199,7 +3199,7 @@ $subset->all(); // [1, 2] ``` -> [!WARNING] +> [!WARNING] > If the given value is not found or the callback never returns `true`, the `takeUntil` method will return all items in the collection. @@ -3219,7 +3219,7 @@ $subset->all(); // [1, 2] ``` -> [!WARNING] +> [!WARNING] > If the callback never returns `false`, the `takeWhile` method will return all items in the collection. @@ -3270,7 +3270,7 @@ $collection->toArray(); */ ``` -> [!WARNING] +> [!WARNING] > `toArray` also converts all of the collection's nested objects that are an instance of `Arrayable` to an array. If you want to get the raw array underlying the collection, use the [`all`](#method-all) method instead. @@ -3303,7 +3303,7 @@ $collection->all(); // [2, 4, 6, 8, 10] ``` -> [!WARNING] +> [!WARNING] > Unlike most other collection methods, `transform` modifies the collection itself. If you wish to create a new collection instead, use the [`map`](#method-map) method. @@ -3417,7 +3417,7 @@ $unique->values()->all(); The `unique` method uses "loose" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value. Use the [`uniqueStrict`](#method-uniquestrict) method to filter using "strict" comparisons. -> [!NOTE] +> [!NOTE] > This method's behavior is modified when using [Eloquent Collections](/docs/{{version}}/eloquent-collections#method-unique). @@ -3971,7 +3971,7 @@ return $users->sum->votes; ### Introduction -> [!WARNING] +> [!WARNING] > Before learning more about Laravel's lazy collections, take some time to familiarize yourself with [PHP generators](https://www.php.net/manual/en/language.generators.overview.php). To supplement the already powerful `Collection` class, the `LazyCollection` class leverages PHP's [generators](https://www.php.net/manual/en/language.generators.overview.php) to allow you to work with very large datasets while keeping memory usage low. @@ -4170,7 +4170,7 @@ Almost all methods available on the `Collection` class are also available on the -> [!WARNING] +> [!WARNING] > Methods that mutate the collection (such as `shift`, `pop`, `prepend` etc.) are **not** available on the `LazyCollection` class. diff --git a/concurrency.md b/concurrency.md index 78eebdae9e9..e29cd916710 100644 --- a/concurrency.md +++ b/concurrency.md @@ -40,7 +40,7 @@ If you upgraded to Laravel 11.x from a Laravel 10.x application, you may need to Laravel achieves concurrency by serializing the given closures and dispatching them to a hidden Artisan CLI command, which unserializes the closures and invokes it within its own PHP process. After the closure has been invoked, the resulting value is serialized back to the parent process. -The `Concurrency` facade supports three drivers: `process` (the default), `fork`, and `sync`. +The `Concurrency` facade supports three drivers: `process` (the default), `fork`, and `sync`. The `fork` driver offers improved performance compared to the default `process` driver, but it may only be used within PHP's CLI context, as PHP does not support forking during web requests. Before using the `fork` driver, you need to install the `spatie/fork` package: diff --git a/configuration.md b/configuration.md index 15a870b2d81..8869b27a18d 100644 --- a/configuration.md +++ b/configuration.md @@ -51,7 +51,7 @@ Laravel's default `.env` file contains some common configuration values that may If you are developing with a team, you may wish to continue including and updating the `.env.example` file with your application. By putting placeholder values in the example configuration file, other developers on your team can clearly see which environment variables are needed to run your application. -> [!NOTE] +> [!NOTE] > Any variable in your `.env` file can be overridden by external environment variables such as server-level or system-level environment variables. @@ -126,7 +126,7 @@ if (App::environment(['local', 'staging'])) { } ``` -> [!NOTE] +> [!NOTE] > The current application environment detection can be overridden by defining a server-level `APP_ENV` environment variable. @@ -149,7 +149,7 @@ Running the `env:encrypt` command will encrypt your `.env` file and place the en php artisan env:encrypt --key=3UVsEgGVK36XN82KKeyLFMhvosbZN1aF ``` -> [!NOTE] +> [!NOTE] > The length of the key provided should match the key length required by the encryption cipher being used. By default, Laravel will use the `AES-256-CBC` cipher which requires a 32 character key. You are free to use any cipher supported by Laravel's [encrypter](/docs/{{version}}/encryption) by passing the `--cipher` option when invoking the command. If your application has multiple environment files, such as `.env` and `.env.staging`, you may specify the environment file that should be encrypted by providing the environment name via the `--env` option: @@ -244,7 +244,7 @@ The `config:clear` command may be used to purge the cached configuration: php artisan config:clear ``` -> [!WARNING] +> [!WARNING] > If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded; therefore, the `env` function will only return external, system level environment variables. @@ -265,7 +265,7 @@ php artisan config:publish --all The `debug` option in your `config/app.php` configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your `.env` file. -> [!WARNING] +> [!WARNING] > For local development, you should set the `APP_DEBUG` environment variable to `true`. **In your production environment, this value should always be `false`. If the variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.** @@ -314,7 +314,7 @@ php artisan down --with-secret When accessing this hidden route, you will then be redirected to the `/` route of the application. Once the cookie has been issued to your browser, you will be able to browse the application normally as if it was not in maintenance mode. -> [!NOTE] +> [!NOTE] > Your maintenance mode secret should typically consist of alpha-numeric characters and, optionally, dashes. You should avoid using characters that have special meaning in URLs such as `?` or `&`. @@ -358,7 +358,7 @@ To disable maintenance mode, use the `up` command: php artisan up ``` -> [!NOTE] +> [!NOTE] > You may customize the default maintenance mode template by defining your own template at `resources/views/errors/503.blade.php`. diff --git a/context.md b/context.md index c20297aaa1a..39e60dfba91 100644 --- a/context.md +++ b/context.md @@ -285,7 +285,7 @@ Context::pop('breadcrumbs') // second_value Context::get('breadcrumbs'); -// ['first_value'] +// ['first_value'] ``` If you would like to retrieve all of the information stored in the context, you may invoke the `all` method: @@ -405,7 +405,7 @@ public function boot(): void } ``` -> [!NOTE] +> [!NOTE] > You should not use the `Context` facade within the `dehydrating` callback, as that will change the context of the current process. Ensure you only make changes to the repository passed to the callback. @@ -433,5 +433,5 @@ public function boot(): void } ``` -> [!NOTE] +> [!NOTE] > You should not use the `Context` facade within the `hydrated` callback and instead ensure you only make changes to the repository passed to the callback. diff --git a/controllers.md b/controllers.md index ee927f8d5de..262c2b9e07b 100644 --- a/controllers.md +++ b/controllers.md @@ -67,7 +67,7 @@ Route::get('/user/{id}', [UserController::class, 'show']); When an incoming request matches the specified route URI, the `show` method on the `App\Http\Controllers\UserController` class will be invoked and the route parameters will be passed to the method. -> [!NOTE] +> [!NOTE] > Controllers are not **required** to extend a base class. However, it is sometimes convenient to extend a base controller class that contains methods that should be shared across all of your controllers. @@ -106,7 +106,7 @@ You may generate an invokable controller by using the `--invokable` option of th php artisan make:controller ProvisionServer --invokable ``` -> [!NOTE] +> [!NOTE] > Controller stubs may be customized using [stub publishing](/docs/{{version}}/artisan#stub-customization). @@ -165,7 +165,7 @@ public static function middleware(): array } ``` -> [!WARNING] +> [!WARNING] > Controllers implementing `Illuminate\Routing\Controllers\HasMiddleware` should not extend `Illuminate\Routing\Controller`. @@ -452,7 +452,7 @@ Route::get('/photos/popular', [PhotoController::class, 'popular']); Route::resource('photos', PhotoController::class); ``` -> [!NOTE] +> [!NOTE] > Remember to keep your controllers focused. If you find yourself routinely needing methods outside of the typical set of resource actions, consider splitting your controller into two, smaller controllers. diff --git a/csrf.md b/csrf.md index 4a2cd8ee6b4..a60b53edccb 100644 --- a/csrf.md +++ b/csrf.md @@ -86,7 +86,7 @@ Typically, you should place these kinds of routes outside of the `web` middlewar }) ``` -> [!NOTE] +> [!NOTE] > For convenience, the CSRF middleware is automatically disabled for all routes when [running tests](/docs/{{version}}/testing). @@ -115,5 +115,5 @@ Laravel stores the current CSRF token in an encrypted `XSRF-TOKEN` cookie that i This cookie is primarily sent as a developer convenience since some JavaScript frameworks and libraries, like Angular and Axios, automatically place its value in the `X-XSRF-TOKEN` header on same-origin requests. -> [!NOTE] +> [!NOTE] > By default, the `resources/js/bootstrap.js` file includes the Axios HTTP library which will automatically send the `X-XSRF-TOKEN` header for you. diff --git a/database-testing.md b/database-testing.md index e2f7bbaaec9..a2525eb2d03 100644 --- a/database-testing.md +++ b/database-testing.md @@ -210,7 +210,7 @@ Assert that a table in the database contains no records: ```php $this->assertDatabaseEmpty('users'); ``` - + #### assertDatabaseHas diff --git a/database.md b/database.md index a12621c9ce9..14c9c68adb5 100644 --- a/database.md +++ b/database.md @@ -52,7 +52,7 @@ By default, foreign key constraints are enabled for SQLite connections. If you w DB_FOREIGN_KEYS=false ``` -> [!NOTE] +> [!NOTE] > If you use the [Laravel installer](/docs/{{version}}/installation#creating-a-laravel-project) to create your Laravel application and select SQLite as your database, Laravel will automatically create a `database/database.sqlite` file and run the default [database migrations](/docs/{{version}}/migrations) for you. @@ -257,7 +257,7 @@ Sometimes you may want to execute an SQL statement without binding any values. Y DB::unprepared('update users set votes = 100 where name = "Dries"'); ``` -> [!WARNING] +> [!WARNING] > Since unprepared statements do not bind parameters, they may be vulnerable to SQL injection. You should never allow user controlled values within an unprepared statement. @@ -417,7 +417,7 @@ Lastly, you can commit a transaction via the `commit` method: DB::commit(); ``` -> [!NOTE] +> [!NOTE] > The `DB` facade's transaction methods control the transactions for both the [query builder](/docs/{{version}}/queries) and [Eloquent ORM](/docs/{{version}}/eloquent). diff --git a/deployment.md b/deployment.md index 158ce5a2fc3..292e0be0221 100644 --- a/deployment.md +++ b/deployment.md @@ -134,7 +134,7 @@ php artisan config:cache This command will combine all of Laravel's configuration files into a single, cached file, which greatly reduces the number of trips the framework must make to the filesystem when loading your configuration values. -> [!WARNING] +> [!WARNING] > If you execute the `config:cache` command during your deployment process, you should be sure that you are only calling the `env` function from within your configuration files. Once the configuration has been cached, the `.env` file will not be loaded and all calls to the `env` function for `.env` variables will return `null`. @@ -173,7 +173,7 @@ This command precompiles all your Blade views so they are not compiled on demand The debug option in your `config/app.php` configuration file determines how much information about an error is actually displayed to the user. By default, this option is set to respect the value of the `APP_DEBUG` environment variable, which is stored in your application's `.env` file. -> [!WARNING] +> [!WARNING] > **In your production environment, this value should always be `false`. If the `APP_DEBUG` variable is set to `true` in production, you risk exposing sensitive configuration values to your application's end users.** diff --git a/eloquent-factories.md b/eloquent-factories.md index a95cfa08096..afb6383f027 100644 --- a/eloquent-factories.md +++ b/eloquent-factories.md @@ -73,7 +73,7 @@ As you can see, in their most basic form, factories are classes that extend Lara Via the `fake` helper, factories have access to the [Faker](https://github.com/FakerPHP/Faker) PHP library, which allows you to conveniently generate various kinds of random data for testing and seeding. -> [!NOTE] +> [!NOTE] > You can change your application's Faker locale by updating the `faker_locale` option in your `config/app.php` configuration file. @@ -260,7 +260,7 @@ $user = User::factory()->state([ ])->make(); ``` -> [!NOTE] +> [!NOTE] > [Mass assignment protection](/docs/{{version}}/eloquent#mass-assignment) is automatically disabled when creating models using factories.