@jerad
To call a class method inside a Laravel view, you can use the @php
blade directive. Here's an example of how you can do it:
1 2 3 4 5 6 |
@php // Assuming your class is named "SomeClass" and the method you want to call is named "someMethod" $result = AppSomeClass::someMethod(); @endphp {{ $result }} |
Remember to autoload the class file by adding the appropriate use
statement at the top of the blade view file if it is not already autoloaded.