<?php

declare(strict_types=1);

namespace App\Http\Controllers\Backend\Pouzivatelia;

use App\Http\Controllers\Controller;
use App\Models\Pouzivatel\Pouzivatel;
use Spatie\Activitylog\Models\Activity;

/**
 * Class AkciePouzivatelovController
 *
 * @package App\Http\Controllers\Backend\Pouzivatelia
 */
final class AkciePouzivatelovController extends Controller
{
    /**
     * @param int $pouzivatelId
     *
     * @return mixed
     */
    public function index(int $pouzivatelId)
    {
        $pouzivatel = Pouzivatel::query()->with('pracovisko')->findOrFail($pouzivatelId);
        $akcie = Activity::query()->where('causer_id', $pouzivatel->id)->orderByDesc('created_at')->paginate();

        return view('pages.sprava.pouzivatelia.akcie.index')
            ->withPouzivatel($pouzivatel)
            ->withAkcie($akcie);
    }
}
