Skip to content

[12.x] remove <?php opening tag in code blocks #10186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions artisan.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ After generating your command, you should define appropriate values for the `sig
Let's take a look at an example command. Note that we are able to request any dependencies we need via the command's `handle` method. The Laravel [service container](/docs/{{version}}/container) will automatically inject all dependencies that are type-hinted in this method's signature:

```php
<?php

namespace App\Console\Commands;

use App\Models\User;
Expand Down Expand Up @@ -230,8 +228,6 @@ Artisan::command('mail:send {user}', function (string $user) {
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:

```php
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
Expand Down Expand Up @@ -436,8 +432,6 @@ protected $signature = 'mail:send
If your command contains required arguments, the user will receive an error message when they are not provided. Alternatively, you may configure your command to automatically prompt the user when required arguments are missing by implementing the `PromptsForMissingInput` interface:

```php
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
Expand Down
14 changes: 0 additions & 14 deletions authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,6 @@ $id = Auth::id();
Alternatively, once a user is authenticated, you may access the authenticated user via an `Illuminate\Http\Request` instance. Remember, type-hinted classes will automatically be injected into your controller methods. By type-hinting the `Illuminate\Http\Request` object, you may gain convenient access to the authenticated user from any controller method in your application via the request's `user` method:

```php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\RedirectResponse;
Expand Down Expand Up @@ -241,8 +239,6 @@ You are not required to use the authentication scaffolding included with Laravel
We will access Laravel's authentication services via the `Auth` [facade](/docs/{{version}}/facades), so we'll need to make sure to import the `Auth` facade at the top of the class. Next, let's check out the `attempt` method. The `attempt` method is normally used to handle authentication attempts from your application's "login" form. If authentication is successful, you should regenerate the user's [session](/docs/{{version}}/session) to prevent [session fixation](https://en.wikipedia.org/wiki/Session_fixation):

```php
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
Expand Down Expand Up @@ -442,8 +438,6 @@ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
You may also use HTTP Basic Authentication without setting a user identifier cookie in the session. This is primarily helpful if you choose to use HTTP Authentication to authenticate requests to your application's API. To accomplish this, [define a middleware](/docs/{{version}}/middleware) that calls the `onceBasic` method. If no response is returned by the `onceBasic` method, the request may be passed further into the application:

```php
<?php

namespace App\Http\Middleware;

