. */ namespace Poniverse\Ponyfm\Http\Controllers; use App; use DB; use Poniverse\Ponyfm\Models\Email; use Poniverse\Ponyfm\Models\EmailSubscription; // TODO: #25 - finish these endpoints and secure them properly class NotificationsController extends Controller { public function getEmailClick($emailKey) { App::abort(403, "This isn't implemented yet!"); $emailKey = decrypt($emailKey); /** @var Email $email */ $email = Email::findOrFail($emailKey); DB::transaction(function() use ($email) { $email->emailClicks()->create(['ip_address' => \Request::ip()]); $email->notification->is_read = true; $email->notification->save(); }); return redirect($email->getActivity()->url); } public function getEmailUnsubscribe($subscriptionKey) { App::abort(403, "This isn't implemented yet!"); $subscriptionId = decrypt($subscriptionKey); $subscription = EmailSubscription::findOrFail($subscriptionId); return var_export($subscription); } }