N
N
Northern Lights2019-11-14 17:54:36
Laravel
Northern Lights, 2019-11-14 17:54:36

What is the most beautiful solution for displaying different text in one template with different actions?

Hello members!
One template handles lists:

/**
     * Активные документы.
     */
    public function getActiveList()
    {
        return view('backend.docflow.document.list')
            ->with('documents', $this->documentRepository->getActivePaginated(5, 'id', 'desc'));
    }

    /**
     * Заблокированные документы.
     */
    public function getInactiveList()
    {
        return view('backend.docflow.document.list')
            ->with('documents', $this->documentRepository->getInactivePaginated(5, 'id', 'desc'));
    }

    /**
     * Заблокированные документы.
     */
    public function getDeletedList()
    {
        return view('backend.docflow.document.list')
            ->with('documents', $this->documentRepository->getDeletedPaginated(5, 'id', 'desc'));
    }

Entities can be blocked, deleted, active.
Accordingly, it is necessary to display something like "List of active documents" in the title.
I don't think it makes sense to use different templates.
Who can faced a similar task? I really don’t want to write something like checking current actions in the template,
{{ dd(Route::getCurrentRoute()->getActionMethod())  }}

that, depending on the conditions, load certain elements from the internationalization files.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question