示例#1
0
 public function getInterestData()
 {
     if (!Auth::user()->hasRole('exec')) {
         //TODO middleware perhaps?
         return;
     }
     return InterestSignup::all();
 }
示例#2
0
 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!'];
 }