0
Guys, it’s been a while since I programmed PHP and I have the following question:
I am calling a function in my View as follows:
{{ $result_resumo = app(App\Http\Controllers\Site\SiteController::class)->NoticiasResumo($dados_noticias->post,80, FALSE, "") }}
Now I ask:
There is another way to call the function without the need to type the whole path of the Controller
?
Note: I am using Laravel Framework 5.5
Next, it does not need to be so, what does the method do? It is not good to instantiate a
controller
that way. I wonder what you want to do? put all the dots.– novic
this method formats the text so I display a formatted news summary, it removes html tags, etc etc ... I’m calling it that way.... How best to call this method in the view?
– Diego Lela
Make a helper (or function,
function
) or even a package of utilities and call the code in your controller sending toview
only the result. You can’t commitController
directly onView
.– novic
This goes kind of against the concept of MVC not? How about sending the formatted data when calling the view in the controller? So I would only have the job of printing the variable passed to Lade...(as Virgilio said)
– Darlei Fernando Zillmer