public function store(TodoRequest $request)
 {
     $todo = new Todo($request->all());
     Auth::user()->todos()->save($todo);
     \Session::flash('flash_message', 'Todo toegevoegd!');
     return redirect('todos');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(TodoRequest $request, $id)
 {
     $todo = Todo::find($id);
     $todo->fill($request->all());
     $todo->save();
     return redirect()->route('admin.todos.index')->with('message', 'Se ha editado ' . $todo->name . ' de forma correcta.');
 }
예제 #3
0
 public function update(TodoRequest $request, Todo $todo)
 {
     $data = $request->all();
     $todo->fill($data)->save();
     $activity = 'To do updated';
     Activity::log($activity);
     return redirect('/dashboard')->withSuccess(config('constants.UPDATED'));
 }
예제 #4
0
 /**
  * Update the specified resource in storage.
  *
  * @param \App\Http\Requests\TodoRequest $request
  * @param int                            $id
  * @return \Appkr\Fractal\Response
  */
 public function update(TodoRequest $request, $id)
 {
     if (!$this->model->whereId($id)->whereUserId($request->user()->id)->exists()) {
         return $this->respond->unauthorizedError();
     }
     $todo = $this->model->findOrFail($id);
     if (!$todo->update($request->all())) {
         return $this->respond->internalError();
     }
     return $this->respond->Success(strip_tags(trans('messages.updated')));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(TodoRequest $request, $id)
 {
     $item = Todo::find($id);
     $item->update($request->all());
     return $item;
 }
예제 #6
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TodoRequest $request)
 {
     //Storing the data
     TodoModel::create($request->all());
     return Redirect::To('admin/todo');
 }
예제 #7
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(TodoRequest $request, $id)
 {
     Todo::where('id', $id)->update(['name' => $request->input('name'), 'description' => $request->input('description'), 'completed' => $request->input('completed')]);
     return redirect()->route('index');
 }