<?php

namespace App\Http\Controllers\News;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;;    
use App\Models\ArticleModel;

class GalleryController extends Controller
{
    private $pathViewController = 'news.pages.gallery.';  // slider
    private $controllerName     = 'gallery';
    private $params             = [];
    private $model;

    public function __construct()
    {
        view()->share('controllerName', $this->controllerName);
    }

    public function index(Request $request)
    {   
        $articleModel  = new ArticleModel();
        $galleryPath  = config('zvn.url.gallery');
        $path = public_path($galleryPath);

        $itemsLatest   = $articleModel->listItems(null, ['task'  => 'news-list-items-latest']);
        $images = \File::files($path);

        return view($this->pathViewController .  'index', [
            'images'   => $images,
            'itemsLatest'   => $itemsLatest,
        ]);
    }
 
}