コード例 #1
0
ファイル: Group.php プロジェクト: jtoshmat/laravel
 public static function updateGroups(Request $request)
 {
     $titles = $request::get('title');
     $ids = $request::get('id');
     $deleteId = $request::get('delete');
     $newtitle = $request::get('newtitle');
     $i = 0;
     if ($ids) {
         foreach ($ids as $id) {
             $group = Group::find($id);
             $group->title = $titles[$i];
             if (isset($deleteId[$i]) && $deleteId[$i] == $id) {
                 $group->delete();
             } else {
                 $group->save();
             }
             $i++;
         }
     }
     if ($newtitle) {
         $group = new Group();
         $group->title = $newtitle;
         $group->save();
     }
     return true;
 }
コード例 #2
0
ファイル: GroupController.php プロジェクト: VolodyaP/wapp
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $group = Group::find($id);
     $data['group'] = $group;
     $data['users'] = $group->users;
     return view('group.show', $data);
 }
コード例 #3
0
ファイル: GroupController.php プロジェクト: machiidev/lapp1
 public function axsave(Request $request)
 {
     //
     $response = array('status' => 'success', 'msg' => 'OK!');
     $rules = array('fname' => 'required', 'fremark' => 'required', 'femail' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $response['status'] = "warning";
         $response['msg'] = $validator->messages()->toJson();
         return response()->json($response);
     } else {
         try {
             $gid = Input::get('fid');
             if ($gid != 'Neu') {
                 $group = Group::find($gid);
             } else {
                 $group = new Group();
             }
             $group->name = Input::get('fname');
             $group->remark = Input::get('fremark');
             $group->email = Input::get('femail');
             //$user = \App\User::find(1) ;
             $group->manager()->associate(Input::get('fmanager'));
             $group->save();
         } catch (\Illuminate\Database\QueryException $e) {
             $response['status'] = "danger";
             $response['msg'] = "Database error: " . $e->getMessage();
             return response()->json($response);
         }
         //return Response::json( $response );
         return response()->json($response);
     }
     //validatorf
 }
コード例 #4
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Auth::user()) {
         return redirect('auth/login');
     }
     $groupall = Auth::user()->group()->get();
     $allowed_routes = array();
     foreach ($groupall as $key => $value) {
         $feature = Group::find($value->id)->feature()->get();
         foreach ($feature as $key_fea => $val_fea) {
             $val_fea_j = json_decode($val_fea->url_action);
             if ($val_fea_j != NULL) {
                 foreach ($val_fea_j as $k_valfea => $v_valfea) {
                     array_push($allowed_routes, $v_valfea);
                 }
             } else {
                 array_push($allowed_routes, $val_fea->url_action);
             }
         }
     }
     //view()->share('sidebar', ($this->showSidebar($allowed_routes)));
     App::singleton('allowed_routes', function () use($allowed_routes) {
         return $allowed_routes;
     });
     /*App::after(function ($request, $response) {
     		// Mencegah Kembali Login Setelah Logout dengan Menekan Tombol Back pada Browser
     		$response->headers->set("Cache-Control", "no-cache,no-store, must-revalidate");
     		$response->headers->set("Pragma", "no-cache"); //HTTP 1.0
     		$response->headers->set("Expires", " Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
     		});*/
     view()->share('allowed_routes', $allowed_routes);
     return $next($request);
 }
