/** * Run the database seeds. * * @return void */ public function run() { # First get the user id $user_id = \App\User::where('name', '=', 'Jill')->pluck('id'); # Next get the verb id $verb_id = \App\Verb::where('infinitive_it', '=', 'essere')->pluck('id'); # Next get the tense id $tense_id = \App\Tense::where('tense', '=', 'Present Indicative')->pluck('id'); DB::table('transactions')->insert(['user_id' => $user_id, 'verb_id' => $verb_id, 'tense_id' => $tense_id, 'response_1ps' => TRUE, 'response_2ps' => TRUE, 'response_3ps' => TRUE, 'response_1pp' => FALSE, 'response_2pp' => TRUE, 'response_3pp' => TRUE, 'pct_correct' => 83.3, 'created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString()]); }
/** * Responds to requests to POST /verbs/save */ public function postSave(Request $request) { //dump($request); // $verbModel = new \App\Verb(); // $verb = $verbModel::where('infinitive_it', '=', 'dare')->get(); $verb = \App\Verb::where('infinitive_it', '=', $request->infinitive_it)->first(); //dump($verb); //$verb->infinitive_it = $request->infinitive_it; $verb->infinitive_en = $request->infinitive_en; $verb->gerund_it = $request->gerund_it; $verb->past_part_it = $request->past_part_it; // //$verb->created_at = \Carbon\Carbon::now()->toDateTimeString(); // //$verb->updated_at = \Carbon\Carbon::now()->toDateTimeString(); $verb->save(); \Session::flash('flash_message', 'Changes saved successfully.'); return redirect('/verbs/display'); }