Beispiel #1
0
 public function match()
 {
     // step 0 get a random user
     if (User::where('id', 1)->first()) {
         echo 'f*****g defined';
     } else {
         echo 'f*****g not defined';
     }
     while (DateApplication::where('matched', false)->first()) {
     }
 }
Beispiel #2
0
 /**
  * post apply form
  *
  * @param Request $request
  * @return Response
  */
 public function postApplyForDate(Request $request)
 {
     // validate input
     $this->validate($request, ['city' => 'required', 'start_time' => 'required|integer', 'end_time' => 'required|integer', 'vegetarian_type' => 'required|in:是,否,我都可以唷', 'meal_type' => 'required|in:中餐,西餐,我都可以唷'], ['city.required' => '用餐城市不可以空白唷', 'start_time.required' => '用餐開始時間不可以空白唷', 'end_time.required' => '用餐結束時間不可以空白唷']);
     // get input array
     $inputAll = $request->all();
     // append user id input input array
     $inputAll['user_id'] = auth()->user()->id;
     // create date application
     $dateApplication = DateApplication::create($inputAll);
     // show application success page
     return redirect('home');
 }