/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function showEdit($id) { $offer = Offer::where('id', $id)->first(); return view('admin.dashboard.offers.index', array('offer' => $offer, 'slug' => 'Edit ' . $offer->name_nl)); }
<?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 getAllSearchResults() { $searchterm = Input::get('keyword'); if (strlen($searchterm) >= 3) { $posts = Post::where('slug_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('slug_en', 'LIKE', '%' . $searchterm . '%')->orWhere('slug_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('name_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('name_en', 'LIKE', '%' . $searchterm . '%')->orWhere('name_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('subtitle_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('subtitle_en', 'LIKE', '%' . $searchterm . '%')->orWhere('subtitle_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('text_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('text_en', 'LIKE', '%' . $searchterm . '%')->orWhere('text_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_en', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('location_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('location_en', 'LIKE', '%' . $searchterm . '%')->orWhere('location_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('price', 'LIKE', '%' . $searchterm . '%')->get(); foreach ($posts as $post) { $audiences = explode(",", $post->audiences); $post->audiences = ""; for ($i = 0; $i < count($audiences); $i++) { $post->audiences = substr_replace($post->audiences . Audience::where('id', $audiences[$i])->first()->name_en . ", ", "", -1); } } $results = Offer::where('name_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('name_en', 'LIKE', '%' . $searchterm . '%')->orWhere('name_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('description_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('description_en', 'LIKE', '%' . $searchterm . '%')->orWhere('description_fr', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_nl', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_en', 'LIKE', '%' . $searchterm . '%')->orWhere('bullets_fr', 'LIKE', '%' . $searchterm . '%')->get(); if (LaravelLocalization::getCurrentLocale() == 'en') { foreach ($results as $result) { $result->audiences = Audience::where('id', $result->audience_id)->first()->name_en; } } elseif (LaravelLocalization::getCurrentLocale() == 'nl') { foreach ($results as $result) { $result->audiences = Audience::where('id', $result->audience_id)->first()->name_nl; } } $results = array_merge($results->all(), $posts->all()); return $results; } else { return null; } }