Task Reminder with Laravel & MongoDB
June 30, 2025š Building a Task Reminder App
This guide shows how to set up a Laravel app using MongoDB to implement a task reminder system with authentication, CRUD, and scheduled email reminders.
Prerequisites
- MongoDB Atlas cluster
- PHP + MongoDB extension
- Composer, NPM
- Basic Laravel & MongoDB knowledge
1. Start Laravel Project & Add MongoDB
composer createāproject laravel/laravel taskāreminder
cd taskāreminder
composer require mongodb/laravel-mongodb
Then in config/database.php, add:
'connections' => [
'mongodb' => [
'driver' => 'mongodb',
'dsn' => env('MONGODB_URI'),
'database' => 'YOUR_DB',
],
],
2. Authentication with Breeze
composer require laravel/breeze --dev
php artisan breeze:install
php artisan migrate
npm install && npm run dev
php artisan serve
3. Add Ping Route to Test MongoDB
Route::get('/ping', function() {
try {
DB::connection('mongodb')->command(['ping'=>1]);
return ['msg' => 'MongoDB is accessible!'];
} catch (Exception $e) {
return ['msg' => 'Not connected: '.$e->getMessage()];
}
});
4. Task Model & Controller (CRUD)
php artisan make:model Task --resource --controller
// in Task.php
use MongoDB\Laravel\Eloquent\Model;
class Task extends Model {
protected $connection='mongodb';
protected $fillable=['title','description','due_date','email','reminder_time','last_notification_date'];
}
Controller handles index, create, store, edit, update, destroy. Format dates with Carbon, link tasks to auth()->user()->email.
5. Views with Bootstrap
- Create form input: title, description, due_date, reminder_time
- Edit form similar
- Index page lists tasks, with Edit/Delete buttons
6. Send Reminder Emails
php artisan make:command SendTaskReminders
// handle() in SendTaskReminders.php
$now = Carbon::now();
$tasks = Task::whereNull('last_notification_date')
->where('reminder_time','>=',$now->subMinutes(10))
->get();
foreach($tasks as $task){
Mail::raw("Reminder: {$task->title}", function($msg) use($task){
$msg->to($task->email)
->subject("Task Reminder: {$task->title}");
});
$task->last_notification_date = $now;
$task->save();
}
7. Schedule the Command
// in console.php
Schedule::command('app:send-task-reminders')->everyMinute();
// add cron: * * * * * php /path/artisan schedule:run
Conclusion
You’ve built a full task reminder system with MongoDB storage, user auth, CRUD, and scheduled email notifications using Laravel.
Blog
Jun 17, 2025
React Labs: View Transitions & Activity Published April 23, 2025 by Ricky Hanlon. React Labs is sharing two new experimental featu...
Jan 27, 2026
Introduction React Native is one of the most widely used frameworks for cross-platform mobile application development. However, iOS build time ha...
Jul 01, 2025
š Laravel Queue & Job System We’re gonna walk you through Laravel queues from setup to deploying in production using Supervisor. Step 1...
Jul 16, 2025
š Mastering Modern CSS: The Power of if(), Popover Hints, and Smart Styling CSS is getting smarter. In this guide, we’ll explore how the new...
Jul 20, 2025
š§ 1. Laravel 12.0 – Starter Kits & Core Changes Version 12.0 introduced modern starter kits for React, Vue, Livewire, plus integratio...
Jul 06, 2025
Using Web Components the Smart Way A lot of developers assume Web Components are meant to replace full SPA frameworks like React or Vue. But in rea...