/**
  * Update the specified card in storage.
  *
  * @param  Card  $card
  * @return Response
  */
 public function update(Card $card, CardRequest $request)
 {
     $card->id = $request->get('id');
     $card->user()->associate($request->get('user_id'));
     $card->save();
     return redirect()->route('admin.cards.index');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(CardRequest $request, $id)
 {
     $card = Card::find($id);
     if ($card) {
         $input = $request->except($this->image);
         $input['start_date'] = Carbon\Carbon::parse($request->get('start_date'))->format('Y-m-d');
         $input['end_date'] = Carbon\Carbon::parse($request->get('end_date'))->format('Y-m-d');
         $input[$this->image] = Card::upload_cardfile($request, $this->image, $card->image);
         $input['updated_by'] = Auth::user()->id;
         $project = Project::find($request->get('project_id'));
         $input['state_id'] = $project->state_id;
         $input['district_id'] = $project->district_id;
         $input['taluk_id'] = $project->taluk_id;
         $card->fill($input);
         $card->save();
         Session::flash('success', Lang::get('ruban.card.updated'));
         $timeline['object_type'] = 2;
         $timeline['object_id'] = $id;
         $timeline['action'] = 'update';
         $timeline['description'] = '<a href="javascript:;">' . $input['name'] . '</a> card has been updated by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.';
         Timeline::create($timeline);
         return Redirect::route('ruban.cards.index');
     } else {
         Session::flash('danger', Lang::get('ruban.card.notfound'));
         return Redirect::route('ruban.cards.index');
     }
 }