コード例 #5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // exit();
     // First make sure there is an active session
     // dd(debug_print_backtrace(2));
     // dd(Sentry::check());
     if (!Sentry::check()) {
         // return $next($request);
         exit('tidak login');
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest(route('sentinel.login'));
         }
     }
     // Now check to see if the current user has the 'admin' permission
     // dd(get_class(Sentry::getUser()));
     // dd(Sentry::getUser()->hasAccess('admin'));//Sentinel\Models\User
     if (Sentry::getUser()->hasAccess('admin')) {
         dd('admin');
         return $next($request);
     }
     // dd($request->route()->getActionName());//"App\Http\Controllers\ExcelController@getIndex"
     if (!Sentry::getUser()->hasAccess('admin')) {
         // echo 'masukkk bukan admin<br>';
         // dd(\Sentry::getUser()->getGroups()[0]->pivot->group_id);
         //ambil group_id lewat user_id -> lewat pivot users_group
         $group_id = \Sentry::getUser()->getGroups()[0]->pivot->group_id;
         // dd($group_id);
         //melalui group model dengan id diatas => untuk mengambil akses menu  ( menghasilkan list akses menu)
         $akses = Group::find($group_id)->akses()->get()->toArray();
         // $akses = Group::find($group_id)->akses->get()->toArray();
         // dd($akses);
         // echo $akses;
         $currentRoute = $request->route()->getActionName();
         // dd($currentRoute).'-----<br>';
         foreach ($akses as $key => $value) {
             $action = $value['controller'] . '@' . $value['controller_method'];
             // $action=$value['controller'];
             if ($action == $currentRoute && $value['akses'] == 1) {
                 // var_dump( $currentRoute == $action );
                 return $next($request);
             }
         }
         return response('Unauthorized.', 401);
     }
     // dd(Sentry::getUser()->hasAccess('admin'));
     // dd(Sentry::getId());
     // dd(Sentry::getGroups());
     // All clear - we are good to move forward
     // return $next($request);
     if ($request->ajax()) {
         dd('ajaxx');
         return response('Unauthorized.', 401);
     } else {
         Session::flash('error', trans('Sentinel::users.noaccess'));
         return redirect()->route('sentinel.login');
     }
 }
コード例 #6
0
ファイル: PostService.php プロジェクト: rhofma/rhofma.de
 public function getGroup($groupId)
 {
     $group = Group::find($groupId);
     if (!is_null($group)) {
         return $group->toArray();
     }
     return false;
 }
コード例 #7
0
 private function prepareGroupPageData($group_id)
 {
     $group_data = \App\Group::find($group_id);
     $groupUserData = \App\Group::getGroupUserData($group_id);
     $user_data = auth()->user();
     $data = ['group_data' => $group_data, 'groupUserData' => $groupUserData, 'user_data' => $user_data];
     return $data;
 }
コード例 #8
0
 function listPages()
 {
     $groups = Group::all();
     foreach ($groups as $key => $group) {
         $pages = Group::find($group->id)->getPages;
         $groups[$key]['pages'] = $pages;
     }
     return view('pages', ['groups' => $groups]);
 }
コード例 #9
0
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $taskid = $this->route('id');
     if (Auth::check()) {
         return Auth::user()->id == Task::find($taskid)->userId || User::find(Auth::id())->hasRole('bpLead') || User::find(Group::find(Task::find($taskid)->group)->user_ID)->id == Auth::id();
     } else {
         return false;
     }
 }
コード例 #10
0
 /**
  * Get features of this group
  *
  * @return [array] [array feature]
  */
 public function getFeatureGroup()
 {
     $groupall = Auth::user()->group()->get();
     foreach ($groupall as $key => $value) {
         $feature = Group::find($value->id)->feature()->get();
         foreach ($feature as $key_fea => $val_fea) {
             array_push($this->listfeaturegroup, array($val_fea->id => $val_fea->url_action));
         }
     }
 }
コード例 #11
0
ファイル: GroupsController.php プロジェクト: Orvo/mlraamattu
 public function leave($id)
 {
     $group = Group::find($id);
     if ($group && Auth::user()->groups()->where('id', $id)->exists()) {
         $user = Auth::user()->groups()->detach($id);
         Session::flash('group_left', true);
         return redirect('/groups/manage');
     }
     return redirect('/groups/manage');
 }
コード例 #12
0
ファイル: UserTableSeeder.php プロジェクト: plxx/pigeon
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     $faker = Faker\Factory::create();
     //Admin Account
     $user = User::create(['name' => 'Daniel Bühner', 'email' => '*****@*****.**', 'password' => bcrypt('google')]);
     $user->groups()->attach(Group::find(1));
     //Fake Accounts
     for ($i = 0; $i < 10; $i++) {
         $user = User::create(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt($faker->password())]);
         $user->groups()->attach(Group::find(2));
     }
 }
