I want to create my own class and use it inside my controller, but i don't know exactly how. I did the following:
I created a php file which contains my class in a sub-folder inside the App folder. the php file (class) is called JunkFunction and the sub-folder is called myClasses.
-
In my controller i insert this line of code on the top :
use App\myClasses\JunkFunction;
-
I create an object of the class as the following:
$function = new JunkFunction;
But this exception is thrown :
Class 'App\myClasses\JunkFunction' not found in D:\graduation project\kh\app\Http\Controllers\UploadsController.php