master

laravel/framework

Last updated at: 29/12/2023 09:25

Schedule.php

TLDR

This file contains the Schedule facade, which provides a convenient way to interact with the Illuminate\Console\Scheduling\Schedule class in the Laravel framework.

Classes

Schedule

The Schedule class is a facade that allows easy access to the Illuminate\Console\Scheduling\Schedule class. It provides static methods that can be called directly, without the need to create an instance of the Schedule class. The Schedule facade acts as an interface to the underlying ConsoleSchedule class.

The Schedule facade provides the following methods:

  • call: Creates a CallbackEvent to schedule a callback function or method.
  • command: Creates an Event to schedule an artisan command.
  • job: Creates an Event to schedule a job.
  • exec: Creates an Event to schedule the execution of a command.
  • compileArrayInput: Compiles an array input into a string.
  • serverShouldRun: Determines if the server should run the given event at the specified time.
  • dueEvents: Retrieves a collection of due events.
  • events: Retrieves an array of all scheduled events.
  • useCache: Sets the cache store that should be used.
  • macro: Adds a macro to the facade.
  • mixin: Mixes a class into the facade.
  • hasMacro: Checks if a macro is registered with the facade.
  • flushMacros: Flushes all of the macros from the facade.

For more details and usage examples, refer to the Schedule class in the Laravel documentation.

<?php

namespace Illuminate\Support\Facades;

use Illuminate\Console\Scheduling\Schedule as ConsoleSchedule;

/**
 * @method static \Illuminate\Console\Scheduling\CallbackEvent call(string|callable $callback, array $parameters = [])
 * @method static \Illuminate\Console\Scheduling\Event command(string $command, array $parameters = [])
 * @method static \Illuminate\Console\Scheduling\CallbackEvent job(object|string $job, string|null $queue = null, string|null $connection = null)
 * @method static \Illuminate\Console\Scheduling\Event exec(string $command, array $parameters = [])
 * @method static string compileArrayInput(string|int $key, array $value)
 * @method static bool serverShouldRun(\Illuminate\Console\Scheduling\Event $event, \DateTimeInterface $time)
 * @method static \Illuminate\Support\Collection dueEvents(\Illuminate\Contracts\Foundation\Application $app)
 * @method static \Illuminate\Console\Scheduling\Event[] events()
 * @method static \Illuminate\Console\Scheduling\Schedule useCache(string $store)
 * @method static void macro(string $name, object|callable $macro)
 * @method static void mixin(object $mixin, bool $replace = true)
 * @method static bool hasMacro(string $name)
 * @method static void flushMacros()
 *
 * @see \Illuminate\Console\Scheduling\Schedule
 */
class Schedule extends Facade
{
    /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return ConsoleSchedule::class;
    }
}