コード例 #13
0
ファイル: Group.php プロジェクト: VolodyaP/wapp
 /**
  * Function adding user to group
  * @param $user_ids array
  * @param $group_id int
  */
 public static function addUserToGroup($user_ids, $group_id)
 {
     $result = false;
     if (count($user_ids) > 1) {
         foreach ($user_ids as $id) {
             $user = User::find($id);
             $result[] = Group::find($group_id)->users()->save($user);
         }
     } else {
         $user = User::find($user_ids)->first();
         $result = Group::find($group_id)->users()->save($user);
     }
     return $result;
 }
コード例 #14
0
 static function getGroupUserData($group_id)
 {
     $group_data = \App\Group::find($group_id);
     $user_ids = $group_data['user_ids'];
     $groupUserData = [];
     while (strlen($user_ids)) {
         $start = strpos($user_ids, '[');
         $end = strpos($user_ids, ']');
         $current_id = substr($user_ids, $start, $end + 1);
         array_push($groupUserData, \App\User::find($current_id[1]));
         $user_ids = substr($user_ids, $end + 1, strlen($user_ids));
     }
     return $groupUserData;
 }
コード例 #15
0
 public function index()
 {
     $selectedGroup = null;
     if ($groupId = Input::get('group')) {
         $selectedGroup = Group::find($groupId);
     }
     if ($selectedGroup) {
         if (Gate::denies('show', $selectedGroup)) {
             return Redirect::back()->with(['error_message' => "You do not have permission."]);
         }
         $passwords = $selectedGroup->passwords()->paginate(10);
     } else {
         $passwords = Auth::user()->passwords()->paginate(10);
     }
     $groups = Auth::user()->groups()->get();
     return view('password.index', ['passwords' => $passwords, 'groups' => $groups, 'selectedGroup' => $selectedGroup]);
 }
コード例 #16
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     // Create the user.
     $user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
     // we want to assign new users to the 'unauthenticated' user group, but
     // the find() method only works for ids, which could change during data
     // migration. This is a messy, but working work-around to map new users
     // to the correct group upon sign-up.
     $groups = Group::all(['id', 'name']);
     foreach ($groups as $group) {
         if ('Unauthenticated' == $group->name) {
             $id = $group->id;
         }
     }
     // Create the relation for the user to the correct group.
     $defaultGroup = Group::find($id);
     $user->group()->attach($defaultGroup);
     return $user;
 }
コード例 #17
0
ファイル: GroupsController.php プロジェクト: joseph1125/cis
 public function removeGp($gpId)
 {
     $gp = Group::find($gpId);
     if ($gp != null) {
         if (count($gp->members) <= 0) {
             if (count(GpAsgAnsRank::where('gp_id', $gpId)->get()) <= 0) {
                 $gp->delete();
                 return 0;
             }
             return -3;
             //some members have already ranked the group
         } else {
             return -2;
         }
         //has members in group
     }
     return -1;
     //there is no such group
 }
コード例 #18
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $notifications = QueryHelper::getNotificationsToSend();
     if (count($notifications > 0)) {
         foreach ($notifications as $notification) {
             $user = \App\User::find($notification->user_id);
             $group = \App\Group::find($notification->group_id);
             if ($user && $group) {
                 $this->info('Checking if there is something to send to user:'******' (' . $user->email . ')' . ' for group:' . $group->id . ' (' . $group->name . ')');
                 $mailer = new AppMailer();
                 if ($mailer->sendNotificationEmail($group, $user)) {
                     $this->info('Message sent');
                 } else {
                     $this->info('Nothing sent');
                 }
             }
         }
     }
 }
