public function index() { $requests = $this->subscriptionRepository->getAll(['user,event']); dd($requests); $requests = $this->status->with(array('user', 'event'))->latest()->get(); return View::make('admin.requests.index', compact('requests')); }
/** * @param $eventId * Confirm the Subscription after click email link * @return \Illuminate\Http\RedirectResponse */ public function confirmSubscription($eventId) { $subscription = $this->subscriptionRepository->findByEvent(Auth::user()->id, $eventId); if ($subscription) { return $this->subscribe($eventId, $subscription->registration_type); } return Redirect::action('EventsController@index')->with('error', trans('general.error')); }
/** * @param $id * @return \Illuminate\Http\RedirectResponse * Unsubscribe Before Deleting */ public function destroy($id) { $subscription = $this->subscriptionRepository->findById($id); // unsubscribe $subscriber = $this->unsubscribe($subscription, $subscription->status, $feedback = ''); if ($subscriber->messages->has('errors')) { return Redirect::back()->with('errors', [$subscriber->messages->first()]); } $subscription->delete(); return Redirect::action('AdminSubscriptionsController@index')->with('success', 'success'); }
public function postPayment() { $payableId = Input::get('event_id'); $token = Input::get('token'); // payment token $paymentRepo = $this->paymentRepository->findByToken($token); $paymentRepo->method = 'paypal'; $event = $this->eventRepository->findById($payableId); $country = $this->processCountry($event); $user = Auth::user(); $subscription = $this->subscriptionRepository->findByEvent($user->id, $event->id); $eventPrice = $event->getPriceByCountryAndType($country->id, $subscription->registration_type)->first(); $convertedPrice = $this->converter->convert($this->defaultCurrency, $eventPrice->price); if ($convertedPrice <= 0) { return Redirect::back('/')->with('error', trans('word.system_error')); } $paymentRepo->amount = $convertedPrice; $paymentRepo->currency = $this->defaultCurrency; $description = 'Total: ' . $convertedPrice . ' ' . $this->defaultCurrency . '. '; $description .= Str::limit(strip_tags($event->description), 50, '..'); $baseUrl = App::make('url')->action('PaymentsController@getFinal') . '?t=' . $token; $item = ['title' => $event->title, 'amount' => $paymentRepo->amount, 'description' => $event->description]; try { // Instantiate Paypal Class $payer = $this->paypal; // Make Payment $payment = $payer->makePayment($paymentRepo->amount, 'USD', $description, "{$baseUrl}&success=true", "{$baseUrl}&success=false", $item); $paymentRepo->status = 'CREATED'; $paymentRepo->transaction_id = $payment->getId(); $paymentRepo->save(); // Redirect With Payment Params header("Location: " . $this->getLink($payment->getLinks(), 'approval_url')); exit; } catch (Exception $e) { // Set Status To Error $paymentRepo->status = 'ERROR'; $paymentRepo->save(); return Redirect::back()->with('info', trans('word.system_error')); } }