| 1 | <?php |
||
| 8 | trait Queueable |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var Buildable[] |
||
| 12 | */ |
||
| 13 | protected $queued = []; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @param Buildable $buildable |
||
| 17 | */ |
||
| 18 | 70 | public function queue(Buildable $buildable) |
|
| 22 | |||
| 23 | /** |
||
| 24 | * @param Buildable $buildable |
||
| 25 | * @param callable|null $callback |
||
| 26 | */ |
||
| 27 | 46 | public function callbackAndQueue(Buildable $buildable, callable $callback = null) |
|
| 28 | { |
||
| 29 | 46 | if (is_callable($callback)) { |
|
| 30 | 21 | $callback($buildable); |
|
| 31 | 21 | } |
|
| 32 | |||
| 33 | 46 | $this->queue($buildable); |
|
| 34 | 46 | } |
|
| 35 | |||
| 36 | /** |
||
| 37 | * Execute the build process for all queued buildables |
||
| 38 | */ |
||
| 39 | 98 | public function build() |
|
| 56 | |||
| 57 | /** |
||
| 58 | * @return \LaravelDoctrine\Fluent\Buildable[] |
||
| 59 | */ |
||
| 60 | 132 | public function getQueued() |
|
| 64 | } |
||
| 65 |