public function show($id)
 {
     $travel = Travel::where('ID_Travel', '=', $id)->firstOrFail();
     $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
     $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
     $data['about'] = About::get()->all();
     $package = TravelPackage::where('ID_Travel', '=', $id)->get();
     return View::make('travels.show', compact('travel'))->with('package', $package)->with('data', $data);
 }
 public function indexTravel()
 {
     $getoff_id = Offer::where('Status', '=', 'Active')->get();
     $offer = Offer::join('detail_offer', 'detail_offer.ID_Offer', '=', 'offer.ID_Offer')->join('roomtype_pic', 'roomtype_pic.ID_RoomType', '=', 'detail_offer.ID_RoomType')->join('roomtype', 'roomtype.ID_RoomType', '=', 'detail_offer.ID_RoomType')->where('offer.Status', '=', 'Active')->where('roomtype_pic.Main_Pic', '=', 'YES')->get();
     $countOffer = Offer::where('Status', '=', 'Active')->count();
     $countDetail = DetailOffer::join('offer', 'offer.ID_Offer', '=', 'detail_offer.ID_Offer')->where('offer.Status', '=', 'Active')->count();
     $rooms = Rooms::join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->paginate(5, ['roomtype.RoomType_Name', 'roomtype.Price', 'roomtype_pic.Picture', DB::raw("CONCAT(SUBSTRING(roomtype.Description, 1, 100), '...') as IsiRoom"), 'roomtype.ID_RoomType']);
     $data['about'] = About::get()->all();
     $travel = Travel::where('ID_Travel', '=', Cache::get('travel_session'))->where('Status', '=', 'Active')->get();
     return View::make('Books.Travel.index', compact('rooms'))->with('travel', $travel)->with('data', $data)->with('countOffer', $countOffer)->with('offer', $offer)->with('countDetail', $countDetail);
 }
Esempio n. 3
0
                </div>
                <p>
                    暂无站内简讯
                </p>
                @endif
            </div>
            {{-- /Text Widget --}}

            {{-- Recent Posts Widget --}}
            <div class="widget">

                <div class="widget-title">
                    <h4>热门分享</h4>
                </div>
                <?php 
$posts = Travel::where('post_status', 'open')->orderBy('comments_count', 'desc')->paginate(4);
?>
                @foreach($posts as $post)
                <div class="post-box">
                    <a href="{{ route('timeline.getTimeline', $post->user->id) }}"> <img class="img-rounded" src="{{ $post->user->portrait_large }}" width="50" height="50" alt=""> </a>
                    <div>
                        <h5><a href="{{ route('travel.show', $post->slug) }}">{{ $post->title }}</a></h5>
                        <small>{{ date("M d, Y",strtotime($post->created_at)) }}</small>
                    </div>
                </div>
                @endforeach
            </div>
            {{-- /Recent Posts Widget --}}

            {{-- Tags Widget --}}
            <div class="widget">
    } else {
        for ($i = 0; $i < $package->count(); $i++) {
            if (File::exists($filename)) {
                File::delete($filename);
            }
            $package->delete();
        }
    }
});
/*---------------------------------------------------*/
//home
Route::get('/', function () {
    $data['room'] = Rooms::select('roomtype.RoomType_Name', 'roomtype.ID_RoomType', 'roomtype_pic.Picture')->join('roomtype_pic', 'roomtype.ID_RoomType', '=', 'roomtype_pic.ID_RoomType')->where('roomtype_pic.Main_Pic', '=', 'YES')->where('roomtype.Status', '=', 'Active')->take(40)->get()->all();
    $data['offer'] = Offer::where('Status', '=', 'Active')->take(40)->get()->all();
    $data['dinas'] = Dinasevents::select(DB::raw("Event_ID, Event_Picture, Event_Date, Event_Title, CONCAT(SUBSTRING(Event_Description,1,100),'...') as IsiEvent"))->orderby('Event_Date', 'DESC')->take(40)->get()->all();
    $data['travel'] = Travel::where('Status', '=', 'Active')->take(40)->get()->all();
    $data['destination'] = Destination::where('Status', '=', 'Active')->take(40)->get()->all();
    $data['gallery'] = Gallery::where("Status", "!=", "Delete")->get()->all();
    $data['about'] = About::get()->all();
    Session::put('key', 'expiry', 1);
    $value = Session::get('key');
    return View::make('home')->with('index', 'active')->with('data', $data);
});
Route::get('post/listing', array('uses' => 'PostController@listing', 'as' => 'get.post.listing'));
Route::get('post/{id}', array('uses' => 'PostController@single', 'as' => 'get.post.single'))->where(array('id' => '[1-9][0-9]*', 'slug' => '[a-zA-Z0-9-_]+'));
Route::post('post/{id}', array('uses' => 'PostController@update', 'as' => 'post.post.update'))->where(array('id' => '[1-9][0-9]*'));
Route::resource('user', 'UserController');
//resource
Route::resource('/tourism', 'DestinationController');
Route::resource('/book', 'BooksController');
Route::resource('/rooms', 'RoomsController');