I want to be able to call a method inside a controller in the following manner:
App::call('SomeController@method');
I figured it happens like this when defining a route:
Route::get('/route', 'SomeController@method');
So maybe there's an underlying mechanism I can use more generally in my code on other places in the project, turns out there is (App::call()).
The problem I'm running into is that this generates an error:
ReflectionException (-1)
Class SomeController does not exist
## \vendor\laravel\framework\src\Illuminate\Container\Container.php
public function build($concrete)
{
// If the concrete type is actually a Closure, we will just execute it and
// hand back the results of the functions, which allows functions to be
// used as resolvers for more fine-tuned resolution of these objects.
if ($concrete instanceof Closure) {
return $concrete($this, $this->getLastParameterOverride());
}
$reflector = new ReflectionClass($concrete);
// If the type is not instantiable, the developer is attempting to resolve
// an abstract type such as an Interface of Abstract Class and there is
// no binding registered for the abstractions so we need to bail out.
if (! $reflector->isInstantiable()) {
return $this->notInstantiable($concrete);
}
$this->buildStack[] = $concrete;
$constructor = $reflector->getConstructor();
I'm pretty sure I must include some stuff somewhere but since Laravel is pretty big I'm asking this community.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DWv0t0
via IFTTT
Aucun commentaire:
Enregistrer un commentaire