use Closure;
Expand Down Expand Up @@ -601,8 +595,6 @@ Route::post('/settings', function () {
You may define your own authentication guards using the `extend` method on the `Auth` facade. You should place your call to the `extend` method within a [service provider](/docs/{{version}}/providers). Since Laravel already ships with an `AppServiceProvider`, we can place the code in that provider:

```php
<?php

namespace App\Providers;

use App\Services\Auth\JwtGuard;
Expand Down Expand Up @@ -686,8 +678,6 @@ Route::middleware('auth:api')->group(function () {
If you are not using a traditional relational database to store your users, you will need to extend Laravel with your own authentication user provider. We will use the `provider` method on the `Auth` facade to define a custom user provider. The user provider resolver should return an implementation of `Illuminate\Contracts\Auth\UserProvider`:

```php
<?php

namespace App\Providers;

use App\Extensions\MongoUserProvider;
Expand Down Expand Up @@ -742,8 +732,6 @@ Finally, you may reference this provider in your `guards` configuration:
Let's take a look at the `Illuminate\Contracts\Auth\UserProvider` contract:

```php
<?php

namespace Illuminate\Contracts\Auth;

interface UserProvider
Expand Down Expand Up @@ -775,8 +763,6 @@ The `rehashPasswordIfRequired` method should rehash the given `$user`'s password
Now that we have explored each of the methods on the `UserProvider`, let's take a look at the `Authenticatable` contract. Remember, user providers should return implementations of this interface from the `retrieveById`, `retrieveByToken`, and `retrieveByCredentials` methods:

```php
<?php

namespace Illuminate\Contracts\Auth;

interface Authenticatable
Expand Down
14 changes: 0 additions & 14 deletions authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ public function boot(): void
To authorize an action using gates, you should use the `allows` or `denies` methods provided by the `Gate` facade. Note that you are not required to pass the currently authenticated user to these methods. Laravel will automatically take care of passing the user into the gate closure. It is typical to call the gate authorization methods within your application's controllers before performing an action that requires authorization:

```php
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
Expand Down Expand Up @@ -355,8 +353,6 @@ Once the policy class has been registered, you may add methods for each action i
The `update` method will receive a `User` and a `Post` instance as its arguments, and should return `true` or `false` indicating whether the user is authorized to update the given `Post`. So, in this example, we will verify that the user's `id` matches the `user_id` on the post:

```php
<?php

namespace App\Policies;

use App\Models\Post;
Expand Down Expand Up @@ -484,8 +480,6 @@ public function create(User $user): bool
By default, all gates and policies automatically return `false` if the incoming HTTP request was not initiated by an authenticated user. However, you may allow these authorization checks to pass through to your gates and policies by declaring an "optional" type-hint or supplying a `null` default value for the user argument definition:

```php
<?php

namespace App\Policies;

use App\Models\Post;
Expand Down Expand Up @@ -538,8 +532,6 @@ If you would like to deny all authorization checks for a particular type of user
The `App\Models\User` model that is included with your Laravel application includes two helpful methods for authorizing actions: `can` and `cannot`. The `can` and `cannot` methods receive the name of the action you wish to authorize and the relevant model. For example, let's determine if a user is authorized to update a given `App\Models\Post` model. Typically, this will be done within a controller method:

```php
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
Expand Down Expand Up @@ -573,8 +565,6 @@ If a [policy is registered](#registering-policies) for the given model, the `can
Remember, some actions may correspond to policy methods like `create` that do not require a model instance. In these situations, you may pass a class name to the `can` method. The class name will be used to determine which policy to use when authorizing the action:

```php
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
Expand Down Expand Up @@ -608,8 +598,6 @@ In addition to helpful methods provided to the `App\Models\User` model, you can
Like the `can` method, this method accepts the name of the action you wish to authorize and the relevant model. If the action is not authorized, the `authorize` method will throw an `Illuminate\Auth\Access\AuthorizationException` exception which the Laravel exception handler will automatically convert to an HTTP response with a 403 status code:

```php
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
Expand Down Expand Up @@ -808,8 +796,6 @@ Although authorization must always be handled on the server, it can often be con
However, if you are using one of Laravel's Inertia-based [starter kits](/docs/{{version}}/starter-kits), your application already contains a `HandleInertiaRequests` middleware. Within this middleware's `share` method, you may return shared data that will be provided to all Inertia pages in your application. This shared data can serve as a convenient location to define authorization information for the user:

```php
<?php

namespace App\Http\Middleware;

use App\Models\Post;
Expand Down
6 changes: 0 additions & 6 deletions billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ We can even easily determine if a user is subscribed to specific product or pric
For convenience, you may wish to create a [middleware](/docs/{{version}}/middleware) which determines if the incoming request is from a subscribed user. Once this middleware has been defined, you may easily assign it to a route to prevent users that are not subscribed from accessing the route:

```php
<?php

namespace App\Http\Middleware;

use Closure;
Expand Down Expand Up @@ -1067,8 +1065,6 @@ if ($user->subscribed('default')) {
The `subscribed` method also makes a great candidate for a [route middleware](/docs/{{version}}/middleware), allowing you to filter access to routes and controllers based on the user's subscription status:

```php
<?php

namespace App\Http\Middleware;

use Closure;
Expand Down Expand Up @@ -1939,8 +1935,6 @@ Cashier automatically handles subscription cancellations for failed charges and
Both events contain the full payload of the Stripe webhook. For example, if you wish to handle the `invoice.payment_succeeded` webhook, you may register a [listener](/docs/{{version}}/events#defining-listeners) that will handle the event:

```php
<?php

namespace App\Listeners;

use Laravel\Cashier\Events\WebhookReceived;
Expand Down
8 changes: 0 additions & 8 deletions blade.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ The current UNIX timestamp is {{ time() }}.
By default, Blade (and the Laravel `e` function) will double encode HTML entities. If you would like to disable double encoding, call the `Blade::withoutDoubleEncoding` method from the `boot` method of your `AppServiceProvider`:

```php
<?php

namespace App\Providers;

use Illuminate\Support\Facades\Blade;
Expand Down Expand Up @@ -801,8 +799,6 @@ You may pass data to Blade components using HTML attributes. Hard-coded, primiti
You should define all of the component's data attributes in its class constructor. All public properties on a component will automatically be made available to the component's view. It is not necessary to pass the data to the view from the component's `render` method:

```php
<?php

namespace App\View\Components;

use Illuminate\View\Component;
Expand Down Expand Up @@ -973,8 +969,6 @@ public function __construct(
If you would like to prevent some public methods or properties from being exposed as variables to your component template, you may add them to an `$except` array property on your component:

```php
<?php

namespace App\View\Components;

use Illuminate\View\Component;
Expand Down Expand Up @@ -1873,8 +1867,6 @@ Blade allows you to define your own custom directives using the `directive` meth
The following example creates a `@datetime($var)` directive which formats a given `$var`, which should be an instance of `DateTime`:

```php
<?php

namespace App\Providers;

use Illuminate\Support\Facades\Blade;
Expand Down
14 changes: 0 additions & 14 deletions broadcasting.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,6 @@ OrderShipmentStatusUpdated::dispatch($order);
When a user is viewing one of their orders, we don't want them to have to refresh the page to view status updates. Instead, we want to broadcast the updates to the application as they are created. So, we need to mark the `OrderShipmentStatusUpdated` event with the `ShouldBroadcast` interface. This will instruct Laravel to broadcast the event when it is fired:

```php
<?php

namespace App\Events;

use App\Models\Order;
Expand Down Expand Up @@ -442,8 +440,6 @@ To inform Laravel that a given event should be broadcast, you must implement the
The `ShouldBroadcast` interface requires you to implement a single method: `broadcastOn`. The `broadcastOn` method should return a channel or array of channels that the event should broadcast on. The channels should be instances of `Channel`, `PrivateChannel`, or `PresenceChannel`. Instances of `Channel` represent public channels that any user may subscribe to, while `PrivateChannels` and `PresenceChannels` represent private channels that require [channel authorization](#authorizing-channels):

```php
<?php

namespace App\Events;

use App\Models\User;
Expand Down Expand Up @@ -569,8 +565,6 @@ public function broadcastQueue(): string
If you would like to broadcast your event using the `sync` queue instead of the default queue driver, you can implement the `ShouldBroadcastNow` interface instead of `ShouldBroadcast`:

```php
<?php

use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;

class OrderShipmentStatusUpdated implements ShouldBroadcastNow
Expand Down Expand Up @@ -602,8 +596,6 @@ When broadcast events are dispatched within database transactions, they may be p
If your queue connection's `after_commit` configuration option is set to `false`, you may still indicate that a particular broadcast event should be dispatched after all open database transactions have been committed by implementing the `ShouldDispatchAfterCommit` interface on the event class:

```php
<?php

namespace App\Events;

use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
Expand Down Expand Up @@ -697,8 +689,6 @@ Broadcast::channel('orders.{order}', OrderChannel::class);
Finally, you may place the authorization logic for your channel in the channel class' `join` method. This `join` method will house the same logic you would have typically placed in your channel authorization closure. You may also take advantage of channel model binding:

```php
<?php

namespace App\Broadcasting;

use App\Models\Order;
Expand Down Expand Up @@ -785,8 +775,6 @@ broadcast(new OrderShipmentStatusUpdated($update))->via('pusher');
Alternatively, you may specify the event's broadcast connection by calling the `broadcastVia` method within the event's constructor. However, before doing so, you should ensure that the event class uses the `InteractsWithBroadcasting` trait:

```php
<?php

namespace App\Events;

use Illuminate\Broadcasting\Channel;
Expand Down Expand Up @@ -1037,8 +1025,6 @@ However, if you are not using these events for any other purposes in your applic
To get started, your Eloquent model should use the `Illuminate\Database\Eloquent\BroadcastsEvents` trait. In addition, the model should define a `broadcastOn` method, which will return an array of channels that the model's events should broadcast on:

```php
<?php

namespace App\Models;

use Illuminate\Broadcasting\Channel;
Expand Down
6 changes: 0 additions & 6 deletions cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ For more information on configuring MongoDB, please refer to the MongoDB [Cache
To obtain a cache store instance, you may use the `Cache` facade, which is what we will use throughout this documentation. The `Cache` facade provides convenient, terse access to the underlying implementations of the Laravel cache contracts:

```php
<?php

namespace App\Http\Controllers;

use Illuminate\Support\Facades\Cache;
Expand Down Expand Up @@ -448,8 +446,6 @@ Cache::lock('processing')->forceRelease();
To create our custom cache driver, we first need to implement the `Illuminate\Contracts\Cache\Store` [contract](/docs/{{version}}/contracts). So, a MongoDB cache implementation might look something like this:

```php
<?php

namespace App\Extensions;

use Illuminate\Contracts\Cache\Store;
Expand Down Expand Up @@ -486,8 +482,6 @@ Cache::extend('mongo', function (Application $app) {
To register the custom cache driver with Laravel, we will use the `extend` method on the `Cache` facade. Since other service providers may attempt to read cached values within their `boot` method, we will register our custom driver within a `booting` callback. By using the `booting` callback, we can ensure that the custom driver is registered just before the `boot` method is called on our application's service providers but after the `register` method is called on all of the service providers. We will register our `booting` callback within the `register` method of our application's `App\Providers\AppServiceProvider` class:

```php
<?php

namespace App\Providers;

use App\Extensions\MongoStore;
Expand Down
6 changes: 0 additions & 6 deletions cashier-paddle.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,6 @@ We can even easily determine if a user is subscribed to specific product or pric
For convenience, you may wish to create a [middleware](/docs/{{version}}/middleware) which determines if the incoming request is from a subscribed user. Once this middleware has been defined, you may easily assign it to a route to prevent users that are not subscribed from accessing the route:

```php
<?php

namespace App\Http\Middleware;

use Closure;
Expand Down Expand Up @@ -797,8 +795,6 @@ if ($user->subscribed('default')) {
The `subscribed` method also makes a great candidate for a [route middleware](/docs/{{version}}/middleware), allowing you to filter access to routes and controllers based on the user's subscription status:

```php
<?php

namespace App\Http\Middleware;

use Closure;
Expand Down Expand Up @@ -1390,8 +1386,6 @@ Cashier automatically handles subscription cancelation on failed charges and oth
Both events contain the full payload of the Paddle webhook. For example, if you wish to handle the `transaction.billed` webhook, you may register a [listener](/docs/{{version}}/events#defining-listeners) that will handle the event:

```php
<?php

namespace App\Listeners;

use Laravel\Paddle\Events\WebhookReceived;
Expand Down
Loading