Example of Local scopes in officelifehq/officelife

File app/Models/Company/Task.php (link to 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);
    }
}
File app/Http/ViewHelpers/Dashboard/DashboardMeViewHelper.php (link to 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;
    }
    //
}

Additional resources on local scopes: