public function gc_store() { $rules = ['member_name' => 'required', 'member_email' => 'required', 'member_mobile' => 'required', 'member_photo' => 'required|mimes:jpg,png,jpeg', 'member_id_photo' => 'required|mimes:jpg,png,jpeg', 'contest' => 'required']; $data = Input::all(); $validation = Validator::make($data, $rules); if ($validation->fails()) { return Redirect::back()->withErrors($validation)->withInput(); } else { if (Input::hasFile('member_photo') && Input::hasFile('member_id_photo')) { //path $destinationPath = public_path('uploads/registration'); $member_photo = Input::file('member_photo'); $member_photo_fileName = strtotime(date('Y-m-d H:i:s')) . md5($member_photo->getClientOriginalName()) . "." . $member_photo->getClientOriginalExtension(); $member_photo->move($destinationPath, $member_photo_fileName); $member_id_photo = Input::file('member_id_photo'); $member_id_photo_fileName = strtotime(date('Y-m-d H:i:s')) . md5($member_id_photo->getClientOriginalName()) . "." . $member_id_photo->getClientOriginalExtension(); $member_id_photo->move($destinationPath, $member_id_photo_fileName); foreach ($data['contest'] as $contest) { $flag_done = false; $reg = new RegistrationGames(); $reg->member_name = $data['member_name']; $reg->member_email = $data['member_email']; $reg->member_mobile = $data['member_mobile']; $reg->member_photo = $member_photo_fileName; $reg->member_id_photo = $member_id_photo_fileName; $reg->contest = $contest; $reg->status = 0; if ($reg->save()) { $flag_done = true; } } if ($flag_done) { return Redirect::route('team.gc')->with('success', "Registration Successful"); } else { return Redirect::route('reg.gc')->with('error', "Photos error, Please Try Again"); } } else { return Redirect::route('reg.gc')->with('error', "Photos error, Please Try Again"); } } }
public function gc() { $teams = RegistrationGames::orderBy('id', 'ASC')->get(); return View::make('site.game_team')->with('teams', $teams)->with('title', 'IPvision SUST CSE Carnival 2015 ::. Team ::. Gaming Contest'); }