make a global php function in laravel so that accessed anywhere

Solutions on MaxInterview for make a global php function in laravel so that accessed anywhere by the best coders in the world

showing results for - "make a global php function in laravel so that accessed anywhere"
Isabell
17 Jan 2017
1function your_function( $parameters ) {
2    //function logic
3} 
4
5function your_another_function( $parameters ) {
6    //function logic
7} 
8
9// composer.json
10"autoload": {
11    ...
12    "files": [
13        "app/Helpers/your_helper_function.php"
14    ]
15    ...
16}
17
18// Now call from any class of Laravel
19class UserController extends Controller {
20   
21  public function storeUser() {
22  	your_function();
23    
24    // do other stuffs
25  }
26
27}