How to use own function in template Laravel?

In catalog.blade.php use date formatting using its own functions in the mining(). If the function is prescribed in the code template, then everything works as it should, but if it is put in a separate file (functions folder / file time.blade.php) and connect using @include('functions.time'), Laravel does not see it. Maybe I'm not doing something? How to make all the functions that I will need the templates in a separate file and not clutter up the templates?
July 9th 19 at 10:28
1 answer
July 9th 19 at 10:30
Solution
Templates are not functions. All functions helpers need to make a separate file and to connect in the composer.json:
{
 "autoload": {
 "files": [
"helpers/functions.php",
]
}
}
Where is the directory to place? Created helpers in the root and put functions.php - does not work... - audreanne commented on July 9th 19 at 10:33
In the composer.json prescribed? composer dump-autoload is not forgotten? - Amani_Greenho commented on July 9th 19 at 10:36
and in the composer prescribed, and artisan cache cleaned, and dump-autoload did... nothing - audreanne commented on July 9th 19 at 10:39
Understood, were specified variable in the file, fixed now works. Thank you! - audreanne commented on July 9th 19 at 10:42

Find more questions by tags PHPLaravel