コード例 #1
0
ファイル: routes.php プロジェクト: EvertArnould/idw
<?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;
コード例 #2
0
ファイル: PageController.php プロジェクト: EvertArnould/idw
 public function dashboard($id)
 {
     $page = Page::find($id);
     $audience = Audience::find($page->audience_id);
     return view('admin.dashboard.page.index', array('slug' => $page->slug_nl, 'audience' => $audience, 'page' => $page));
 }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
ファイル: OffersController.php プロジェクト: EvertArnould/idw
 public function restore(Request $request)
 {
     Offer::withTrashed()->where('id', $request->id)->restore();
     $offer = Offer::find($request->id);
     $audience = Audience::find($offer->audience_id)->name_nl;
     $message = "<div class='alert alert-success' role='alert'>\n                        <span class='fa fa-fw fa-thumbs-o-up'></span> <strong>" . ucfirst($offer->name_nl) . "</strong> werd met succes terug toegevoegd aan het aanbod van <strong>" . ucfirst($audience) . "</strong>!\n                    </div>";
     Session::flash('messages', $message);
     return redirect('/admin/dashboard/offers');
 }
コード例 #5
0
 public static function edit()
 {
     $validator = Validator::make(Input::all(), ['name_nl' => 'required|max:40', 'name_en' => 'required|max:40', 'name_fr' => 'max:40', 'description_nl' => 'required|max:40', 'description_en' => 'required|max:40', 'description_fr' => 'max:40']);
     if ($validator->fails()) {
         return redirect('/admin/dashboard/audiences/' . Input::get('audience_id'))->withErrors($validator)->withInput();
     }
     $audience = Audience::find(Input::get('audience_id'));
     $audience->name_nl = Input::get('name_nl');
     $audience->name_en = Input::get('name_en');
     $audience->name_fr = Input::get('name_fr');
     $audience->description_nl = Input::get('description_nl');
     $audience->description_en = Input::get('description_en');
     $audience->description_fr = Input::get('description_fr');
     $audience->save();
     return redirect('/admin/dashboard/audiences/' . Input::get('audience_id'));
     $message = "<div class='alert alert-danger' role='alert' id='disappear'><span class='glyphicon glyphicon-thumbs-down'></span><strong> You've apparently missed some questions! Why don't you try that again?</strong></div>";
     Session::flash('messages', $message);
     return Redirect::back();
 }