Example #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     for ($i = 1; $i <= 20; $i++) {
         $guest = new Guest();
         $guest->firstName = $faker->firstName;
         $guest->lastName = $faker->lastName;
         $guest->member_since = $faker->date($format = 'Y-m-d', $max = 'now');
         $guest->save();
     }
 }
 /**
  * La fonction addGuest(Request $request) permet d'ajouter un invité à un événement si ce dernier existe, qu'il n'est pas complet et si les données sont valides.
  * @param Request $request - La requête contenant les paramètres.
  * @return Redirect - Une redirection avec les messages selon le bon déroulement de la fonction.
  */
 public function addGuest(Request $request)
 {
     $data = $request->all();
     $validator = Validator::make($request->all(), ['eventId' => "required|integer", 'first_name' => 'required|string', 'last_name' => 'required|string', 'email' => 'required|email', 'gender' => 'required|string|in:male,female']);
     if ($validator->passes()) {
         if (Event::existTechId($data['eventId'])) {
             $event = Event::find($data['eventId']);
             if (Event::isNotSoldOut($event->id)) {
                 if (!Guest::exist($data['email'])) {
                     $guest = new Guest();
                     $guest->first_name = $data['first_name'];
                     $guest->last_name = $data['last_name'];
                     $guest->email = $data['email'];
                     $guest->gender = $data['gender'];
                     $guest->save();
                 } else {
                     $guest = Guest::where('email', $data['email'])->first();
                     if (Guest::participateToEvent($data['eventId'], $guest->id)) {
                         return redirect('/events')->with('error', $guest->first_name . ' ' . $guest->last_name . ' participe déjà à l\'événement ' . $event->name);
                     }
                 }
                 $event->guests()->attach($guest->id);
                 return redirect('/events')->with('status', $guest->first_name . ' ' . $guest->last_name . ' a été ajouté à l\'événement ' . $event->name);
             }
             return redirect('/events')->with('error', 'Cet événement est complet');
         }
         return redirect('/events')->with('error', 'Cet événement n\'existe pas');
     }
     return redirect('/events')->withErrors($validator)->withInput();
 }
 public function updateGuest(Request $request)
 {
     $guest = new Guest();
     $guest = $request->except('_token');
     Guest::where('id', $guest['id'])->update($guest);
     return redirect()->route('listguest_com');
 }
 /**
  * list all checkout
  * @return [type] [description]
  */
 public function checkoutPreview($room)
 {
     $data['title'] = "Checkout Preview";
     $data['booking'] = $booking = Booking::where('room_name', $room)->first();
     $data['guest'] = Guest::where('id', $booking['guest_id'])->first();
     $data['total'] = 100;
     return view('receiption/checkoutPreview', $data);
 }
Example #5
0
 public function store()
 {
     $guest = Request::all();
     // Store guests
     Guest::create($guest);
     // Send them to "Thanks" site with link to add a new guests, mailing henrik
     return view('thanks')->with('guest', $guest);
 }
 public function run()
 {
     //DB::table('guests')->delete();
     // Guest1
     Guest::create(array('first_name' => 'Cedric', 'last_name' => 'Liengme', 'email' => '*****@*****.**', 'gender' => 'male'));
     // Guest2
     Guest::create(array('first_name' => 'John', 'last_name' => 'Doe', 'email' => '*****@*****.**', 'gender' => 'male'));
     // Guest3
     Guest::create(array('first_name' => 'Julie', 'last_name' => 'Smith', 'email' => '*****@*****.**', 'gender' => 'female'));
 }
Example #7
0
 public function getModel()
 {
     if (\Auth::check()) {
         return \Auth::user();
     }
     if ($this->request->hasCookie('email_user')) {
         $user = Email::where('email', $this->request->cookie('email_user'));
     }
     if ($this->request->hasCookie('guest_user')) {
         $tracker = $this->request->cookie('guest_user');
     }
     $tracker = $this->request->getClientIp();
     $user = Guest::firstOrCreate(['identifier' => $tracker]);
     return $user;
 }
 public function bookingRoomPost(Request $request)
 {
     $data['title'] = "Make reservation";
     //save to guest table
     $guest = new Guest();
     $guest = $request->all();
     $guest_id = Guest::create($guest);
     //save to booking table
     $booking = new Booking();
     $booking = $request->all();
     $booking['guest_id'] = $guest_id->id;
     Booking::create($booking);
     //update status room
     Room::where('name', $booking['room_name'])->update(array('status' => 'N'));
     return redirect()->route('listbooking_com');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $guests = Guest::All();
     for ($i = 1; $i <= 20; $i++) {
         $guest = $guests->random();
         $startDate = $faker->dateTimeBetween("now", "+12 days");
         $endDate = $faker->dateTimeBetween($startDate, "+ 1 month");
         $reservation = new Reservation();
         $reservation->date_in = $startDate;
         $reservation->date_out = $endDate;
         $reservation->made_by = "Faker";
         $reservation->guest_id = $guest->id;
         $reservation->save();
     }
 }
Example #10
0
 public function putGuestBackToDistribution($id)
 {
     $guest = Guest::find($id);
     $currentQue = Que::where('guest_id', $id)->limit(1)->orderBy('the_time')->first();
     $previousTable = Table::find(GuestRoute::where('guest_id', $id)->where('position_id', 2)->limit(1)->orderBy('the_time', 'desc')->first()->table_id);
     $guest = Guest::find($id);
     $guest->is_inside = 1;
     $guest->status = 'after test drive';
     $guest->save();
     $guestRoute = new GuestRoute();
     $guestRoute->guest_id = $id;
     $guestRoute->position_id = 2;
     $guestRoute->branche_id = $previousTable->branche_id;
     $guestRoute->save();
     $previousTable->current_que = $previousTable->current_que + 1;
     $previousTable->guests_count = $previousTable->guests_count + 1;
     $previousTable->save();
     $numberOfQue = count(Que::where('table_id', $previousTable->id)->get());
     if (intval($numberOfQue) > 2) {
         $lastTwo = Que::where('table_id', $previousTable->id)->limit(3)->orderBy('the_time', 'desc')->get();
         $the_time = Carbon::parse($lastTwo[2]->the_time)->addSecond();
     } else {
         $the_time = Carbon::now()->addMinutes(5);
     }
     $currentQue->the_time = $the_time;
     $currentQue->table_id = $previousTable->id;
     $currentQue->save();
     return redirect()->back();
 }
Example #11
0
 public function exportGuest($id)
 {
     if (Gate::denies('download', Activity::class)) {
         abort(403);
     }
     $records = Activity::join('activity_subtitles', 'activities.subtitle_id', '=', 'activity_subtitles.id')->join('activity_titles', 'activity_subtitles.title_id', '=', 'activity_titles.id')->select(['activities.date_of_activity', 'activities.barangay', 'activity_titles.title', 'activity_subtitles.subtitle', 'activities.day_of_activity', 'activities.venue_of_activity', 'activities.conducted_by', 'activities.remarks'])->where('activities.id', '=', $id)->get();
     $recordsArray = [];
     foreach ($records as $record) {
         $recordsArray[] = ['date_of_activity', $record->date_of_activity];
         $recordsArray[] = ['barangay', $record->barangay];
         $recordsArray[] = ['title', $record->title];
         $recordsArray[] = ['subtitle', $record->subtitle];
         $recordsArray[] = ['day_of_activity', $record->day_of_activity];
         $recordsArray[] = ['venue_of_activity', $record->venue_of_activity];
         $recordsArray[] = ['conducted_by', $record->conducted_by];
         $recordsArray[] = ['remarks', $record->remarks];
         $recordsArray[] = [' ', ' '];
     }
     $records = Guest::join('activity_guest', 'activity_guest.guest_id', '=', 'guests.id')->select(['guests.last_name', 'guests.first_name', 'guests.age', 'guests.gender', 'guests.civil_status', 'guests.agency', 'guests.role', 'guests.email', 'guests.contact_number'])->where('activity_guest.activity_id', '=', $id)->orderBy('guests.last_name', 'asc')->orderBy('guests.first_name', 'asc')->get();
     $recordsArray[] = ['last_name', 'first_name', 'age', 'gender', 'civil_status', 'agency', 'role', 'email', 'contact_number'];
     foreach ($records as $record) {
         $recordsArray[] = $record->toArray();
     }
     $now = Carbon::now('Asia/Manila');
     $file_name = 'arp_activity_guest_attendance_' . $now->format('Ymd_His');
     Excel::create($file_name, function ($excel) use($recordsArray) {
         $excel->setTitle('ARP Activity Guest Attendance');
         $excel->setDescription('List of ARP Activity Guest Attendance');
         $excel->sheet('Activity Guest Attendance', function ($sheet) use($recordsArray) {
             $sheet->fromArray($recordsArray, null, 'A1', false, false);
         });
     })->download('xlsx');
 }
Example #12
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data = array('title' => 'Dashboard', 'household_count' => Household::all()->count(), 'family_count' => Family::all()->count(), 'person_count' => Person::all()->count(), 'guest_count' => Guest::all()->count());
     return view('dashboard')->with($data);
 }
 public function manage()
 {
     $guests = Guest::paginate(5);
     return view('guests.manage', compact('guests'));
 }
Example #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id, Request $request)
 {
     $this->checkAdmin($request);
     Guest::findOrFail($id)->delete();
     return ['id' => $id];
 }
Example #15
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $guest = Guest::find($id);
     $guest->delete();
 }
 /**
  * Resend the qcode e-mail.
  *
  * @return Response
  */
 public function resend(Request $request)
 {
     $email = trim($request->email);
     if (strlen($email) < 3) {
         return redirect('questionnaire')->with('error', "Invalid e-mail address");
     }
     $guest = Guest::where('email', 'like', $email)->orWhere('email2', 'like', $email)->first();
     if (!isset($guest)) {
         return redirect('questionnaire')->with('error', "Cannot find a classmate with an e-mail \"{$email}\"");
     }
     if (!$this->send_qcode($guest, $email)) {
         return redirect('questionnaire')->with('error', 'An error occured while sending your message.');
     }
     return redirect('questionnaire')->with('message', 'Questionnaire Code Sent');
 }
Example #17
0
 /**
  * La fonction exist($email) permet de vérifier si l'invité existe en BD selon son identifiant métier.
  * @param type $email - l'e-mail de l'invité.
  * @return boolean - true si l'invité existe, false sinon.
  */
 public static function exist($email)
 {
     return Guest::where('email', $email)->first() !== NULL;
 }
Example #18
0
 public static function findByQcode($qcode)
 {
     return Guest::where('qcode', $qcode)->with('answer')->first();
 }
Example #19
0
 /**
  * Generate all of the q-codes for all users
  *
  * @param none
  *
  * @return response
  */
 public function generate_qcodes()
 {
     $guests = Guest::all();
     $count = 0;
     foreach ($guests as $guest) {
         $guest->qcode = $guest->generate_qcode();
         $guest->save();
         $count++;
     }
     return redirect('classmates')->with('message', "{$count} Guests Updated");
 }
Example #20
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  App\Reservation $reservation
  * @return Response
  */
 public function update(Request $request, Reservation $reservation)
 {
     $this->validate($request, ['name' => 'required', 'gender' => 'required', 'phone' => 'required|numeric', 'address' => 'required', 'check_in' => 'required|date|after:' . \Carbon\Carbon::today()->addDays(-1)->format('Y-m-d'), 'check_out' => 'required|date|after:' . $request->input('check_in')]);
     $input = $request->only('name', 'gender', 'phone', 'address');
     if (Auth::user()->role != 'user') {
         $guest = Guest::findOrFail($reservation->guest_id);
         $guest->fill($input)->save();
         $reservation_data = ['guest_id' => $guest->id, 'guest_type' => 'guest', 'check_in' => $request->input('check_in'), 'check_out' => $request->input('check_out')];
     } else {
         $user = User::findOrFail(Auth::user()->id);
         $user->fill($input)->save();
         $reservation_data = ['check_in' => $request->input('check_in'), 'check_out' => $request->input('check_out')];
     }
     $reservation->fill($reservation_data)->save();
     $roomTypes = $request->input('room_type_id');
     $roomReserved = $request->input('total_room_reserved');
     for ($i = 0; $i < count($roomTypes); $i++) {
         $reservation->roomTypes()->detach($roomTypes[$i]);
         $reservation->roomTypes()->attach($roomTypes[$i], ['total_room_reserved' => $roomReserved[$i]]);
     }
     return redirect('/reservation');
 }
Example #21
0
 public function exportExcel()
 {
     if (Gate::denies('download', Guest::class)) {
         abort(403);
     }
     $records = Guest::select([\DB::raw("CONCAT(guests.last_name, ', ', guests.first_name) as 'display_name'"), 'first_name', 'middle_name', 'last_name', 'gender', 'age', 'civil_status', 'education', 'occupation', 'agency', 'role', 'email', 'contact_number', 'photo_url']);
     $records = $records->orderBy('display_name', 'asc')->get();
     $recordsArray = [];
     $recordsArray[] = ['display_name', 'first_name', 'middle_name', 'last_name', 'gender', 'age', 'civil_status', 'education', 'occupation', 'agency', 'role', 'email', 'contact_number', 'photo_url'];
     foreach ($records as $record) {
         $recordsArray[] = $record->toArray();
     }
     $now = Carbon::now('Asia/Manila');
     $file_name = 'arp_guests_' . $now->format('Ymd_His');
     Excel::create($file_name, function ($excel) use($recordsArray) {
         $excel->setTitle('ARP Guests');
         $excel->setDescription('List of ARP Guests');
         $excel->sheet('Guests', function ($sheet) use($recordsArray) {
             $sheet->fromArray($recordsArray, null, 'A1', false, false);
         });
     })->download('xlsx');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Requests\CobaRequest $request)
 {
     return Guest::all();
 }
Example #23
0
 public function classlist()
 {
     $guests = Guest::with('answer')->orderBy('last_name')->get();
     return view('classlist', compact('guests'));
 }