function generateWorkTickets($pID) { $ticks = ProjectPart::where('in_project', 1)->where('project_id', $pID)->get(); foreach ($ticks as $tick) { Workticket::create(['project_id' => $pID, 'part_id' => $tick->part_listing_id, 'scopestatus_id' => 1]); } // end foreach return $pID; }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Workticket::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }