/** * Store a newly created resource in storage. * * @return Response */ public function store(CardRequest $request) { $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); $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; $input['added_by'] = Auth::user()->id; $card = Card::create($input); $timeline['object_type'] = 2; $timeline['object_id'] = $card->id; $timeline['action'] = 'create'; $timeline['description'] = '<a href="javascript:;">' . $input['name'] . '</a> card has been created by ' . Auth::user()->first_name . ' ' . Auth::user()->last_name . '.'; Timeline::create($timeline); Session::flash('success', Lang::get('ruban.card.created')); return Redirect::route('ruban.cards.index'); }
/** * Get an existing card. * * @return \OpenpayCard */ public function card($cardId) { $card = $this->core->cards->get($cardId); $database = config('openpay.database', false); if ($database) { if (Card::whereRaw("openpay_id = '{$card->id}'")->count() == 0) { Card::create(array("customer_id" => $card->customer_id, "openpay_id" => $card->id, "type" => $card->type, "brand" => $card->brand, "holder_name" => $card->holder_name, "card_number" => $card->card_number, "expiration_month" => $card->expiration_month, "expiration_year" => $card->expiration_year, "bank_name" => $card->bank_name, "bank_code" => $card->bank_code, "expiration_year" => $card->expiration_year)); } } return $card; }