public function includeTransitions(Step $step) { if ($step->transitions()->count() === 0) { return null; } $collection = $this->collection($step->transitions, new TransitionTransformer()); return $collection; }
/** * @param $command */ private function setOrder($command) { $command->order = 1; $lastStep = Step::where('flow_id', $command->flow->id)->orderBy('order', 'asc')->first(); if ($lastStep) { $command->order = $lastStep->order + 1; } }
public function destroy($id) { $this->deleteStep(Step::findOrFail($id)); return $this->responseNoContent(); }
public function store(Requests\TransitionRequest $request) { $transition = $this->createTransition(['flow' => Flow::find($request->get('flow_id')), 'from' => Step::find($request->get('from')), 'to' => Step::find($request->get('to'))]); return $this->responseWithItem($transition, new TransitionTransformer()); }