/** * Save a new time entry to the database * * @param Request $request The incoming request. * * @return Response */ public function store(TimeRequest $request) { $time = new Time(); $time->project_id = (int) $request->project_id; $time->estimatedDuration = (int) $request->estimatedDuration; $time->start = $request->start; $time->minutes = $request->minutes; $time->summary = $request->summary; $time->user()->associate($request->user()); $time->save(); $userMessage = $this->successMessage('time entry'); return redirect()->route('time.index', [$time->id])->with('userMessage', $userMessage); }