I bound a primitive value to a class.
$this->app->when('App\Http\Controllers\TestController')
->needs('$numPages')
->give(1000);
But this value is injected only to the constructor of the class, and not to other methods.
class TestController extends Controller
{
public function __construct($numPages = 0)
{
// $numPages = 1000 WORKS
}
public function index($numPages = 0)
{
// $numPages = 0 DOESNT WORK
}
}
But when I bind a normal class, its instance is injected in all methods. Is it intended behavior?