/** * Display a listing of the resource. * * @return Response */ public function index($route, $offer) { if (LaravelLocalization::getCurrentLocale() == 'en') { $offer = Offer::where('route_en', $offer)->first(); $audience = Audience::where('route_en', $route)->first(); $audiences = Audience::all(); return view('audiences.' . $route . '.offers')->with(['offer' => $offer, 'audience' => $audience, 'audiences' => $audiences]); } elseif (LaravelLocalization::getCurrentLocale() == 'nl') { $offer = Offer::where('route_nl', $offer)->first(); $audience = Audience::where('route_nl', $route)->first(); $audiences = Audience::all(); return view('audiences.' . $audience->route_en . '.offers')->with(['offer' => $offer, 'audience' => $audience, 'audiences' => $audiences]); } }
<?php /** * Created by PhpStorm. * User: Evert * Date: 25/09/2015 * Time: 2:14 */ $localizedRoutes = array(); foreach (\Idw\Audience::all() as $audience) { $localizedRoutes[$audience->route_en] = "doelgroepen/" . $audience->route_nl; foreach (\Idw\Offer::where('audience_id', $audience->id)->get() as $offer) { $localizedRoutes[$audience->route_en . "." . $offer->route_en] = "doelgroepen/" . $audience->route_nl . "/" . $offer->route_nl; } } foreach (\Idw\Post::all() as $post) { $localizedRoutes[$post->route_en] = "nieuws/" . $post->route_nl; } foreach (\Idw\Page::all() as $page) { $localizedRoutes[$page->route_en] = "paginas/" . $page->route_nl; } foreach (\Idw\Event::all() as $event) { $localizedRoutes[$event->route_en] = "evenementen/" . $event->route_nl; } return $localizedRoutes;
public function showGetAllAudiences() { $audiences = Audience::all(); $slug = 'Audiences'; return view('admin.dashboard.audience.all')->with(['audiences' => $audiences, 'slug' => $slug]); }