Muhammad Asfund Muhammad Asfund - 2 months ago 31x
PHP Question

How to call/use Controller method in its View using Laravel 5.0?

I need to use my controller function in its own view.

I have tried Facade but failed.


You want to use a function defined in a Controller in one of the views it is calling?

If that's your question you can do following, (I am assuming the function is public static function returning some string). In your blade view file you can just call the function using the full name space path.


(There are ways in blade to import a class using use statement)

It is not recommended to call functions defined in controller like this (its against MVC), you can define them in the Model or create a separate Helper class.