A
A
ARX22018-09-17 19:58:44
Laravel
ARX2, 2018-09-17 19:58:44

How to call a method in a template in Laravel?

Good evening! Tell me how to call this method in the blade template in Laravel?
5b9fdd3c5f947882818572.png

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Victor, 2018-09-17
@ARX2

This is a class, not a method. Also write use.
@php
use ...
@endphp

A
Anton, 2018-09-17
@Yadalay

As an option, add to config/app.php in alises.

A
ARX2, 2018-09-17
@ARX2

There is already an alias.
It is impossible to call a class by alias in the template, unless you specify the full path in the vendor. Otherwise, an error occurs as I threw off the screen in the comment above

D
Dmitry, 2019-11-23
@DimaLondon

Add your ImageResize class to the list of aliases in config\app.php

'aliases' => [
    .....
    'ImageResize' => YouFolder\ImageResize::class
]

Then flush the config cache:
php artisan config:clear
php artisan config:cache

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question