N
N
Northern Lights2019-11-25 11:57:01
Laravel
Northern Lights, 2019-11-25 11:57:01

How to make a helper for View or how to call a method there?

Hello members!
How is it architecturally correct to make it so that in the view it would be possible to call the method of the helper object (it has already been written), which returns a string (in my case, generating a set of fields of dynamic properties of an entity)?
I really don’t want to receive this string in the action and pass it to the view, I believe that this is the view’s area of ​​​​responsibility and this is where my miracle method should be called.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2019-11-25
@Nc_Soft

https://laravel.com/docs/master/views#view-composers
or just a static helper class

D
Dmitry, 2019-12-05
@dlnsk

@php
@endphp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question