public function handle(LoanWasCreated $event) { $coms = Defaultcommittee::where('loantype_id', $event->loan->loan_type_id)->get(); foreach ($coms as $com) { Committee::create(['loan_id' => $event->loan->id, 'committee_role' => $com->committeerole]); } }
public function update($id) { // save updated $record = $this->records->find($id); if (!$record) { Committee::create(Input::all()); return $this->respond($record); } $record->fill(Input::all())->save(); return $this->respond($record); }
public function run() { DB::table('committees')->delete(); Committee::create(['loan_id' => 1, 'role_id' => 999, 'user_id' => 4, 'vote_status' => 'pending', 'vote_request_date' => '2014-09-11', 'committee_role' => 'Optional']); Committee::create(['loan_id' => 1, 'role_id' => 2, 'user_id' => 5, 'vote_status' => 'voted', 'vote' => 1, 'vote_request_date' => '2014-09-11', 'vote_received_date' => '2014-09-13', 'committee_role' => 'CFO']); Committee::create(['loan_id' => 1, 'role_id' => 4, 'user_id' => 6, 'vote_status' => 'voted', 'vote' => 1, 'vote_request_date' => '2014-09-11', 'vote_received_date' => '2014-09-12', 'committee_role' => 'Branch Manager']); Committee::create(['loan_id' => 1, 'role_id' => 999, 'user_id' => 3, 'vote_status' => 'pending', 'vote_request_date' => '2014-09-11', 'committee_role' => 'Tester']); Committee::create(['loan_id' => 1, 'role_id' => 9, 'vote_status' => 'pending', 'committee_role' => 'Manager']); Committee::create(['loan_id' => 2, 'role_id' => 999, 'user_id' => 4, 'vote_status' => 'pending', 'vote_request_date' => '2014-09-11', 'committee_role' => 'Optional']); Committee::create(['loan_id' => 2, 'role_id' => 2, 'user_id' => 5, 'vote_status' => 'voted', 'vote' => 1, 'vote_request_date' => '2014-09-11', 'vote_received_date' => '2014-09-13', 'committee_role' => 'CFO']); Committee::create(['loan_id' => 2, 'role_id' => 4, 'user_id' => 6, 'vote_status' => 'voted', 'vote' => 1, 'vote_request_date' => '2014-09-11', 'vote_received_date' => '2014-09-12', 'committee_role' => 'Branch Manager']); Committee::create(['loan_id' => 2, 'role_id' => 999, 'user_id' => 3, 'vote_status' => 'pending', 'vote_request_date' => '2014-09-11', 'committee_role' => 'Tester']); }
public function postCommittee(Request $request) { $committee = $request->all(); $committee['weight'] = 0; Committee::create($committee); return redirect('/admin'); }
public function run() { Committee::create(['id' => '1', 'name' => 'Finance Committee', 'weight' => '0', 'event_id' => '1']); Committee::create(['id' => '2', 'name' => 'Programs Committee', 'weight' => '0', 'event_id' => '1']); Committee::create(['id' => '3', 'name' => 'Technical Committee', 'weight' => '0', 'event_id' => '1']); Committee::create(['id' => '4', 'name' => 'Visuals Committee', 'weight' => '0', 'event_id' => '1']); Committee::create(['id' => '5', 'name' => 'Promotions Committee', 'weight' => '0', 'event_id' => '1']); Committee::create(['id' => '6', 'name' => 'Secretariat Committee', 'weight' => '0', 'event_id' => '1']); Committee::create(['id' => '7', 'name' => 'Finance Committee', 'weight' => '0', 'event_id' => '2']); Committee::create(['id' => '8', 'name' => 'Programs Committee', 'weight' => '0', 'event_id' => '2']); Committee::create(['id' => '9', 'name' => 'Technical Committee', 'weight' => '0', 'event_id' => '2']); Committee::create(['id' => '10', 'name' => 'Visuals Committee', 'weight' => '0', 'event_id' => '2']); Committee::create(['id' => '11', 'name' => 'Promotions Committee', 'weight' => '0', 'event_id' => '2']); Committee::create(['id' => '12', 'name' => 'Secretariat Committee', 'weight' => '0', 'event_id' => '2']); $this->call('HeadTableSeeder'); }