@MarBel Why are you trying to run a controller—which is expected to run in a HTTP context—via the command line?
Oct 8, 2018
3
Level 1
Run Spark controller in terminal
I'm trying to run a controller function from tinker using this code:
php artisan tinker
$controller = app()->make('App\Http\Controllers\MyController');
app()->call([$controller, 'myMethodName'], []);
The controller is in
\spark\src\Http\Controllers\..., not App. When I try the above code on a controller in the App dir, it works, but when I try to do it with a controller in the spark dir, I get this:
ReflectionException with message 'Class spark/src/Http/Controllers/... does not exist'
(... added by me)
Please or to participate in this conversation.