コード例 #19
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request, Group $group)
 {
     $validator = Validator::make($request->all(), ['published' => 'required|date', 'title' => 'required|min:3|max:255', 'content' => 'required|min:10', 'comments' => 'required|boolean', 'help' => 'boolean']);
     if ($validator->passes()) {
         $help = $request->help === 1 && \App\Group::find($group_id)->service_provider === 1;
         // TBD check user has write access to group
         $article = $group->articles()->create(['allow_comments' => (bool) $request->comments, 'help' => (bool) $help, 'user_id' => Auth::user()->id, 'published_at' => $request->published]);
         $content = $this->createArticleContent($article, $request, 'New Article');
         if ($content) {
             $article->content_id = $content->id;
             $article->save();
             return $this->respondWithItem($article, new ArticleTransformer());
         } else {
             return $this->errorInternalError('Could not create article');
         }
     } else {
         return $this->errorValidation($validator->messages());
     }
 }
コード例 #20
0
 public function testManyActivitiesCanBeAddedToUsers()
 {
     factory(App\Group::class, 4)->create()->each(function ($g) {
         for ($i = 0; $i < 5; $i++) {
             $g->users()->save(factory(App\User::class)->make(), ['role' => 'member']);
         }
         $g->users()->save(factory(App\User::class)->make(), ['role' => 'leader']);
     });
     factory(App\Activity::class, 5)->create();
     $group = Group::find(1);
     $activity = Activity::find(1);
     $stuff = array('activityId' => $activity->id, 'group' => $group->id);
     foreach ($group->users as $user) {
         $stuff[$user->id] = 'true';
     }
     $request = Request::create('/', 'POST', $stuff);
     $this->controller->addMany($request);
     foreach ($group->users as $user) {
         $this->seeInDatabase('activity_user', ['activity_id' => $activity->id, 'user_id' => $user->id]);
     }
 }
コード例 #21
0
 public function showActivityEventPlannerView()
 {
     $activitiesIds = session('activities');
     $activities = [];
     foreach ($activitiesIds as $id) {
         array_push($activities, Activity::find($id));
     }
     $eventPatternIds = session('eventPatterns');
     $eventPatterns = [];
     foreach ($eventPatternIds as $id) {
         array_push($eventPatterns, EventPattern::find($id));
     }
     $groupId = session('group');
     $group = Group::find($groupId);
     $groups = Group::all();
     $events2 = EventOccurrence::with('activities')->get();
     $events = $events2->filter(function ($item) use($groupId) {
         return $item->group->id === $groupId;
     });
     return view('ActivityPlanning/activityEventPlanner', compact('activities', 'eventPatterns', 'groups', 'group', 'events', 'groupId'));
 }
コード例 #22
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public static function index($id)
 {
     $data = Con::pagination($id);
     $challenge = Challenge::find($id);
     $challenge_name = $challenge->name;
     foreach ($data as $d) {
         $data = Groupsta::where('group_id', '=', $d['id'])->select('round_id')->get()->toArray();
         $arrayBuild = CombatRoundController::buildArray($data);
         $valore = CombatRoundController::funPru($arrayBuild);
         $dataGroup = Group::find($d['id']);
         foreach ($valore as $val) {
             $dat = CombatRound::where('group_id', '=', $d['id'])->where('versus_one', '=', $val['0'])->where('versus_two', '=', $val['1'])->where('challenge_id', '=', $id)->get();
             if (count($dat) <= 0) {
                 CombatRound::create(['group_id' => $d['id'], 'stage_id' => $dataGroup->stage_id, 'versus_one' => $val['0'], 'versus_two' => $val['1'], 'challenge_id' => $d['challenge_id']]);
             }
         }
     }
     $data = CombatRoundController::getRoundInfo($id);
     if (!ENV('DEVELOP')) {
         return view('combatround.index', compact('data', 'challenge_name'));
     }
 }
コード例 #23
0
ファイル: GroupController.php プロジェクト: ppawlas/swop
 public function update(Request $request, $id)
 {
     if (Gate::denies('managerOnly')) {
         abort(403);
     }
     $input = $request->all();
     $result = DB::transaction(function ($input) use($input, $id) {
         $group = Group::find($id);
         if ($group) {
             $group->name = $input['name'];
             $group->users()->detach();
             foreach ($input['users'] as $user) {
                 $group->users()->attach($user['id']);
             }
             $group->indicators()->detach();
             foreach ($input['indicators'] as $indicator) {
                 $group->indicators()->attach($indicator['id']);
             }
         }
         $group->save();
         return $group;
     });
     return $result;
 }
