T
T
Troodi Larson2018-05-06 23:57:55
Laravel
Troodi Larson, 2018-05-06 23:57:55

Laravel facades, is this the right way to do it?

The question of such a plan. After reading the documentation, I realized that facades are, roughly speaking, classes that are registered in the system. And now the task, I have a class for working with mail (sending), and data is taken from the database for it (now all this is extremely wrongly done through the controller using a trait, it was done this way at the stage of initial study), the question is how to do it it is better? In general, the facade is suitable for these purposes, or the container service is enough (to be honest, I didn’t really understand the difference, except for static calls).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2018-05-07
@troodi

You read the documentation very badly (however, as usual). Facades in Laravel are just wrappers (and only sometimes they have some functions of their own) for elements in a container. This is written in the first sentence of the facades section of the documentation:

Facades provide a "static" interface to classes that are available in the application's service container.
Which word caused the problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question