Skip to content

Commit c1438c8

Browse files
authored
Torchlight Code Fences (#7657)
* working on fences * more work on fences * more fences * working on fences * update code fencing * fences * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * fix upgrade guide and release notes
1 parent a6703d4 commit c1438c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2343
-1409
lines changed

artisan.md

+48-20
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,24 @@
2727

2828
Artisan is the command line interface included with Laravel. Artisan exists at the root of your application as the `artisan` script and provides a number of helpful commands that can assist you while you build your application. To view a list of all available Artisan commands, you may use the `list` command:
2929

30-
php artisan list
30+
```shell
31+
php artisan list
32+
```
3133

3234
Every command also includes a "help" screen which displays and describes the command's available arguments and options. To view a help screen, precede the name of the command with `help`:
3335

34-
php artisan help migrate
36+
```shell
37+
php artisan help migrate
38+
```
3539

3640
<a name="laravel-sail"></a>
3741
#### Laravel Sail
3842

3943
If you are using [Laravel Sail](/docs/{{version}}/sail) as your local development environment, remember to use the `sail` command line to invoke Artisan commands. Sail will execute your Artisan commands within your application's Docker containers:
4044

41-
./sail artisan list
45+
```shell
46+
./sail artisan list
47+
```
4248

4349
<a name="tinker"></a>
4450
### Tinker (REPL)
@@ -50,7 +56,9 @@ Laravel Tinker is a powerful REPL for the Laravel framework, powered by the [Psy
5056

5157
All Laravel applications include Tinker by default. However, you may install Tinker using Composer if you have previously removed it from your application:
5258

53-
composer require laravel/tinker
59+
```shell
60+
composer require laravel/tinker
61+
```
5462

5563
> {tip} Looking for a graphical UI for interacting with your Laravel application? Check out [Tinkerwell](https://tinkerwell.app)!
5664
@@ -59,11 +67,15 @@ All Laravel applications include Tinker by default. However, you may install Tin
5967

6068
Tinker allows you to interact with your entire Laravel application on the command line, including your Eloquent models, jobs, events, and more. To enter the Tinker environment, run the `tinker` Artisan command:
6169

62-
php artisan tinker
70+
```shell
71+
php artisan tinker
72+
```
6373

6474
You can publish Tinker's configuration file using the `vendor:publish` command:
6575

66-
php artisan vendor:publish --provider="Laravel\Tinker\TinkerServiceProvider"
76+
```shell
77+
php artisan vendor:publish --provider="Laravel\Tinker\TinkerServiceProvider"
78+
```
6779

6880
> {note} 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.
6981
@@ -95,7 +107,9 @@ In addition to the commands provided with Artisan, you may build your own custom
95107

96108
To create a new command, you may use the `make:command` Artisan command. This command will create a new command class in the `app/Console/Commands` directory. Don't worry if this directory does not exist in your application - it will be created the first time you run the `make:command` Artisan command:
97109

98-
php artisan make:command SendEmails
110+
```shell
111+
php artisan make:command SendEmails
112+
```
99113

100114
<a name="command-structure"></a>
101115
### Command Structure
@@ -216,10 +230,10 @@ All user supplied arguments and options are wrapped in curly braces. In the foll
216230
You may also make arguments optional or define default values for arguments:
217231

218232
// Optional argument...
219-
mail:send {user?}
233+
'mail:send {user?}'
220234

221235
// Optional argument with default value...
222-
mail:send {user=foo}
236+
'mail:send {user=foo}'
223237

224238
<a name="options"></a>
225239
### Options
@@ -235,7 +249,9 @@ Options, like arguments, are another form of user input. Options are prefixed by
235249

236250
In this example, the `--queue` switch may be specified when calling the Artisan command. If the `--queue` switch is passed, the value of the option will be `true`. Otherwise, the value will be `false`:
237251

238-
php artisan mail:send 1 --queue
252+
```shell
253+
php artisan mail:send 1 --queue
254+
```
239255

240256
<a name="options-with-values"></a>
241257
#### Options With Values
@@ -251,46 +267,56 @@ Next, let's take a look at an option that expects a value. If the user must spec
251267

252268
In this example, the user may pass a value for the option like so. If the option is not specified when invoking the command, its value will be `null`:
253269

254-
php artisan mail:send 1 --queue=default
270+
```shell
271+
php artisan mail:send 1 --queue=default
272+
```
255273

256274
You may assign default values to options by specifying the default value after the option name. If no option value is passed by the user, the default value will be used:
257275

258-
mail:send {user} {--queue=default}
276+
'mail:send {user} {--queue=default}'
259277

260278
<a name="option-shortcuts"></a>
261279
#### Option Shortcuts
262280

263281
To assign a shortcut when defining an option, you may specify it before the option name and use the `|` character as a delimiter to separate the shortcut from the full option name:
264282

265-
mail:send {user} {--Q|queue}
283+
'mail:send {user} {--Q|queue}'
266284

267285
When invoking the command on your terminal, option shortcuts should be prefixed with a single hyphen:
268286

269-
php artisan mail:send 1 -Q
287+
```shell
288+
php artisan mail:send 1 -Q
289+
```
270290

271291
<a name="input-arrays"></a>
272292
### Input Arrays
273293

274294
If you would like to define arguments or options to expect multiple input values, you may use the `*` character. First, let's take a look at an example that specifies such an argument:
275295

276-
mail:send {user*}
296+
'mail:send {user*}'
277297

278298
When calling this method, the `user` arguments may be passed in order to the command line. For example, the following command will set the value of `user` to an array with `foo` and `bar` as its values:
279299

280-
php artisan mail:send foo bar
300+
```shell
301+
php artisan mail:send foo bar
302+
```
281303

282304
This `*` character can be combined with an optional argument definition to allow zero or more instances of an argument:
283305

284-
mail:send {user?*}
306+
'mail:send {user?*}'
285307

286308
<a name="option-arrays"></a>
287309
#### Option Arrays
288310

289311
When defining an option that expects multiple input values, each option value passed to the command should be prefixed with the option name:
290312

291-
mail:send {user} {--id=*}
313+
'mail:send {user} {--id=*}'
292314

293-
php artisan mail:send --id=1 --id=2
315+
Such a command may be invoked by passing multiple `--id` arguments:
316+
317+
```shell
318+
php artisan mail:send --id=1 --id=2
319+
```
294320

295321
<a name="input-descriptions"></a>
296322
### Input Descriptions
@@ -642,7 +668,9 @@ As you might expect, the `getSubscribedSignals` method should return an array of
642668

643669
The Artisan console's `make` commands are used to create a variety of classes, such as controllers, jobs, migrations, and tests. These classes are generated using "stub" files that are populated with values based on your input. However, you may want to make small changes to files generated by Artisan. To accomplish this, you may use the `stub:publish` command to publish the most common stubs to your application so that you can customize them:
644670

645-
php artisan stub:publish
671+
```shell
672+
php artisan stub:publish
673+
```
646674

647675
The published stubs will be located within a `stubs` directory in the root of your application. Any changes you make to these stubs will be reflected when you generate their corresponding classes using Artisan's `make` commands.
648676

authentication.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,10 @@ Once the middleware has been attached to the route, you will automatically be pr
354354

355355
If you are using PHP FastCGI and Apache to serve your Laravel application, HTTP Basic authentication may not work correctly. To correct these problems, the following lines may be added to your application's `.htaccess` file:
356356

357-
RewriteCond %{HTTP:Authorization} ^(.+)$
358-
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
357+
```apache
358+
RewriteCond %{HTTP:Authorization} ^(.+)$
359+
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
360+
```
359361

360362
<a name="stateless-http-basic-authentication"></a>
361363
### Stateless HTTP Basic Authentication

authorization.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,15 @@ Policies are classes that organize authorization logic around a particular model
245245

246246
You may generate a policy using the `make:policy` Artisan command. The generated policy will be placed in the `app/Policies` directory. If this directory does not exist in your application, Laravel will create it for you:
247247

248-
php artisan make:policy PostPolicy
248+
```shell
249+
php artisan make:policy PostPolicy
250+
```
249251

250252
The `make:policy` command will generate an empty policy class. If you would like to generate a class with example policy methods related to viewing, creating, updating, and deleting the resource, you may provide a `--model` option when executing the command:
251253

252-
php artisan make:policy PostPolicy --model=Post
254+
```shell
255+
php artisan make:policy PostPolicy --model=Post
256+
```
253257

254258
<a name="registering-policies"></a>
255259
### Registering Policies
@@ -663,7 +667,7 @@ Specifying the entire class name within a string middleware definition can becom
663667

664668
When writing Blade templates, you may wish to display a portion of the page only if the user is authorized to perform a given action. For example, you may wish to show an update form for a blog post only if the user can actually update the post. In this situation, you may use the `@can` and `@cannot` directives:
665669

666-
```html
670+
```blade
667671
@can('update', $post)
668672
<!-- The current user can update the post... -->
669673
@elsecan('create', App\Models\Post::class)
@@ -681,7 +685,7 @@ When writing Blade templates, you may wish to display a portion of the page only
681685

682686
These directives are convenient shortcuts for writing `@if` and `@unless` statements. The `@can` and `@cannot` statements above are equivalent to the following statements:
683687

684-
```html
688+
```blade
685689
@if (Auth::user()->can('update', $post))
686690
<!-- The current user can update the post... -->
687691
@endif
@@ -693,7 +697,7 @@ These directives are convenient shortcuts for writing `@if` and `@unless` statem
693697

694698
You may also determine if a user is authorized to perform any action from a given array of actions. To accomplish this, use the `@canany` directive:
695699

696-
```html
700+
```blade
697701
@canany(['update', 'view', 'delete'], $post)
698702
<!-- The current user can update, view, or delete the post... -->
699703
@elsecanany(['create'], \App\Models\Post::class)
@@ -706,7 +710,7 @@ You may also determine if a user is authorized to perform any action from a give
706710

707711
Like most of the other authorization methods, you may pass a class name to the `@can` and `@cannot` directives if the action does not require a model instance:
708712

709-
```html
713+
```blade
710714
@can('create', App\Models\Post::class)
711715
<!-- The current user can create posts... -->
712716
@endcan

billing.md

+37-13
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ When upgrading to a new version of Cashier, it's important that you carefully re
8282

8383
First, install the Cashier package for Stripe using the Composer package manager:
8484

85-
composer require laravel/cashier
85+
```shell
86+
composer require laravel/cashier
87+
```
8688

8789
> {note} To ensure Cashier properly handles all Stripe events, remember to [set up Cashier's webhook handling](#handling-stripe-webhooks).
8890
@@ -91,11 +93,15 @@ First, install the Cashier package for Stripe using the Composer package manager
9193

9294
Cashier's service provider registers its own database migration directory, so remember to migrate your database after installing the package. The Cashier migrations will add several columns to your `users` table as well as create a new `subscriptions` table to hold all of your customer's subscriptions:
9395

94-
php artisan migrate
96+
```shell
97+
php artisan migrate
98+
```
9599

96100
If you need to overwrite the migrations that ship with Cashier, you can publish them using the `vendor:publish` Artisan command:
97101

98-
php artisan vendor:publish --tag="cashier-migrations"
102+
```shell
103+
php artisan vendor:publish --tag="cashier-migrations"
104+
```
99105

100106
If you would like to prevent Cashier's migrations from running entirely, you may use the `ignoreMigrations` method provided by Cashier. Typically, this method should be called in the `register` method of your `AppServiceProvider`:
101107

@@ -150,19 +156,25 @@ Cashier assumes your billable model will be the `App\Models\User` class that shi
150156

151157
Next, you should configure your Stripe API keys in your application's `.env` file. You can retrieve your Stripe API keys from the Stripe control panel:
152158

153-
STRIPE_KEY=your-stripe-key
154-
STRIPE_SECRET=your-stripe-secret
159+
```ini
160+
STRIPE_KEY=your-stripe-key
161+
STRIPE_SECRET=your-stripe-secret
162+
```
155163

156164
<a name="currency-configuration"></a>
157165
### Currency Configuration
158166

159167
The default Cashier currency is United States Dollars (USD). You can change the default currency by setting the `CASHIER_CURRENCY` environment variable within your application's `.env` file:
160168

161-
CASHIER_CURRENCY=eur
169+
```ini
170+
CASHIER_CURRENCY=eur
171+
```
162172

163173
In addition to configuring Cashier's currency, you may also specify a locale to be used when formatting money values for display on invoices. Internally, Cashier utilizes [PHP's `NumberFormatter` class](https://www.php.net/manual/en/class.numberformatter.php) to set the currency locale:
164174

165-
CASHIER_CURRENCY_LOCALE=nl_BE
175+
```ini
176+
CASHIER_CURRENCY_LOCALE=nl_BE
177+
```
166178

167179
> {note} In order to use locales other than `en`, ensure the `ext-intl` PHP extension is installed and configured on your server.
168180
@@ -194,7 +206,9 @@ For this feature to work properly, your customer's billing details, such as the
194206

195207
Cashier allows you to specify the log channel to be used when logging fatal Stripe errors. You may specify the log channel by defining the `CASHIER_LOGGER` environment variable within your application's `.env` file:
196208

197-
CASHIER_LOGGER=stack
209+
```ini
210+
CASHIER_LOGGER=stack
211+
```
198212

199213
Exceptions that are generated by API calls to Stripe will be logged through your application's default log channel.
200214

@@ -1347,19 +1361,27 @@ To ensure your application can handle Stripe webhooks, be sure to configure the
13471361

13481362
For convenience, Cashier includes a `cashier:webhook` Artisan command. This command will create a webhook in Stripe that listens to all of the events required by Cashier:
13491363

1350-
php artisan cashier:webhook
1364+
```shell
1365+
php artisan cashier:webhook
1366+
```
13511367

13521368
By default, the created webhook will point to the URL defined by the `APP_URL` environment variable and the `cashier.webhook` route that is included with Cashier. You may provide the `--url` option when invoking the command if you would like to use a different URL:
13531369

1354-
php artisan cashier:webhook --url "https://example.com/stripe/webhook"
1370+
```shell
1371+
php artisan cashier:webhook --url "https://example.com/stripe/webhook"
1372+
```
13551373

13561374
The webhook that is created will use the Stripe API version that your version of Cashier is compatible with. If you would like to use a different Stripe version, you may provide the `--api-version` option:
13571375

1358-
php artisan cashier:webhook --api-version="2019-12-03"
1376+
```shell
1377+
php artisan cashier:webhook --api-version="2019-12-03"
1378+
```
13591379

13601380
After creation, the webhook will be immediately active. If you wish to create the webhook but have it disabled until you're ready, you may provide the `--disabled` option when invoking the command:
13611381

1362-
php artisan cashier:webhook --disabled
1382+
```shell
1383+
php artisan cashier:webhook --disabled
1384+
```
13631385

13641386
> {note} Make sure you protect incoming Stripe webhook requests with Cashier's included [webhook signature verification](#verifying-webhook-signatures) middleware.
13651387
@@ -1861,7 +1883,9 @@ For more information on `incomplete` and `past_due` states, please refer to [our
18611883

18621884
Since SCA regulations require customers to occasionally verify their payment details even while their subscription is active, Cashier can send a notification to the customer when off-session payment confirmation is required. For example, this may occur when a subscription is renewing. Cashier's payment notification can be enabled by setting the `CASHIER_PAYMENT_NOTIFICATION` environment variable to a notification class. By default, this notification is disabled. Of course, Cashier includes a notification class you may use for this purpose, but you are free to provide your own notification class if desired:
18631885

1864-
CASHIER_PAYMENT_NOTIFICATION=Laravel\Cashier\Notifications\ConfirmPayment
1886+
```ini
1887+
CASHIER_PAYMENT_NOTIFICATION=Laravel\Cashier\Notifications\ConfirmPayment
1888+
```
18651889

18661890
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.
18671891

0 commit comments

Comments
 (0)