コード例 #1
0
 public function postForm()
 {
     $inp = Input::except(array('_token', 'checkinhour', 'checkinminute', 'checkinampm', 'checkouthour', 'checkoutminute', 'checkoutampm', 'etah', 'etam', 'etdh', 'etdm'));
     $validator = Validator::make($inp, array('guest1firstname' => 'required', 'guest1lastname' => 'required', 'guest1email' => 'required|email', 'company' => 'required', 'mobile' => 'required', 'occupancy' => 'required', 'smoking' => 'required', 'bed' => 'required', 'airportpickup' => 'required', 'checkindate' => 'required', 'checkoutdate' => 'required'));
     if ($validator->passes()) {
         $hb = new Hotelbooking();
         $hb->eventname = $inp['event'];
         $hb->guest1firstname = $inp['guest1firstname'];
         $hb->guest1lastname = $inp['guest1lastname'];
         $hb->company = $inp['company'];
         $hb->guest1email = $inp['guest1email'];
         $hb->mobile = $inp['mobile'];
         $hb->guest2firstname = $inp['guest2firstname'];
         $hb->guest2lastname = $inp['guest2lastname'];
         $hb->guest2email = $inp['guest2email'];
         $hb->occupancy = $inp['occupancy'];
         $hb->checkindate = $inp['checkindate'];
         $hb->checkintime = $inp['checkintime'];
         $hb->checkoutdate = $inp['checkoutdate'];
         $hb->checkoutime = $inp['checkouttime'];
         $hb->noofnights = $inp['noofnights'];
         $hb->smoking = $inp['smoking'];
         $hb->bed = $inp['bed'];
         $hb->modeofpayment = $inp['modeofpayment'];
         $hb->flightdetails = $inp['flightdetails'];
         $hb->eta = $inp['eta'];
         $hb->etd = $inp['etd'];
         $hb->airportpickup = $inp['airportpickup'];
         $hb->save();
         $data1 = array('name' => $hb->guest1firstname, 'event' => $hb->eventname);
         Mail::send('hotelbooking.email', $data1, function ($message) use($hb) {
             $message->to(array('*****@*****.**' => '*****@*****.**', '*****@*****.**' => '*****@*****.**'))->from('*****@*****.**')->subject($hb->guest1firstname . ', ' . $hb->eventname . '- hotel booking form completed');
         });
         return View::make('hotelbooking.thankyou');
     }
     return Redirect::to('hotelbookingform/form')->withErrors($validator)->withInput();
 }
コード例 #2
0
<?php

// require('http://localhost:8000/app/libs/excel/Classes/PHPExcel.php');
set_time_limit(1020);
require app_path() . '/libs/excel/Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator("ideconnect.com")->setLastModifiedBy("ideconnect.com")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
// Add some data
//***************************************************************************************
$excelarr = array();
$hotelbookings = Hotelbooking::where('eventname', '=', $event)->get();
$headers = Schema::getColumnListing('hotelbookings');
foreach ($hotelbookings as $hotelbooking) {
    $arr = array();
    foreach ($hotelbooking['attributes'] as $key => $value) {
        $arr[] = $value;
    }
    $excelarr[] = $arr;
}
array_unshift($excelarr, $headers);
$objPHPExcel->setActiveSheetIndex(0)->fromArray($excelarr, '', 'A1');
$objPHPExcel->getActiveSheet()->setTitle('DM');
$styleArray = array('font' => array('name' => 'Calibri', 'size' => '10', 'color' => array('rgb' => 'FFFFFF'), 'bold' => true), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'startcolor' => array('rgb' => '000000')));
// $styleArray2 = array(
//       'font' => array(
//         'name' => 'Calibri',
//         'size' => '10',
//         'color' => array(
//             'rgb' => '000000'
//         ),