Monday, March 6, 2017

Laravel. Check update one package model within another package

I am newbie in Laravel. Now I'm trying to understand, how can one package model reacting for updating model from another package.

We have package with some controller:

/vendor/package1/src/Http/Controllers/RequestController:

...
// some trigger
$trigger = RequestModel::find($idRequest);
$trigger->update($someData)

// here must be some actions from another packages:
// action from package2
$action1 = new \vendor\package2\src\Models\SomeModel();
$action1->makeAction($trigger->id);

// action from package3:
$action2 = new \vendor\package3\src\Models\SomeModel();
$action2->makeAction($trigger->id);
...

What tools I should to use in this case, or maybe some special archtecture or strategy? How to attach new actions from another packages in future?



via SlowSuperman

Advertisement