Backpack's avatar

Creating a method just like view() to import other files

Hello! I am searching for a way to create a method just like view() works, but I want that method to include files from another directory (even outside of laravel's directory).

What's the best practice to do this? I've tried to search but couldn't really find anything helpful, and unfortunately I do not have enough Laravel experience yet to figure out the best approach.

Thank you!

0 likes
4 replies
Backpack's avatar

The thing is that I don't want to import views. I want to import other non-laravel PHP scripts, outside of Laravel folder.

Backpack's avatar
Backpack
OP
Best Answer
Level 1

So, what I did was create a file called bridge.php in which I wrote all my custom functionality and then I included it in larvel's index.php file, and I can use like custom_function('page'); to include something hat is outside of laravel's folders in blade files.

Please or to participate in this conversation.