public function createOfWorkitems($projectId, $workId) { $project = \App\Entities\Project::findOrFail($projectId); $work = \App\Entities\ProjectWork::findOrFail($workId); $units = \App\Entities\Unit::all(); $costTypes = \App\Entities\CostType::all(); return view('project-workitems.create', compact('project', 'work', 'units', 'costTypes')); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $units = Unit::all(); return response()->json(compact('units')); }
private function seedUnits() { foreach ($this->units as $unit) { Unit::create(['name' => $unit]); } }