コード例 #24
0
 /**
  * Updates the specified User node in the graph
  *
  * @param $name Node 'name' label to match when saving a User
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($name)
 {
     // Get the request params
     $userUpdate = Request::all();
     // Find the matching User node
     $user = User::whereName($name)->first();
     // Find the matching Group with which this User is associated
     $newGroup = Group::find($userUpdate['group']);
     // If we've changed the user group, then detach the existing group
     // relation and create a new relation in its place.
     if ($newGroup['id'] != $user->group->id) {
         $user->group()->detach();
         $user->group()->save($newGroup);
     }
     // Find the matching Country with which this User is associated
     $newCountry = Country::find($userUpdate['country']);
     // Detach the previous nationality relation, and save the new one
     // TODO: don't detach and save unless it's changed!
     $user->country()->detach();
     $user->country()->save($newCountry);
     // Update the User details
     $user->update($userUpdate);
     return redirect()->action('Admin\\UserController@index')->with('status', 'User has been updated.');
 }
コード例 #25
0
 public function saveEvent(Request $request)
 {
     $this->validate($request, ['group_id' => 'required|exists:groups,id', 'event' => 'required|array']);
     $group = Group::find($request->input('group_id'));
     $event = $group->events()->create($request->input('event'));
     return $event;
 }
コード例 #26
0
ファイル: GroupController.php プロジェクト: acmadi/sp2d
 public function CreateUpdatePermission(Request $request, $hash)
 {
     // dd($hash);
     // print_r($request->get('data')[0]);
     // dd($request->all());
     // $user =Akses::find(16);
     foreach ($request->all()['data'] as $data) {
         // dd($data);
         // $akses=Akses::find($data['id']);
         // foreach ($datas as $key => $data) {
         // echo $key.'---';
         // echo "<pre> $i";
         // var_dump($data);
         // $group_id=$data['group_id'];
         // $table_id=$data['table_id'];
         $data['akses'] = isset($data['akses']) ? '1' : '0';
         // if (isset($data['akses'])) {
         //     # code...
         // }
         if (!empty($data['id'])) {
             $akses = Akses::find($data['id']);
             if ($akses) {
                 // unset($data['id']);
                 // echo "##Update##";
                 // print_r($data);
                 $akses->group_id = $this->hashids->decode($data['group_id'])[0];
                 $akses->akses = $data['akses'];
                 $akses->arr_id = $data['arr_id'];
                 $akses->table_id = $data['table_id'];
                 $akses->save();
             }
         } else {
             // dd($data);
             unset($data['id']);
             // $group=$data['group_id'];
             $data['group_id'] = $this->hashids->decode($data['group_id'])[0];
             // echo "##create##";
             Akses::create($data);
         }
         // }
     }
     // dd($hash);
     // $groupName=Group::find($this->hashids->decode($hash));
     // dd($this->hashids->decode($hash));
     $groupName = Group::find($this->hashids->decode($hash)[0]);
     // $tableName=\Config::get('tables')[ $table_id];
     // var_dump($tableName);
     // dd($groupName);
     $data['msg'] = 'Update akses menu Group : ' . $groupName['name'] . '  selesai';
     $data['code'] = '200';
     return $data;
     // exit();
     // return redirect()->back();
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Inscription  $inscription
  * @return Response
  */
 public function update(Inscription $inscription, Request $request)
 {
     $this->authorize('edit', $inscription);
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input.
     //$inscription = Inscription::findOrFail($id);
     if (!isset($request['step']) || $request['step'] < 1 && $request['step'] > 3) {
         return redirect('inscription.create');
     }
     //actualizar estudiante
     if ($request['step'] == 1) {
         $inscription->student->update($request->all());
         //actualizar grupo
         if ($inscription->group_id != $request['group_id']) {
             //buscar grupo anterior
             $inscription->group->students()->detach($inscription->student);
             //agregamos al nuevo
             $inscription->group_id = $request['group_id'];
             $group = Group::find($request['group_id']);
             $group->students()->attach($inscription->student);
         }
         $inscription->update($request->all());
         //mostrar paso 2
         return view('inscription.step2', compact('inscription'));
     } elseif ($request['step'] == 2) {
         if ($request['tutor_id'] != 0 && $inscription->tutor_id != $request['tutor_id']) {
             $inscription->student->tutor_id = $request['tutor_id'];
             $inscription->student->save();
         }
         if ($inscription->student->tutor) {
             $inscription->student->tutor->update($request->all());
         } else {
             $inscription->student->tutor_id = Tutor::create($request->all())->id;
             $inscription->student->save();
         }
         //mostrar paso 3 ...
         return view('inscription.step3', compact('inscription'));
     } elseif ($request['step'] == 3) {
         if ($inscription->student->document) {
             $request['student_id'] = $inscription->student_id;
             $inscription->student->document->update($request->all());
         } else {
             $request['student_id'] = $inscription->student_id;
             Document::create($request->all());
             return redirect()->route('inscription.show', [$inscription]);
         }
     }
     return redirect('inscription');
 }
