Example of Collection Methods: Push in officelifehq/officelife

File app/Http/ViewHelpers/Company/Project/ProjectViewHelper.php (link to Github)
use App\Models\Company\Company;

class ProjectViewHelper
{
    //
    public static function index(Company $company): array
    {
        $projects = $company->projects()->orderBy('id', 'desc')->get();

        $projectsCollection = collect([]);
        foreach ($projects as $project) {
            $projectsCollection->push([
                'id' => $project->id,
                'name' => $project->name,
                'code' => $project->code,
                'summary' => $project->summary,
                'status' => $project->status,
                'url' => route('projects.show', [
                    'company' => $company,
                    'project' => $project,
                ]),
            ]);
        }

        return [
            'projects' => $projectsCollection,
        ];
    }
    //
}