diff --git a/authentication.md b/authentication.md index 9fbfd79d320..6edc1c26df1 100644 --- a/authentication.md +++ b/authentication.md @@ -599,7 +599,7 @@ To get started, call the `Auth::viaRequest` method within the `boot` method of y $this->registerPolicies(); Auth::viaRequest('custom-token', function (Request $request) { - return User::where('token', $request->token)->first(); + return User::where('token', (string) $request->token)->first(); }); } diff --git a/billing.md b/billing.md index 8c31b67d372..1925dcbb184 100644 --- a/billing.md +++ b/billing.md @@ -1468,8 +1468,9 @@ To ensure your application can handle Stripe webhooks, be sure to configure the - `customer.subscription.deleted` - `customer.updated` - `customer.deleted` -- `invoice.payment_succeeded` +- `payment_method.automatically_updated` - `invoice.payment_action_required` +- `invoice.payment_succeeded` 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: diff --git a/blade.md b/blade.md index e3f7754f8db..e4ae04f5639 100644 --- a/blade.md +++ b/blade.md @@ -293,7 +293,7 @@ You may determine if a template inheritance section has content using the `@hasS @endif ``` -You may use the `sectionMissing` directive to determine if a section does not have content: +You may use the `@sectionMissing` directive to determine if a section does not have content: ```blade @sectionMissing('navigation') @@ -547,7 +547,7 @@ If you would like to `@include` a view if a given boolean expression evaluates t @includeUnless($boolean, 'view.name', ['status' => 'complete']) ``` -To include the first view that exists from a given array of views, you may use the `includeFirst` directive: +To include the first view that exists from a given array of views, you may use the `@includeFirst` directive: ```blade @includeFirst(['custom.admin', 'admin'], ['status' => 'complete']) diff --git a/configuration.md b/configuration.md index 7f9c7fde14d..5a69094061a 100644 --- a/configuration.md +++ b/configuration.md @@ -197,6 +197,12 @@ To give your application a speed boost, you should cache all of your configurati You should typically run the `php artisan config:cache` command as part of your production deployment process. The command should not be run during local development as configuration options will frequently need to be changed during the course of your application's development. +The `config:clear` command may be used to purge the cached configuration: + +```shell +php artisan config:clear +``` + > **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. @@ -248,7 +254,7 @@ https://example.com/1630542a-246b-4b66-afa1-dd72a4c43515 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** -> 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 `?`. +> 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 `&`. #### Pre-Rendering The Maintenance Mode View diff --git a/documentation.md b/documentation.md index 54cdd558ee3..ed2333bcd81 100644 --- a/documentation.md +++ b/documentation.md @@ -95,4 +95,4 @@ - [Socialite](/docs/{{version}}/socialite) - [Telescope](/docs/{{version}}/telescope) - [Valet](/docs/{{version}}/valet) -- [API Documentation](/api/9.x) +- [API Documentation](https://api.laravel.com/docs/9.x) diff --git a/frontend.md b/frontend.md index 50174564a90..53839fa7dbe 100644 --- a/frontend.md +++ b/frontend.md @@ -109,7 +109,7 @@ If you would like to build your frontend using PHP and Livewire, you can leverag Although it's possible to build modern frontends using Laravel and Livewire, many developers still prefer to leverage the power of a JavaScript framework like Vue or React. This allows developers to take advantage of the rich ecosystem of JavaScript packages and tools available via NPM. -However, without additional tooling, pairing Laravel with Vue or React would leave us needing to solve a variety of complicated problems such as client-side routing, data hydration, and authentication. Client-side routing is often simplified by using opinionated Vue / React frameworks such as [Nuxt](https://nuxtjs.org/) and [Next](https://nextjs.org/); however, data hydration and authentication remain complicated and cumbersome problems to solve when pairing a backend framework like Laravel with these frontend frameworks. +However, without additional tooling, pairing Laravel with Vue or React would leave us needing to solve a variety of complicated problems such as client-side routing, data hydration, and authentication. Client-side routing is often simplified by using opinionated Vue / React frameworks such as [Nuxt](https://nuxt.com/) and [Next](https://nextjs.org/); however, data hydration and authentication remain complicated and cumbersome problems to solve when pairing a backend framework like Laravel with these frontend frameworks. In addition, developers are left maintaining two separate code repositories, often needing to coordinate maintenance, releases, and deployments across both repositories. While these problems are not insurmountable, we don't believe it's a productive or enjoyable way to develop applications. diff --git a/homestead.md b/homestead.md index 81d3a93805e..51aaad37e02 100644 --- a/homestead.md +++ b/homestead.md @@ -18,6 +18,7 @@ - [Ports](#ports) - [PHP Versions](#php-versions) - [Connecting To Databases](#connecting-to-databases) + - [Creating Databases](#creating-databases) - [Database Backups](#database-backups) - [Configuring Cron Schedules](#configuring-cron-schedules) - [Configuring MailHog](#configuring-mailhog) @@ -60,7 +61,7 @@ Homestead runs on any Windows, macOS, or Linux system and includes Nginx, PHP, M - Ubuntu 20.04 - Git -- PHP 8.2 +- PHP 8.2 (Default) - PHP 8.1 - PHP 8.0 - PHP 7.4 @@ -76,7 +77,7 @@ Homestead runs on any Windows, macOS, or Linux system and includes Nginx, PHP, M - PostgreSQL 15 - Composer - Docker -- Node (With Yarn, Bower, Grunt, and Gulp) +- Node 18 (With Yarn, Bower, Grunt, and Gulp) - Redis - Memcached - Beanstalkd @@ -110,9 +111,11 @@ Homestead runs on any Windows, macOS, or Linux system and includes Nginx, PHP, M - Crystal & Lucky Framework - Elasticsearch - EventStoreDB +- Flyway - Gearman - Go - Grafana +- Heroku CLI - InfluxDB - MariaDB - Meilisearch @@ -122,7 +125,7 @@ Homestead runs on any Windows, macOS, or Linux system and includes Nginx, PHP, M - Oh My Zsh - Open Resty - PM2 -- Python +- Python 3 - R - RabbitMQ - RVM (Ruby Version Manager) @@ -335,9 +338,11 @@ features: version: 7.9.0 - eventstore: true version: 21.2.0 + - flyway: true - gearman: true - golang: true - grafana: true + - heroku: true - influxdb: true - mariadb: true - meilisearch: true @@ -369,7 +374,12 @@ You may specify a supported version of Elasticsearch, which must be an exact ver #### MariaDB -Enabling MariaDB will remove MySQL and install MariaDB. MariaDB typically serves as a drop-in replacement for MySQL, so you should still use the `mysql` database driver in your application's database configuration. +Enabling MariaDB will remove MySQL and install MariaDB. MariaDB typically serves as a drop-in replacement for MySQL, so you should still use the `mysql` database driver in your application's database configuration: + +```yaml +features: + - mariadb: true +``` #### MongoDB @@ -563,7 +573,7 @@ Homestead supports running multiple versions of PHP on the same virtual machine. sites: - map: homestead.test to: /home/vagrant/project1/public - php: "7.1" + php: "7.4" ``` [Within your Homestead virtual machine](#connecting-via-ssh), you may use any of the supported PHP versions via the CLI: @@ -580,7 +590,13 @@ php8.1 artisan list php8.2 artisan list ``` -You may change the default version of PHP used by the CLI by issuing the following commands from within your Homestead virtual machine: +You may also specify the version of PHP that should be used by the CLI in your `Homestead.yaml` file: + +```yaml +php: 8.0 +``` + +Or, you may change it manually by issuing the following commands from within your Homestead virtual machine: ```shell php56 @@ -602,6 +618,17 @@ A `homestead` database is configured for both MySQL and PostgreSQL out of the bo > **Warning** > You should only use these non-standard ports when connecting to the databases from your host machine. You will use the default 3306 and 5432 ports in your Laravel application's `database` configuration file since Laravel is running _within_ the virtual machine. + +### Creating Databases + +Homestead can automatically create any databases needed by your application. If a database service is running during the provisioning process, Homestead will ensure each database in your `Homestead.yaml` configuration file is created if it doesn't already exist: + +```yaml +databases: + - database_1 + - database_2 +``` + ### Database Backups @@ -725,7 +752,9 @@ share homestead.test -region=eu -subdomain=laravel Homestead includes support for step debugging using [Xdebug](https://xdebug.org). For example, you can access a page in your browser and PHP will connect to your IDE to allow inspection and modification of the running code. -By default, Xdebug is already running and ready to accept connections. If you need to enable Xdebug on the CLI, execute the `sudo phpenmod xdebug` command within your Homestead virtual machine. Next, follow your IDE's instructions to enable debugging. Finally, configure your browser to trigger Xdebug with an extension or [bookmarklet](https://www.jetbrains.com/phpstorm/marklets/). +By default, Xdebug is already running and ready to accept connections. If you need to enable or disable Xdebug on the CLI, execute the `sudo phpenmod xdebug` or `sudo phpdismod xdebug` commands within your Homestead virtual machine. + +Next, follow your IDE's instructions to enable debugging. Finally, configure your browser to trigger Xdebug with an extension or [bookmarklet](https://www.jetbrains.com/phpstorm/marklets/). > **Warning** > Xdebug causes PHP to run significantly slower. To disable Xdebug, run `sudo phpdismod xdebug` within your Homestead virtual machine and restart the FPM service. diff --git a/installation.md b/installation.md index dcdf41cb7fc..4591a697165 100644 --- a/installation.md +++ b/installation.md @@ -56,7 +56,7 @@ Before creating your first Laravel project, you should ensure that your local ma After you have installed PHP and Composer, you may create a new Laravel project via the Composer `create-project` command: ```nothing -composer create-project laravel/laravel example-app +composer create-project laravel/laravel:^9.0 example-app ``` Or, you may create new Laravel projects by globally installing the Laravel installer via Composer: @@ -220,13 +220,7 @@ Your `.env` file should not be committed to your application's source control, s Now that you have created your Laravel application, you probably want to store some data in a database. By default, your application's `.env` configuration file specifies that Laravel will be interacting with a MySQL database and will access the database at `127.0.0.1`. If you are developing on macOS and need to install MySQL, Postgres, or Redis locally, you may find it convenient to utilize [DBngin](https://dbngin.com/). -If you do not want to install MySQL or Postgres on your local machine, you can always use a [SQLite](https://www.sqlite.org/index.html) database. SQLite is a small, fast, self-contained database engine. To get started, create a SQLite database by creating an empty SQLite file. Typically, this file will exist within the `database` directory of your Laravel application: - -```shell -touch database/database.sqlite -``` - -Next, update your `.env` configuration file to use Laravel's `sqlite` database driver. You may remove the other database configuration options: +If you do not want to install MySQL or Postgres on your local machine, you can always use a [SQLite](https://www.sqlite.org/index.html) database. SQLite is a small, fast, self-contained database engine. To get started, update your `.env` configuration file to use Laravel's `sqlite` database driver. You may remove the other database configuration options: ```ini DB_CONNECTION=sqlite # [tl! add] @@ -244,6 +238,8 @@ Once you have configured your SQLite database, you may run your application's [d php artisan migrate ``` +If an SQLite database does not exist for your application, Laravel will ask you if you would like the database to be created. Typically, the SQLite database file will be created at `database/database.sqlite`. + ## Next Steps diff --git a/middleware.md b/middleware.md index 94061ba4d65..01b9c294520 100644 --- a/middleware.md +++ b/middleware.md @@ -60,7 +60,6 @@ It's best to envision middleware as a series of "layers" HTTP requests must pass > **Note** > All middleware are resolved via the [service container](/docs/{{version}}/container), so you may type-hint any dependencies you need within a middleware's constructor. - #### Middleware & Responses diff --git a/migrations.md b/migrations.md index 9d6c6b7233a..fd72dc5df57 100644 --- a/migrations.md +++ b/migrations.md @@ -965,7 +965,7 @@ Modifier | Description `->unsigned()` | Set INTEGER columns as UNSIGNED (MySQL). `->useCurrent()` | Set TIMESTAMP columns to use CURRENT_TIMESTAMP as default value. `->useCurrentOnUpdate()` | Set TIMESTAMP columns to use CURRENT_TIMESTAMP when a record is updated. -`->virtualAs($expression)` | Create a virtual generated column (MySQL). +`->virtualAs($expression)` | Create a virtual generated column (MySQL / PostgreSQL / SQLite). `->generatedAs($expression)` | Create an identity column with specified sequence options (PostgreSQL). `->always()` | Defines the precedence of sequence values over input for an identity column (PostgreSQL). `->isGeometry()` | Set spatial column type to `geometry` - the default type is `geography` (PostgreSQL). diff --git a/notifications.md b/notifications.md index 65950c9562e..f804f32dd8f 100644 --- a/notifications.md +++ b/notifications.md @@ -303,6 +303,7 @@ However, if you would like to make the final determination on whether the queued Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the `Notification` facade's `route` method, you may specify ad-hoc notification routing information before sending the notification: use Illuminate\Broadcasting\Channel; + use Illuminate\Support\Facades\Notification; Notification::route('mail', 'taylor@example.com') ->route('vonage', '5555555555') diff --git a/octane.md b/octane.md index c4086d8f539..d864416691f 100644 --- a/octane.md +++ b/octane.md @@ -463,8 +463,8 @@ While building your application, you should take special care to avoid creating When using Swoole, you may execute operations concurrently via light-weight background tasks. You may accomplish this using Octane's `concurrently` method. You may combine this method with PHP array destructuring to retrieve the results of each operation: ```php -use App\User; -use App\Server; +use App\Models\User; +use App\Models\Server; use Laravel\Octane\Facades\Octane; [$users, $servers] = Octane::concurrently([ diff --git a/queues.md b/queues.md index 3dabeffbbb9..30eb378eaec 100644 --- a/queues.md +++ b/queues.md @@ -274,7 +274,7 @@ In certain cases, you may want to define a specific "key" that makes the job uni
diff --git a/routing.md b/routing.md index 90d146d1ba5..ea257311163 100644 --- a/routing.md +++ b/routing.md @@ -466,7 +466,6 @@ Typically, implicit model binding will not retrieve models that have been [soft return $user->email; })->withTrashed(); - #### Customizing The Key diff --git a/session.md b/session.md index 086ef9f070d..527393f7e44 100644 --- a/session.md +++ b/session.md @@ -187,7 +187,7 @@ The `pull` method will retrieve and delete an item from the session in a single $value = $request->session()->pull('key', 'default'); - + #### Incrementing & Decrementing Session Values If your session data contains an integer you wish to increment or decrement, you may use the `increment` and `decrement` methods: diff --git a/starter-kits.md b/starter-kits.md index b4fab3552d0..54188b121b5 100644 --- a/starter-kits.md +++ b/starter-kits.md @@ -104,7 +104,7 @@ php artisan breeze:install react --ssr ### Breeze & Next.js / API -Laravel Breeze can also scaffold an authentication API that is ready to authenticate modern JavaScript applications such as those powered by [Next](https://nextjs.org), [Nuxt](https://nuxtjs.org), and others. To get started, specify the `api` stack as your desired stack when executing the `breeze:install` Artisan command: +Laravel Breeze can also scaffold an authentication API that is ready to authenticate modern JavaScript applications such as those powered by [Next](https://nextjs.org), [Nuxt](https://nuxt.com), and others. To get started, specify the `api` stack as your desired stack when executing the `breeze:install` Artisan command: ```shell php artisan breeze:install api @@ -126,4 +126,4 @@ While Laravel Breeze provides a simple and minimal starting point for building a Jetstream provides a beautifully designed application scaffolding for Laravel and includes login, registration, email verification, two-factor authentication, session management, API support via Laravel Sanctum, and optional team management. Jetstream is designed using [Tailwind CSS](https://tailwindcss.com) and offers your choice of [Livewire](https://laravel-livewire.com) or [Inertia](https://inertiajs.com) driven frontend scaffolding. -Complete documentation for installing Laravel Jetstream can be found within the [official Jetstream documentation](https://jetstream.laravel.com/2.x/introduction.html). +Complete documentation for installing Laravel Jetstream can be found within the [official Jetstream documentation](https://jetstream.laravel.com/introduction.html). diff --git a/upgrade.md b/upgrade.md index 9af2e0b4edb..04e6aba6285 100644 --- a/upgrade.md +++ b/upgrade.md @@ -402,6 +402,10 @@ Storage::extend('dropbox', function ($app, $config) { }); ``` +#### SFTP Private-Public Key Passphrase + +If your application is using Flysystem's SFTP adapter and private-public key authentication, the `password` configuration item that is used to decrypt the private key should be renamed to `passphrase`. + ### Helpers