Add Session Controller and UserRegisterController to manage login and register

This commit is contained in:
Thuan Bui
2025-03-06 21:46:32 +09:00
parent 1e94cdbc20
commit a88316ead8
5 changed files with 98 additions and 48 deletions
+14 -2
View File
@@ -10,9 +10,21 @@ class Task extends Model
{
use HasFactory;
protected $attributes = [
protected static function boot()
{
parent::boot();
static::creating(function ($task) {
if (is_null($task->completed)) {
$task->completed = false; // Ensure completed is false when creating a new task
}
$task->user_id = Auth::id(); // Set user_id automatically
});
}
/* protected $attributes = [
'completed' => false, // Set default value for completed
];
]; */
public function user() {