public function getInterestData() { if (!Auth::user()->hasRole('exec')) { //TODO middleware perhaps? return; } return InterestSignup::all(); }
public function interestSignup(Request $request) { $email = $request->input("email"); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { return ['status' => 'fail', 'message' => 'email is not valid!']; } $signup = InterestSignup::firstOrCreate(['email' => $email]); if ($signup->wasRecentlyCreated) { return ['status' => 'ok', 'message' => 'all signed up!']; } return ['status' => 'ok', 'message' => 'you were already signed up!']; }