コード例 #28
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $groups = Group::find($id);
     $groups->user()->detach();
     $groups->feature()->detach();
     $groups->delete('');
     return redirect()->route('groups.index')->with('messageOk', 'Delete group successfully!');
 }
コード例 #29
0
ファイル: GroupsController.php プロジェクト: vespan/grupr
 /**
  * Remove the specified resource from storage.
  *
  * @param Group|int $id
  * @return Response
  * @throws \Exception
  */
 public function destroy($id)
 {
     $group = Group::find($id);
     $group->delete();
     return redirect('grupper');
 }
コード例 #30
0
 public function update($idbp, $idb, $id)
 {
     $input = Request::all();
     if (Request::has('bp')) {
         $bp = BusinessPlan::all();
         $bp->update($input);
         return redirect("businessplan/" . $idbp . "");
     }
     if (Request::has('goal')) {
         $goal = Goal::findOrFail($id);
         $goal->update($input);
     }
     if (Request::has('objective')) {
         $objective = Objective::findOrFail($id);
         $input['group'] += 1;
         $objective->update($input);
     }
     if (Request::has('action')) {
         $collabs = "";
         if (array_key_exists('collaborators-groups', $input)) {
             foreach ($input['collaborators-groups'] as $x) {
                 $group = Group::find($x);
                 if ($group != null) {
                     $collabs .= Group::find($x)->name;
                     $collabs .= ", ";
                 } else {
                     $collabs .= "";
                 }
             }
         }
         if (array_key_exists('collaborators-users', $input)) {
             foreach ($input['collaborators-users'] as $x) {
                 $user = User::find($x);
                 if ($user != null) {
                     $collabs .= User::find($x)->name;
                     $collabs .= ", ";
                 } else {
                     $collabs .= "";
                 }
             }
         }
         $collabs = rtrim($collabs, ", ");
         $input['collaborators'] = $collabs;
         //return  $input['collaborators'];
         $action = Action::findOrFail($id);
         $input['group'] += 1;
         $input['userId'] += 1;
         $action->update($input);
     }
     if (Request::has('task')) {
         $collabs = "";
         if (array_key_exists('collaborators-groups', $input)) {
             foreach ($input['collaborators-groups'] as $x) {
                 $group = Group::find($x);
                 if ($group != null) {
                     $collabs .= Group::find($x)->name;
                     $collabs .= ", ";
                 } else {
                     $collabs .= "";
                 }
             }
         }
         if (array_key_exists('collaborators-users', $input)) {
             foreach ($input['collaborators-users'] as $x) {
                 $user = User::find($x);
                 if ($user != null) {
                     $collabs .= User::find($x)->name;
                     $collabs .= ", ";
                 } else {
                     $collabs .= "";
                 }
             }
         }
         $collabs = rtrim($collabs, ", ");
         $input['collaborators'] = $collabs;
         $task = Task::findOrFail($id);
         $input['group'] += 1;
         $input['userId'] += 1;
         $task->update($input);
     }
     return redirect("businessplan/" . $idbp . "");
 }