public function works($checklistId) { $checklist = \App\Entities\Checklist::findOrFail($checklistId); return view('checklists.works')->withChecklist($checklist); }
public function checklist($workflowId, Request $request) { $workflow = app(\App\Entities\Workflow::class)->findOrFail($workflowId); // $checklist = app(\App\Entities\Checklist::class)->whereWorkflowId($workflow->id)->get(); //return view('workflows.checklists')->withWorkflow($workflow)->withChecklist($checklist); if (!$workflow->checklist) { $checklist = Checklist::create(['workflow_id' => $workflow->id, 'name' => $workflow->name]); } else { $checklist = $workflow->checklist; } return view('workflows.checklists', compact('workflow', 'checklist')); //if (!$workflow->checklist) { // return redirect()->route('checklists.create', ['workflow_id' => $workflow->id]); //} //return redirect()->route('checklists.show', $workflow->checklist->id); }