Courses

Creating CRM with Filament 3: Step-By-Step

Customer Tasks and Calendar View

You're reading a FREE PREVIEW of a PREMIUM course.
Summary of this lesson:
- Creating task model with customer relationships
- Implementing task creation from customer list
- Adding task calendar using FullCalendar plugin
- Building task management interface with status tracking

Now that we have Employees - they usually have to perform specific Tasks with our Customers. For example, they might need to make a phone call to them or send over some documents. For that, we can build a Task system with a calendar view like this:

In this lesson, we will do the following:

  • Create Task Model and Database
  • Add the Create Task button to the Customer list
  • Add Task list to the Customer page (view page)
  • Add Task Resource with Tabs
  • Add a Calendar page for Tasks

Create Task Model and Database

Let's start with our Models and Database structure:

Migration

use App\Models\Customer;
use App\Models\User;
 
// ...
 
Schema::create('tasks', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(Customer::class)->constrained();
$table->foreignIdFor(User::class)->nullable()->constrained();
$table->text('description');
$table->date('due_date')->nullable();
$table->boolean('is_completed')->default(false);
$table->timestamps();
});

Then, we can fill our Model:

app/Models/Task.php

use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
class Task extends Model
{
protected $fillable = [
'customer_id',
'user_id',
'description',
'due_date',
'is_completed',
];
 
protected $casts = [
'due_date' => 'date',
'is_completed' => 'boolean',
];
 
public function customer(): BelongsTo
{
return $this->belongsTo(Customer::class);
}
 
public function employee(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
}

That's it. We have our base structure for the Task Model and Database.


Add Create Task Button to the Customer list

Next, we want to add a button to...

The full lesson is only for Premium Members.
Want to access all 17 text lessons of this course? (97 min read)

You also get:

  • 77 courses
  • Premium tutorials
  • Access to repositories
  • Private Discord