예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     $input = Request::all();
     if (empty($input['alias'])) {
         $input['alias'] = genTopicAlias($input['name']);
         $data = Tour::where('alias', $input['alias'])->first();
         if (!empty($data)) {
             $input['alias'] = create_permalink($input['alias']);
         }
     } else {
         $data = Tour::where('alias', $input['alias'])->first();
         if (!empty($data)) {
             $input['alias'] = create_permalink($input['alias']);
         }
     }
     $photos = [];
     if (!empty($input['photo'])) {
         $temp = count($input['photo']);
         for ($i = 0; $i < $temp; $i++) {
             $photos[] = ['src' => $input['photo'][$i], 'title' => $input['title_img'][$i], 'desc' => $input['desc_img'][$i]];
         }
         $input['photos'] = json_encode($photos);
     }
     $input['destinations'] = destination_encode($input['destinations']);
     Tour::create($input);
     return redirect()->action('Admin\\TourController@index');
 }
 public function step2($alias)
 {
     $tour = Tour::where('alias', $alias)->firstOrFail();
     if ($tour) {
         return view('booking.step2', ['tour' => $tour]);
     }
     return redirect('/');
 }
예제 #3
0
 /**
  * 
  * @param int $activityId
  * @return $tours
  */
 public function getToursByActivity($activityId, $perPage = 10)
 {
     return Tour::where('banner', '<>', '')->where('end_date', '>', $this->currentDate)->whereHas('activities', function ($query) use($activityId) {
         $query->where('activity_id', $activityId);
     })->orderBy('updated_at', 'desc')->paginate($perPage);
 }
 /**
  * Show the tours page filter by duration.
  *
  * @return \Illuminate\Http\Response
  */
 public function duration($duration)
 {
     // Get number from input string
     $duration = preg_replace("/[^0-9]/", "", $duration);
     $tours = Tour::where('duration', '=', $duration)->published()->get();
     return view('vietnam.duration', ['tours' => $tours, 'duration' => $duration]);
 }
 public function costostour($id)
 {
     $tour = Tour::where('id', '=', $id)->get()->first();
     return view('providers.tours.costostours', compact('tour'));
 }