Please don't use a facade for this. Instead you should see if you can create a trait. Since you are going to be reusing the functions within a class, this makes an easy way to share similar things around the codebase.
If they don't really fit into a trait then you can make a helper class to inject around (although this can be considered a code smell) or you can just register the functions as global functions and call them from anywhere you want without issue.
Traits are meant to be additional functionality on a model, not a reusable function.
What is the difference between registering global function and a fasade? Globals will pollute global namespace, which is not a great idea.
Take a look: http://stackoverflow.com/questions/4458837/how-to-define-global-functions-in-php
The second answer (the one with 9 upvotes) is interesting.
In my opinion, for reusable code you should try separating your logic into commands.
https://laracasts.com/lessons/laravel-5-commands
Asuming you have a "HelloCommand" you can call it from any controller/ artisan command using the DispachesCommand Trait
$this->dispatch(new HelloCommand($argument1, $argument2...));
You can throw events from a command (if you need some more stuff later)
https://laracasts.com/lessons/laravel-5-events
Have fun!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community