I've created a custom new file, app/Http/Helpers.php and added:
<?php
namespace app\Http;
class ConnectionsHelper {
public static function organisation($id) {
return 'ID:'.$id;
}
}
In Composer.json, in the autoload-block I've added:
"files": [
"app/Http/Helpers.php"
]
And then I ran "composer dump-autoload".
My controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
use Auth;
use App\Http\Requests;
use App\Http\Controllers\Controller;
class myController extends Controller
{
public function index()
{
echo ConnectionsHelper::organisation(2);
}
}
And get in return:
FatalErrorException in OrganisationsController.php:
Class 'App\Http\Controllers\ConnectionsHelper' not found