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() { $costTypes = CostType::all(); return response()->json(['cost_types' => $costTypes]); }
public function seedCostTypes() { foreach ($this->costTypes as $costType) { CostType::create(['name' => $costType]); } }