public function MarkComplete(Action $action) { $action->status = "Completed"; $action->save(); foreach ($action->tasks as $task) { if ($task->status != "Completed") { $task->status = "Completed"; $task->save(); } } return back(); }
public function actions($entity, $action, $entity_id, $user_id, $data = null) { $item = new Action(); $item->action = $action; $item->user_id = $user_id; $item->entity = $entity; $item->type = 'info'; $item->data = $data; $item->save(); }
/** * Update the specified resource in storage. * * @param int $id * * @return Response */ public function update(Request $request, Group $group, Action $action) { $action->name = $request->input('name'); $action->body = $request->input('body'); $action->start = Carbon::createFromFormat('Y-m-d H:i', $request->input('start')); $action->stop = Carbon::createFromFormat('Y-m-d H:i', $request->input('stop')); if ($action->location != $request->input('location')) { // we need to update user address and geocode it $action->location = $request->input('location'); if (!$action->geocode()) { flash()->error(trans('messages.address_cannot_be_geocoded')); } else { flash()->info(trans('messages.ressource_geocoded_successfully')); } } //$action->user()->associate($request->user()); // we use revisionable to manage who changed what, so we keep the original author if ($action->isInvalid()) { // Oops. return redirect()->action('ActionController@create', $group_id)->withErrors($action->getErrors())->withInput(); } $action->save(); return redirect()->action('ActionController@show', [$action->group->id, $action->id]); }