TheDragonCode/sitemap

Improve the data transfer a `images()` method

andrey-helldar opened this issue · 0 comments

Now the method accepts only ready-made data set:

->images($data1, $data2, $data3)

This is inconvenient because if the table contains, for example, 200'000 records, the validator will return an error, since the maximum number of records is 500.
It is necessary to check the elements for a type: if it is an array, then iterate over it, and if it is instance of Helldar\Sitemap\Services\Make\Images, then work with it as with an element for output.

For example:

$data1 = app('sitemap')->makeImages()->image('http://example.com/images/1.jpg');
$data2 = app('sitemap')->makeImages()->image('http://example.com/images/2.jpg');
$data3 = [
    app('sitemap')->makeImages()->image('http://example.com/images/3.jpg'),
    app('sitemap')->makeImages()->image('http://example.com/images/4.jpg'),
    app('sitemap')->makeImages()->image('http://example.com/images/5.jpg'),
];

app('sitemap')
    ->images($data1, $data2, $data3)
   ->save();