Skip to content
Discussion options

You must be logged in to vote

Was able to achieve this by overriding proivder

// AppServiceProvider

public function register(): void
    {
        $this->app->bind('telegraph', fn () => new CustomTelegraph);
    }
// CustomTelegraph

<?php

declare(strict_types=1);

namespace App\Services\Telegram;

use DefStudio\Telegraph\DTO\Attachment;
use DefStudio\Telegraph\Telegraph;

class CustomTelegraph extends Telegraph
{
    public function withFile(string $key, string $path)
    {
        $telegraph = clone $this;

        $this->files->put($key, new Attachment($path));

        return $telegraph;
    }
}
// handler

$max = 10;
        $photos = $galleryPhotos->when($galleryPhotos->count() > $max, function ($collection) use

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by fabio-ivona
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant