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...
Question how do we go about changing the time for the task the only thing coming up is 12a in front of every task?
If you need the time - you need to have
dateTimecolumn on your tasks and not justdate. That is indeed a limitation on the calendar integration - it sets 12am as default date if none is provided.If you add this: ->allDay(true)
to the EventData::make() you will render them without time, so it won't display 12a or 00 in front of the events.