Enhancing GitHub Service with Carbon and Notifications
Introduction
Our team has been working on improving the GitHub service in our application. One of the key areas of focus was enhancing the date handling and introducing a notifications system.
The Challenge
The existing GitHub service had limitations in terms of date management and lacked a notifications system. This made it difficult to keep track of recent activities and notify users about important events.
The Solution
To address these challenges, we updated the GitHub service to use Carbon for date handling. This change improved the clarity and functionality of the getLastRelevantPullRequest method.
$events = $this->getUserActivity($user, Carbon::now()->subDays(7));
Additionally, we introduced a new notifications system by creating a notifications table with necessary fields. This included the notification type, notifiable entity, data, and timestamps.
Schema::connection('pgsql')->create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->uuidMorphs('notifiable');
$table->json('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
Key Decisions
- Using Carbon for date handling - Provides a more elegant and efficient way of working with dates.
- Introducing a notifications system - Enables the application to notify users about important events and improves the overall user experience.
Results
The updates to the GitHub service have improved the date management and introduced a notifications system. This enhancement will enable the application to better serve its users and provide a more engaging experience.
Lessons Learned
The migration taught us the importance of using established libraries like Carbon for date handling and the value of introducing a notifications system to improve user engagement.
Generated with devlog.ist
Generated with Devlog.ist