Ejemplo n.º 1
0
 /**
  * @param string $backUrl
  * @param int $categorie_id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function add($backUrl = 'compet', $categorie_id = 0)
 {
     if ($categorie_id == 0) {
         return Redirect::route($backUrl);
     }
     $categorie = Categorie::find($categorie_id);
     $userclub = new Competcategorie();
     $userclub->categorie_id = $categorie->id;
     $userclub->compet_id = MySession::getModel('compet')->id;
     $userclub->tee_id = $categorie->tee_id;
     $userclub->save();
     return Redirect::route($backUrl);
 }
Ejemplo n.º 2
0
 public static function getSamePost($id = "", $cate = "", $limit)
 {
     if ($cate != "" && $id != "") {
         if (Post::where('categorieID', $cate)->count() > 4) {
             $data = DB::select(" SELECT * FROM posts WHERE categorieID = {$cate} AND id != {$id} ORDER BY id ASC LIMIT 0, {$limit} ");
         } else {
             $parent = Categorie::find($cate)->parent;
             $data = DB::select(" SELECT * FROM posts WHERE parent = {$parent} AND id != {$id} ORDER BY id ASC LIMIT 0, {$limit} ");
         }
     } else {
         $data = DB::select("SELECT * FROM posts WHERE parent = 1 ORDER BY id DESC LIMIT 0, {$limit} ");
     }
     return $data;
 }
Ejemplo n.º 3
0
 public function action_mylistings()
 {
     if (Auth::check()) {
         if (Session::has('id')) {
             $id = Session::get('id');
             $account = Account::find($id);
             $locations = $account->locations()->get();
             $listings = array();
             foreach ($locations as $location) {
                 foreach ($location->listings()->get() as $listing) {
                     $listing->location = $listing->location()->first();
                     $listing->category = Categorie::find($listing->category_id)->title;
                     // var_dump($listing->category_id);
                     array_push($listings, $listing);
                 }
             }
             $view = View::make('account.manage_listings.index')->with('title', 'My Listings')->with('listings', $listings);
             return $view;
         }
     }
 }
Ejemplo n.º 4
0
<?php

Route::group(['prefix' => 'tester'], function () {
    # Selected
    Route::get('selected/{backUrl?}/{id?}', ['as' => 'test.selected', function ($backUrl = 'manager', $id = 0) {
        $c = Categorie::find($id);
        return $c;
    }]);
    # Create
    Route::get('create/{backUrl?}/{id?}', ['as' => 'test.create', 'uses' => 'TestsController@create']);
    Route::post('create', ['as' => 'test.create', 'uses' => 'TestsController@store']);
    # Delete
    Route::get('delete/{id?}/{backUrl?}', ['as' => 'test.delete', 'uses' => 'TestsController@delete']);
    # List
    Route::get('/list', ['as' => 'test.list', 'uses' => 'TestsController@liste']);
    # Home
    Route::get('/home', ['as' => 'test.home', 'uses' => 'TestsController@home']);
    # ScoreCard Angular
    Route::get('/scorecard', ['as' => 'test.scorecard', 'uses' => 'TestsController@scorecard']);
    # Divers test
    Route::get('/divers', ['as' => 'test.divers', 'uses' => 'TestsController@divers']);
    # Show Session
    Route::get('/showSession', ['as' => 'test.showSession', 'uses' => 'TestsController@showSession']);
    # Show Ajax
    Route::get('/showAjax', ['as' => 'test.showAjax', 'uses' => 'TestsController@showAjax']);
    # Test Ajax
    Route::get('/getAjax/{model}/{id?}', function ($model, $id = 0) {
        if ($id == 0) {
            return $model::all();
        }
        return $model::find($id);
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $categorie = Categorie::find($id);
     if ($categorie->materials->count() == 0) {
         $categorie->delete();
         return Redirect::back()->with('success', 'U hebt de categorie ' . $categorie->name . ' met succes verwijderd');
     } else {
         return Redirect::back()->with('error', 'Kan categorie niet verwijderen. </br>Gelieve eerst al het materiaal uit de categorie te verwijderen.');
     }
 }
Ejemplo n.º 6
0
 public function action_sendEmails()
 {
     $accounts = Account::where('wishlistEmail', '=', '1')->get();
     foreach ($accounts as $account) {
         $matches = array();
         $tags = $account->wishlistitems()->get();
         $listings = array();
         $tempListings = array();
         foreach ($tags as $tag) {
             $tagListings;
             $strings = explode(' ', $tag->item);
             if (sizeof($strings) == 1) {
                 $tagListings = Listing::where('title', 'LIKE', "%{$tag->item}%")->or_where("description", 'LIKE', "%{$tag->item}%")->get();
             } else {
                 $string = array_pop($strings);
                 $query = "\tSELECT *\n\t\t\t\t\t\t\t\tFROM listings\n\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\t(title LIKE '%{$string}%'\n\t\t\t\t\t\t\t\t\tOR description LIKE '%{$string}%')";
                 while (!empty($strings)) {
                     $string = array_pop($strings);
                     $query .= " AND (title LIKE '%{$string}%'\n\t\t\t\t\t\t\t\t\tOR description LIKE '%{$string}%')";
                 }
                 $tagListings = DB::query($query);
             }
             foreach ($strings as $string) {
             }
             foreach ($tagListings as $listing) {
                 $listing->location = Location::find($listing->location_id);
                 $listing->category = Categorie::find($listing->category_id);
             }
             array_push($tempListings, $tagListings);
         }
         foreach ($tempListings as $key => $tagListings) {
             foreach ($tagListings as $listing) {
                 $listings[$listing->id] = $listing;
             }
         }
         var_dump(sizeof($listings));
         if (sizeof($listings) > 0) {
             $email = $account->email;
             $subject = 'REMARKET: Matches found on your wishlist!';
             $message = "There have recently been matches found which match the tags in your wishlist. \n\n" . "Go to market319.tk/ and login to view your wishlist.\n" . "\n\n Happy buying, \n The REMARKET team";
             $header = "from: REMARKET <*****@*****.**>";
             $sent = mail($email, $subject, $message, $header);
         }
     }
 }