If I am creating a custom facade and want to have certain variables initialized at every instance of using customFacade::doSomething()
, is that possible? My main purpose for doing this is to be able to store variables that are other objects and call functions on them directly. Example being customFacade::client->send()
where in this case client
is the initialized variable of an object with a send()
function. I am aware I can have a function client()
instead and return the a new instance of the object so the send()
goes through, but I'd still like to know if its possible the other way.
In a normal class I can do below, but it doesn't work on facades.
$protected client;
public function __construct()
{
$this->client = new instanceOfObject();
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32ZZqu8
via IFTTT
Aucun commentaire:
Enregistrer un commentaire