Suppose I have the following class:
class MyClass {
private $someVar;
public function __construct($someParameter) {
$this->someVar = $someParameter;
}
public function display(){
return "This is the variable value " . $this->someVar;
}
}
How am I suppose to bind this class to the container as I need to pass the variable to the constructor as well?
Normally, I would get an instance of the class and pass the variable. Like;
$param = 'this is my variable.';
$obj = new MyClass($param);
echo $obj->display();
I need to do this through the service provider.