Beispiel #1
0
 public function ajaxGetGroups($params)
 {
     $inputs = explode('&', $params);
     $count = count($inputs);
     $locations = substr($inputs[0], 0, strlen($inputs[0]) - 1);
     $tags = substr($inputs[1], 0, strlen($inputs[1]) - 1);
     $groups = FbGroup::all();
     $ajaxOptions = "";
     if ($count == 2) {
         foreach ($groups as $group) {
             if ($this->validLocations($locations, $group->location) && $this->validTags($tags, $group->tags)) {
                 $ajaxOptions .= '<option value="' . $group->id . '">' . $group->name . ' - ' . $group->mems . ' mems' . '</option>';
             }
         }
         return $ajaxOptions;
     } else {
         if ($count == 4) {
             $minMem = $inputs[2];
             $maxMem = $inputs[3];
             foreach ($groups as $group) {
                 if ($this->validLocations($locations, $group->location) && $this->validTags($tags, $group->tags)) {
                     if ($group->mems >= $minMem && $group->mems <= $maxMem) {
                         $ajaxOptions .= '<option value="' . $group->id . '">' . $group->name . ' - ' . $group->mems . ' mems' . '</option>';
                     }
                 }
             }
             return $ajaxOptions;
         }
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $group = FbGroup::where('id', $id)->firstOrFail();
     $group->tags = substr($request->all()['tags'], 0, strlen($request->all()['tags']) - 1);
     $group->location = $request->all()['location'];
     if ($group->save()) {
         return redirect('fgtu');
     } else {
         dd('Error! Could not update tags!');
     }
 }
Beispiel #3
0
 public function delete($ids)
 {
     $newIds = substr($ids, 0, strlen($ids) - 1);
     $listID = explode(",", $newIds);
     //dd($listID);
     foreach ($listID as $id) {
         FbGroup::find($id)->delete();
     }
     return redirect('fbgrp');
 }