public function storeimage(Request $request) { $restaurant = Tour::find($request->input('id')); $galeriaid = $restaurant->id_galeria; $path = public_path() . $request->input('path'); $files = $request->file('file'); foreach ($files as $file) { $fileName = strtolower(str_random(40) . '.' . $file->getClientOriginalExtension()); $file->move($path, $fileName); $galimg = new Galeria_Imagen(); $galimg->id_galeria = $galeriaid; $galimg->nombre = $fileName; $galimg->save(); } }
/** * Display a listing of the resource. * GET /bookings * * @return Response */ public function index($id = null, $tourid = null) { if (!$id || !$tourid) { return Redirect::route('tours'); } $tour = Tour::find($id); $tourdates = array(); foreach ($tour->dates as $dates) { if ($dates['spaces'] > 0) { $value = $dates['start_date'] . ' - ' . $dates['end_date']; $tourdates = array_add($tourdates, $dates['id'], $value); } } return View::make('bookings.index', compact('tour', 'tourid', 'tourdates')); }
public function thankyou($payment_reference = null, $charge = null) { $charge = Session::get('charge'); $payment_reference = Session::get('payment_reference'); if ($payment_reference) { $booking = Booking::find($payment_reference); $booking->receipt = array('stripe_id' => $charge->id, 'payment_reference' => Session::get('payment_reference'), 'amount' => $charge->amount); $booking->save(); Tour::where('dates.id', (int) $booking->tour_date)->decrement('dates.$.spaces'); $tour = Tour::find($booking->id); Mail::send('emails.stripebooking', compact('booking', 'tour'), function ($message) { $message->to('*****@*****.**', 'Not Normal Tours')->subject('New Booking at Not Normal Tours'); }); return View::make('pages.thankyou'); } return View::make('pages.thankyou'); }
use yii\helpers\ArrayHelper; use yii\helpers\Html; use yii\widgets\ActiveForm; /* @var $this yii\web\View */ /* @var $model backend\models\Booking */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="booking-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'tour_id')->dropDownList(ArrayHelper::map(Tour::find()->all(), 'id', 'title')); ?> <?php echo $form->field($model, 'address')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'adults')->textInput(); ?> <?php echo $form->field($model, 'infants')->textInput(); ?> <?php