- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Laravel 12 | Task Scheduling | Cron Job in Laravel | Daily Database Backup | | NoviceDeveloper
📌 What is a Cron Job in Laravel?
Cron Jobs are used to automatically run tasks at scheduled times — like every minute, daily, weekly, etc.
Laravel has a built-in task scheduling system that works with the system's cron.
✅ Good part: You only need one cron entry in your server to trigger Laravel's scheduler every minute.
🛠️ Steps to Create a Cron Job in Laravel
✅ Step 1: Create Artisan Command
php artisan make:command BackupDatabase
This will create a file:
➡️ app/Console/Commands/BackupDatabase.php
Inside that file:
You’ll find a $signature variable — this is your custom command name.
Inside the handle() method, write your business logic to take a backup.
✅ Step 2: Schedule the Command
In Laravel 10 or below:
Open: app/Console/Kernel.php
Inside the schedule() method, add this line:
schedule ⮕command('db:backup')⮕ daily();
In Laravel 11 and 12:
Open: routes/console.php
Add this inside the file: Schedule::command('db:backup')daily();
✅ Step 3: Add Cron Entry in Server
Finally, you need to add one cron job on your server:
php artisan schedule:run
Видео Laravel 12 | Task Scheduling | Cron Job in Laravel | Daily Database Backup | | NoviceDeveloper канала Novice Developer
Cron Jobs are used to automatically run tasks at scheduled times — like every minute, daily, weekly, etc.
Laravel has a built-in task scheduling system that works with the system's cron.
✅ Good part: You only need one cron entry in your server to trigger Laravel's scheduler every minute.
🛠️ Steps to Create a Cron Job in Laravel
✅ Step 1: Create Artisan Command
php artisan make:command BackupDatabase
This will create a file:
➡️ app/Console/Commands/BackupDatabase.php
Inside that file:
You’ll find a $signature variable — this is your custom command name.
Inside the handle() method, write your business logic to take a backup.
✅ Step 2: Schedule the Command
In Laravel 10 or below:
Open: app/Console/Kernel.php
Inside the schedule() method, add this line:
schedule ⮕command('db:backup')⮕ daily();
In Laravel 11 and 12:
Open: routes/console.php
Add this inside the file: Schedule::command('db:backup')daily();
✅ Step 3: Add Cron Entry in Server
Finally, you need to add one cron job on your server:
php artisan schedule:run
Видео Laravel 12 | Task Scheduling | Cron Job in Laravel | Daily Database Backup | | NoviceDeveloper канала Novice Developer
Комментарии отсутствуют
Информация о видео
20 июня 2025 г. 16:01:49
00:31:45
Другие видео канала





















