Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

officelifehq/officelife

942 stars
2 code files
View officelifehq/officelife on GitHub

app/Models/Company/Task.php

Open in GitHub
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;
 
class Task extends Model
{
//
public function scopeInProgress($query): Builder
{
return $query->where('completed', false);
}
}

app/Http/ViewHelpers/Dashboard/DashboardMeViewHelper.php

Open in GitHub
use App\Models\Company\Employee;
use Illuminate\Support\Collection;
 
class DashboardMeViewHelper
{
//
public static function tasks(Employee $employee): ?Collection
{
$tasks = $employee->tasks()->inProgress()->get();
 
$tasksCollection = collect([]);
foreach ($tasks as $task) {
$tasksCollection->push([
'id' => $task->id,
'title' => $task->title,
]);
}
 
return $tasksCollection;
}
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.