/** * 生成sitemap地图 * @return \Illuminate\Http\Response */ public function sitemap() { $data = Cache::remember('sitemap', 30, function () { return ['travels' => Travel::all(), 'destinations' => Destination::all()]; }); $travels = $data['travels']; $destinations = $data['destinations']; $data = compact('travels', 'destinations'); $sitemap = view('index.sitemap', $data); return Response($sitemap, '200')->header('Content-Type', 'text/xml'); }
/** * [landscape description] * @param [type] $id [description] * @return [type] [description] */ public function landscape($id) { $tours = Tour::getTourByLandScape($id); foreach ($tours as $key => $value) { $tours[$key]->periodNature = HomeController::periodNature($value->period); } $destinationsData = Destination::all(); $departuresData = Departure::all(); $landScapeAbroad = Tour::getLandScapeAbroad(); $landScapeNotAbroad = Tour::getLandScapeNotAbroad(); return view('home.searchtour', compact('tours', 'destinationsData', 'departuresData', 'landScapeAbroad', 'landScapeNotAbroad')); }
/** * @param Request $request * @return Response */ public function getAll(Request $request) { $top = $request->input('top', 4); $withAvatar = (bool) $request->input('withAvatar', FALSE); $data = Destination::all()->take($top); if ($withAvatar == TRUE) { foreach ($data as &$dest) { $dest['avatar'] = $dest->avatar; } } return $data; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { try { // return Destination::all()->each(function ($i) { /** @var \App\Models\Destination $i */ $i->append(['avatar']); }); } catch (\Exception $e) { return response()->json(['message' => $e->getMessage()]); } }
/** * [tour description] * @return [type] [description] */ public function tour() { $featuretours = Tour::getFeatureTour(); foreach ($featuretours as $key => $value) { $featuretours[$key]->periodNature = HomeController::periodNature($value->period); } $newtours = Tour::getNewTour(); foreach ($newtours as $key => $value) { $newtours[$key]->periodNature = HomeController::periodNature($value->period); } $destinations = Destination::all(); $departures = Departure::all(); return view('home.tour', compact('featuretours', 'newtours', 'destinations', 'departures')); }
/* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', function () { // get top articles (3) $articles = \App\Models\Article::renderAll(3); // get top places (6) $destinations = \App\Models\Destination::all()->random(6); // get top ulibiers (4) $users = \App\Ulibier::all(); return View::make('index', ['articles' => $articles, 'dest' => $destinations, 'users' => $users]); }); Route::get('/register', function () { return View::make('pages.register'); }); Route::get('/profile', function () { return View::make('pages.profile'); }); Route::get('/map', function () { return View::make('pages.map'); }); Route::get('/test/email', function () { return View::make('emails.confirmation');
/** * Show the form for editing the specified resource. * * @param Article $article * @return \Illuminate\Http\Response */ public function edit($article) { $tags = Tag::all(); $dest = Destination::all(['des_id', 'des_name', 'coordinate']); return View::make('pages.blogpost', ['model' => $article, 'action' => array('blog.update', $article->article_id), 'method' => 'PUT', 'tags' => $tags->toJson(), 'dest' => $dest->toJson()]); }