-
app/Models/Company/Task.php
Open in GitHubuse 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 GitHubuse 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; } // }