Skip to content

Commit

Permalink
[11.x] Documents withSchedule (#9542)
Browse files Browse the repository at this point in the history
* Documents `withSchedule`

* Fixes typo

* Update scheduling.md

* Update scheduling.md

* Update scheduling.md

* Update scheduling.md

* Update scheduling.md

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
nunomaduro and taylorotwell authored Mar 28, 2024
1 parent a5b64ac commit e55e751
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scheduling.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ In addition to scheduling using closures, you may also schedule [invokable objec

Schedule::call(new DeleteRecentUsers)->daily();

If you prefer to reserve your `routes/console.php` file for command definitions only, you may use the `withSchedule` method in your application's `bootstrap/app.php` file to define your scheduled tasks. This method accepts a closure that receives an instance of the scheduler:

use Illuminate\Console\Scheduling\Schedule;

->withSchedule(function (Schedule $schedule) {
$schedule->call(new DeleteRecentUsers)->daily();
})

If you would like to view an overview of your scheduled tasks and the next time they are scheduled to run, you may use the `schedule:list` Artisan command:

```bash
Expand Down

0 comments on commit e55e751

Please sign in to comment.