app\models\Tasks::getDaysUntilDeadlineAttribute PHP Method

getDaysUntilDeadlineAttribute() public method

create a virtual attribute to return the days until deadline
    public function getDaysUntilDeadlineAttribute()
    {
        return Carbon\Carbon::now()->startOfDay()->diffInDays($this->deadline, false);
        // if you are past your deadline, the value returned will be negative.
    }