Динамические фильтры: логика контроллера или обязанность компонентов?Php

Кемеровские программисты php общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Динамические фильтры: логика контроллера или обязанность компонентов?

Сообщение Anonymous »

I'm evaluating an architectural decision in my Laravel 12 project.
I have a page that displays filters configurable on three levels:
  • from config file: full list of available filters
  • from DB per company: each company decides which filters to use and in what order
  • from DB per user: each user enables/disables/moves filters via the UI
    The ModuleConfigService generates the final $filters array.
Solution 1 (Controller): The controller uses the service to get $filters and $options, and passes them to the view:
Solution 2 (Component): The controller only passes $options. Компонент получает модуль из маршрута и использует службу для извлечения фильтров $. Concerns: risk of making the component too coupled and harder to test.
In reality, the same logic is repeated for other arrays (fields, tabs, etc.), so I’d like to avoid duplication in controllers.
How do you handle this kind of situation? Вы предпочитаете передавать все от контроллера или делегировать в компонент?
Спасибо!

Подробнее здесь: https://stackoverflow.com/questions/796 ... onsibility
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Php»