/** * @covers \App\Services\Factories\ProjectTypeFactory::modify() */ public function testModify() { $projectType = new ProjectType(array('name' => 'Foo')); $projectType->save(); $input = array('name' => 'Bar'); $this->projectTypeFactory->modify($projectType, $input); $projectTypeRepository = App::make('\\App\\Repositories\\Eloquent\\EloquentProjectTypeRepository'); $this->assertEquals(1, $projectTypeRepository->all()->count()); $this->assertEquals('Bar', $projectTypeRepository->all()->first()->name); }
public function actionIndex() { $dataProviderMedia = new ActiveDataProvider(['query' => MediaType::find()]); $dataProviderProject = new ActiveDataProvider(['query' => ProjectType::find()]); $dataProviderSection = new ActiveDataProvider(['query' => SectionType::find()]); return $this->render('index', ['dataProviderMedia' => $dataProviderMedia, 'dataProviderProject' => $dataProviderProject, 'dataProviderSection' => $dataProviderSection]); }
public function create() { $user = Auth::user(); $disassemblers = Disassembler::lists('name', 'id'); $types = ProjectType::lists('type', 'id'); return view('projects.create', compact('disassemblers', 'types', 'user')); }
public function run() { DB::table('project_types')->delete(); $collection = [['type' => 'aircraft'], ['type' => 'engine']]; foreach ($collection as $record) { ProjectType::create($record); } }
public function run() { DB::table('project_types')->delete(); $collection = [['type' => 'Aircraft'], ['type' => 'Auxiliary Power Unit (APU)'], ['type' => 'Engine'], ['type' => 'Landing Gear'], ['type' => 'Thrust Reverser']]; foreach ($collection as $record) { ProjectType::create($record); } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { ProjectType::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
public function getProjectType() { return $this->hasMany(ProjectType::className(), ['projectType_id' => 'type_id']); }
public function profile($id = null) { $adc = ConsortiumGlobal::where('id', '1')->first(); $atas = Ata::where('active', 1)->get(); $disassemblers = Disassembler::lists('name', 'id'); $user = Auth::user(); $types = ProjectType::lists('type', 'id'); $company = Company::where('id', $user->company_id)->first(); if ($id) { $project = Project::find($id); } else { $project = Project::create(['creator_id' => $user->id, 'company_id' => $user->company_id, 'directory_path' => $company->company . '/' . date('Y') . '/']); } return view('projects.profile', compact('adc', 'atas', 'company', 'disassemblers', 'project', 'types', 'user')); }
/** * Finds the ProjectType model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ProjectType the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ProjectType::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }