public function action_create() { $project = Config::get('project'); $deliverable = new Deliverable(Input::json(true)); $deliverable->project_id = $project->id; $deliverable->save(); $deliverable = Deliverable::find($deliverable->id); // hack to refresh from db return Response::json($deliverable->to_array()); }
public function create_deliverables_from_sow_sections() { $deliverable_names = $this->deliverables()->lists('name'); if ($project_sections = $this->project_sections()) { $i = 0; foreach ($project_sections->where_section_category("Deliverables")->get() as $section) { if (!in_array($section->title, $deliverable_names)) { Log::info($i); $deliverable = new Deliverable(); $deliverable->name = $section->title; $deliverable->sort_order = $i; $deliverable->project_id = $this->id; $deliverable->save(); } $i++; } } }