/**
  * Execute the job.
  *
  * @return void
  */
 public function handle(Mailer $mail)
 {
     $group = $this->ticket->group_id;
     $customers = Group::where('id', $group)->first()->customers()->get();
     $_customers = [];
     foreach ($customers as $customer) {
         $_customers[] = $customer->id;
     }
     $sys_name = Settings::where('name', 'sys_name')->first();
     $user = User::whereIn('customer_id', $_customers)->get();
     foreach ($user as $_user) {
         $mail->send('emails.updateticket', ['user' => $_user, 'ticket' => $this->ticket, 'response' => $this->response, 'sys_name' => $sys_name], function ($m) use($_user) {
             $m->to($_user->email, $_user->first_name . ' ' . $_user->last_name)->subject('Ticket updated - ' . $this->ticket->track_id . ' [' . $this->ticket->status->name . ']');
             if (count($this->response->attachments()->get()) > 0) {
                 foreach ($this->response->attachments as $attachment) {
                     $m->attach(storage_path() . '/attachments/' . $this->ticket->id . '/' . $attachment->name);
                 }
             }
         });
     }
     // Cleanup variables
     unset($this->ticket);
     unset($this->response);
     unset($group);
     unset($customers);
     unset($user);
     unset($sys_name);
     unset($_customers);
 }
예제 #2
0
 /**
  * @param null $user
  * @param int $howMany
  * @return mixed
  */
 public function groupsForUser($user = null, $howMany = 1)
 {
     if ($user != null) {
         return Group::where('user_id', $user->id)->simplePaginate($howMany);
     }
     return Group::where('user_id', $this->user()->id)->simplePaginate($howMany);
 }
예제 #3
0
 public function getSeries($slug)
 {
     $group = Group::where('slug', 'like', $slug)->first();
     if (is_null($group)) {
         return false;
     }
     return $group->toArray();
 }
예제 #4
0
파일: Group.php 프로젝트: VolodyaP/wapp
 /**
  * @return string
  */
 public static function buildGroupUsersCountStatistic()
 {
     $groups = Group::where('name', '!=', 'admin_group')->get();
     $data = array();
     foreach ($groups as $k => $group) {
         $data[$k]['group'] = $group->name;
         $data[$k]['staffCount'] = count($group->users);
     }
     return json_encode($data);
 }
 public static function pagination($id)
 {
     $data = Group::where('challenge_id', '=', $id)->get()->toArray();
     for ($i = 0; $i <= count($data) - 1; $i++) {
         $dr = Groupsta::where('group_id', '=', $data[$i]['id'])->join('rb_rounds', 'rb_rounds.id', '=', 'rb_group_stage.round_id')->join('rb_team', 'rb_team.id', '=', 'rb_rounds.team_id')->select('rb_rounds.*', 'rb_team.name as nombre_equipo', 'rb_team.name_altered as nombre_alterno', 'rb_team.gender as genero', 'rb_group_stage.id as id_g_s')->get()->toArray();
         $data[$i]['data_team'] = [];
         $data[$i]['data_team'] += $dr;
     }
     return $data;
 }
예제 #6
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function postSearch()
 {
     $query_term = \Request::input('search-term');
     error_log('Search ' . json_encode($query_term));
     //filter types
     $users = \App\User::where('last_name', 'LIKE', "%{$query_term}%")->get();
     $groups = \App\Group::where('name', 'LIKE', "%{$query_term}%")->get();
     error_log('>>> Le search users' . json_encode($groups));
     $bodyclass = "app-search";
     return view('site.search.index', compact('bodyclass', 'users', 'groups'));
 }
예제 #7
0
 /**
  * Generates the group listing for the view.
  *
  * @param  \Illuminate\Contracts\View\View $view
  * @return void
  */
 public function compose(View $view)
 {
     $active_group = null;
     $active_project = null;
     if (isset($view->project) && !$view->project->is_template) {
         $active_group = $view->project->group_id;
         $active_project = $view->project->id;
     }
     $groups = Group::where('id', '<>', Template::GROUP_ID)->orderBy('name')->get();
     $view->with('active_group', $active_group);
     $view->with('active_project', $active_project);
     $view->with('groups', $groups);
 }
 public function index(Request $request)
 {
     if ($request->has('query')) {
         $query = $request->get('query');
         // build a list of public groups and groups the user has access to
         $my_groups = Auth::user()->groups()->orderBy('name')->get();
         $my_groups_id = [];
         // using this array we can adjust the queries after to only include stuff the user has
         // might be a good idea to find a clever way to build this array of groups id :
         foreach ($my_groups as $the_group) {
             $my_groups_id[$the_group->id] = $the_group->id;
         }
         $public_groups = \App\Group::where('group_type', \App\Group::OPEN)->get();
         $public_groups_id = [];
         // using this array we can adjust the queries after to only include stuff the user has
         // might be a good idea to find a clever way to build this array of groups id :
         foreach ($public_groups as $the_group) {
             $public_groups_id[$the_group->id] = $the_group->id;
         }
         $allowed_groups = array_merge($my_groups_id, $public_groups_id);
         $groups = \App\Group::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->orderBy('name')->get();
         $users = \App\User::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->orderBy('name')->with('groups')->get();
         $discussions = \App\Discussion::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->whereIn('group_id', $allowed_groups)->orderBy('updated_at', 'desc')->with('group')->get();
         $actions = \App\Action::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->whereIn('group_id', $allowed_groups)->with('group')->orderBy('updated_at', 'desc')->get();
         $files = \App\File::where('name', 'like', '%' . $query . '%')->whereIn('group_id', $allowed_groups)->with('group')->orderBy('updated_at', 'desc')->get();
         $comments = \App\Comment::where('body', 'like', '%' . $query . '%')->with('discussion.group')->orderBy('updated_at', 'desc')->get();
         // set in advance which tab will be active on the search results page
         $groups->class = '';
         $discussions->class = '';
         $actions->class = '';
         $users->class = '';
         $comments->class = '';
         $files->class = '';
         // the order of those ifs should match the order of the tabs on the results view :-)
         if ($groups->count() > 0) {
             $groups->class = 'active';
         } elseif ($discussions->count() > 0) {
             $discussions->class = 'active';
         } elseif ($actions->count() > 0) {
             $action->class = 'active';
         } elseif ($users->count() > 0) {
             $users->class = 'active';
         } elseif ($comments->count() > 0) {
             $comments->class = 'active';
         } elseif ($files->count() > 0) {
             $files->class = 'active';
         }
         return view('search.results')->with('groups', $groups)->with('users', $users)->with('discussions', $discussions)->with('files', $files)->with('comments', $comments)->with('actions', $actions)->with('query', $query);
     }
 }
예제 #9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $group_id = \App\Group::where('name', '=', 'Flexibility')->pluck('id');
     DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Gentle Yoga', 'description' => 'Hatha Yoga, Gentle flow. 90 minutes.', 'days' => 'M W Sa', 'duration_minutes' => '90', 'default_time' => '1700', 'group_id' => $group_id]);
     $group_id = \App\Group::where('name', '=', 'Fitness')->pluck('id');
     DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Fun Run', 'description' => 'Run with Pacers group from Clarendon Starbucks.', 'days' => 'T Th', 'duration_minutes' => '60', 'default_time' => '0500', 'group_id' => $group_id]);
     $group_id = \App\Group::where('name', '=', 'Work')->pluck('id');
     DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Work Hours', 'description' => 'Normal work hours.', 'days' => 'M Tu W Th F', 'duration_minutes' => '480', 'default_time' => '0800', 'group_id' => $group_id]);
     $group_id = \App\Group::where('name', '=', 'Recreation')->pluck('id');
     DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Happy Hour', 'description' => 'Hang out with work folks.', 'days' => 'F', 'duration_minutes' => '120', 'default_time' => '1630', 'group_id' => $group_id]);
     $group_id = \App\Group::where('name', '=', 'Family')->pluck('id');
     DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Playground', 'description' => 'Take kids to park.', 'days' => 'Su', 'duration_minutes' => '120', 'default_time' => '1300', 'group_id' => $group_id]);
     $group_id = \App\Group::where('name', '=', 'Sleep')->pluck('id');
     DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Sleep 7 Hours', 'description' => 'Sleep.', 'days' => 'M Tu W Th F Sa Su', 'duration_minutes' => '420', 'default_time' => '2200', 'group_id' => $group_id]);
 }
 public function joinGroup($group_id, Request $request)
 {
     $i_password = $request->input('password');
     $group = \App\Group::where('id', '=', $group_id)->get()[0];
     //---------------------
     if ($i_password !== $group->password) {
         return redirect(url('/join-group/' . $group_id));
     } else {
         $p_user_ids = $group->user_ids;
         $model = \App\Group::find($group_id);
         $model->user_ids = $p_user_ids . "[" . auth()->user()->id . "]";
         $model->save();
         // redirect to user's home page .................
         return redirect('/home');
     }
 }
예제 #11
0
 public function removegroup()
 {
     $groupname = Input::get('selectgroup_name');
     $groups = Group::where('group_name', $groupname)->get();
     foreach ($groups as $group) {
         $offered_to = $group->group_code;
         $batchcourses = Course_detail::where('offered_to', $offered_to)->get();
         foreach ($batchcourses as $batchcourse) {
             //delete schedules data
             Schedule::where('course_code', $batchcourse->id)->delete();
             Time_table::where('course_code', $batchcourse->id)->delete();
         }
         // delete class data
         Course_detail::where('offered_to', $offered_to)->delete();
     }
     //delete the group
     Group::where('group_name', $groupname)->delete();
     return view('layouts.removegroup')->with('deletemsg', 'group Deleted');
 }
예제 #12
0
 public function check(Request $request)
 {
     $code = trim($request->get('group-code'));
     $errors = new MessageBag();
     $user = Auth::user();
     if ($code == '') {
         $errors->add('error', "Syötä koodi!");
     } elseif ($user->groups()->where('code', $code)->exists()) {
         $errors->add('error', "Olet jo liittynyt tähän ryhmään.");
     } else {
         $group = Group::where('code', $code)->first();
         if ($group) {
             $user->groups()->attach($group->id);
             return view('groups.manage')->with(['groups' => $user->groups, 'success' => true, 'group' => $group]);
         } else {
             $errors->add('error', "Ryhmää ei löytynyt.");
         }
     }
     return redirect()->back()->with(['groups' => $user->groups])->withInput($request->all())->withErrors($errors);
 }
예제 #13
0
 public function handle()
 {
     $groupname = $this->argument('groupname');
     if ($groupname == '*') {
         $groups = Group::all();
     } else {
         $groups = Group::where('name', '=', $groupname)->get();
     }
     $pattern = $this->argument('pattern');
     foreach ($groups as $group) {
         foreach ($group->users as $user) {
             $files = Cloud::getContents($user->username, false);
             foreach ($files as $file) {
                 $filename = basename($file);
                 if (preg_match($pattern, $filename)) {
                     Cloud::deleteFile($user->username, $filename);
                     echo "Rimosso {$file}\n";
                 }
             }
         }
     }
 }
 /**
  * Renders a map of all users (curently)
  */
 public function map()
 {
     $users = \App\User::where('latitude', '<>', 0)->get();
     $actions = \App\Action::where('start', '>=', Carbon::now())->where('latitude', '<>', 0)->get();
     $groups = \App\Group::where('latitude', '<>', 0)->get();
     // randomize users geolocation by a few meters
     foreach ($users as $user) {
         $user->latitude = $user->latitude + mt_rand(0, 10) / 10000;
         $user->longitude = $user->longitude + mt_rand(0, 10) / 10000;
     }
     return view('dashboard.map')->with('users', $users)->with('actions', $actions)->with('groups', $groups)->with('latitude', 50.8503396)->with('longitude', 4.3517103);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  Inscription  $inscription
  * @return Response
  */
 public function edit(Inscription $inscription)
 {
     $this->authorize('edit', $inscription);
     //$inscription = Inscription::findOrFail($id);
     $semesters = Semester::all()->lists('nombre', 'id');
     $inscription->student['semester_id'] = $inscription->semester_id;
     //incrustar valor para vincularlo a formulario
     $inscription->student['group_id'] = $inscription->group_id;
     $groups = Group::where('semester_id', $inscription->semester_id)->lists('nombre', 'id');
     return view('inscription.edit', compact('inscription', 'semesters', 'groups'));
 }
예제 #16
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function form($type)
 {
     $requesters = Requester::all();
     $allowances = Allowance::all();
     $drivers = User::where('user_type_id', 4)->get();
     $cars = Car::where('status', 3)->get();
     if ($type == 1) {
         $uDts = User::where('user_type_id', 1)->get();
         $match = ['user_type_id' => 1, 'subtype' => 3];
         $uReport = User::where($match)->get();
         $gDts = Group::where('type', 1)->get();
         return view('admin.ots.formdt', compact('requesters', 'allowances', 'uDts', 'gDts', 'uReport', 'drivers', 'cars'));
     } elseif ($type == 2) {
         $gAsrs = Group::where('type', 2)->get();
         $uAsrs = User::where('user_type_id', 2)->get();
         return view('admin.ots.formAsr', compact('requesters', 'allowances', 'uAsrs', 'gAsrs', 'drivers', 'cars', 'jefe'));
     } elseif ($type == 3) {
         $uDts = User::where('user_type_id', 1)->get();
         $match = ['user_type_id' => 1, 'subtype' => 3];
         $uReport = User::where($match)->get();
         $gDts = Group::where('type', 1)->get();
         return view('admin.ots.formBch', compact('requesters', 'allowances', 'uDts', 'gDts', 'uReport', 'drivers', 'cars'));
     }
 }
 public function trainerIndex()
 {
     $this->info['namespace'] = "trainerIndex";
     $groups = Group::where('trainer_id', Auth::user()->id)->get(['training_id', 'count']);
     foreach ($groups as $group) {
         $this->info['group_count'] = $group->count;
         $this->info['trainings'] = Training::where('id', $group->training_id)->get();
     }
     //$this->info['trainings'] = Training::where('area_id', $area_id)->where('subarea_id', $subarea_id)->get();
     $this->info['title'] = "Trainer Panel | " . $this->info['title'];
     return view('trainerPages.home', ['info' => $this->info]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit(Request $request, $id)
 {
     $customer = Customer::where('id', $id)->first();
     $groups = Group::where('active', '1')->get();
     return view('layouts.customer.new', ['customer' => $customer, 'groups' => $groups, 'my_permissions' => $this->my_permissions]);
 }
예제 #19
0
<div class="span9">
				{!! Form::open(array('class'=>'form-horizontal', 'action'=>'CourseDetailController@addclass', 'method'=>'post')) !!} 
						@if ($errors->has())
							<div class="alert alert-danger">
								@foreach($errors->all() as $error)
									{{ $error }}<br>        
								@endforeach
							</div>
						@endif
						<?php 
use App\Course;
use App\Department;
use App\Group;
$courseinfo = Course::orderby('course_code')->lists('course_code', 'course_code');
$value = Department::where('code', $departcode)->orderby('code')->first()->code;
$groupinfo = Group::where('department', $value)->orderby('group_code')->lists('group_code', 'group_code');
?>
						<fieldset>
						<legend>Select Course</legend>
						<div class="control-group">
						{!! Form::label('coursecode', 'Select Course:', array('class' => 'control-label')) !!}
						<div class="controls">
						{!! Form::select('selectcoursecode', $courseinfo) !!}
						</div>
						</div>
						<div class="control-group">
						{!! Form::label('classcode', 'Offer to:', array('class' => 'control-label')) !!}
						<div class="controls">
						{!! Form::select('selectclass',$groupinfo, array('id' => 'selectclass')) !!}
						</div>
						</div>
예제 #20
0
 public function changeAdmin($id)
 {
     $data = Group::where('id', '=', $id)->first();
     if ($data != null) {
         $data->admin_id = Input::get('admin_id');
         $data->save();
         return redirect('/group/' . $id);
     } else {
         return 'some error occured.';
     }
 }
예제 #21
0
 public function removedepartment()
 {
     $departcode = Input::get('selectdepartmentcode');
     //delete schedules data
     $departcourses = Course_detail::where('department_code', $departcode)->get();
     foreach ($departcourses as $departcourse) {
         Schedule::where('course_code', $departcourse->id)->delete();
         Time_table::where('course_code', $departcourse->id)->delete();
     }
     //Delete course details data
     Course_detail::where('department_code', $departcode)->delete();
     //Delete groups data
     Group::where('department', $departcode)->delete();
     //Delete user data
     $departusers = User_detail::where('department', $departcode)->get();
     foreach ($departusers as $departuser) {
         if (User::where('id', $departuser->id)->first()->utype == 0) {
             User_detail::where('id', $departuser->id)->delete();
             User::where('id', $departuser->id)->delete();
         }
     }
     Department::where('code', $departcode)->delete();
     return view('layouts.removedepartment')->with('deletemsg', 'Department Deleted');
 }
예제 #22
0
 public function POST_createGroup(Request $request)
 {
     $validator = Validator::make($request->all(), ['group_name' => 'required', 'routes' => 'required|array']);
     $errors = array();
     if ($validator->fails()) {
         foreach ($validator->errors()->all() as $message) {
             $errors[] = $message;
         }
     }
     if (!count($errors)) {
         $chk = Group::where('name', $request->input('group_name'))->count();
         if ($chk) {
             $errors[] = 'Group `' . $request->input('group_name') . '` already exists.';
         }
     }
     if (!count($errors)) {
         $ar_grps = $request->input('routes');
         $ar_groups = array();
         if (is_array($ar_grps)) {
             foreach ($ar_grps as $key => $grp) {
                 $ar_groups[$grp] = 1;
             }
         }
         // $group = Group::create(array(
         $group = new Group();
         $group->name = $request->input('group_name');
         $group->permissions = json_encode($ar_groups);
         $group->save();
         return redirect(route('group.assign'))->with('STATUS_OK', 'Group `' . $request->input('group_name') . '` successfully created.');
     } else {
         $msg = Helper::arrayToList($errors);
         return redirect(route('group.create'))->with('STATUS_FAIL', $msg)->withInput();
     }
 }
 public static function getindex($id)
 {
     $challenge = Challenge::find($id);
     $challenge_name = $challenge->name;
     $dataGrouptwo = Group::where('challenge_id', '=', $id)->where('active', '=', 1)->get();
     $dataGroup = Group::where('challenge_id', '=', $id)->where('active', '=', 1)->get()->toArray();
     for ($i = 0; $i <= count($dataGroup) - 1; $i++) {
         CombatRoundController::functionTwo(['group_id' => $dataGroup[$i]['id'], 'stage_id' => $dataGroup[$i]['stage_id'], 'challenge_id' => $id]);
     }
     if (!ENV('DEVELOP')) {
         return view('combatround/round2', compact('dataGrouptwo', 'challenge_name'));
     }
 }
예제 #24
0
 protected function _validate($data)
 {
     $errors = ['messages' => [], 'fields' => []];
     $isNewEntry = !array_key_exists('id', $data);
     $codeHasChanged = false;
     if (!$isNewEntry) {
         $group = Group::find($data['id']);
         $codeHasChanged = trim($data['code']) != $group->code;
     }
     if (!@$data['title'] || strlen(trim($data['title'])) == 0) {
         $errors['messages'][] = "Ryhmän nimi puuttuu!";
         $errors['fields']['group_title'] = true;
     }
     if (!@$data['code'] || strlen(trim($data['code'])) == 0) {
         $errors['messages'][] = "Ryhmän liittymiskoodi puuttuu!";
         $errors['fields']['group_code'] = true;
     } elseif ($isNewEntry || $codeHasChanged) {
         if (Group::where('code', trim($data['code']))->exists()) {
             $errors['messages'][] = "Ryhmä samalla liittymiskoodilla on jo olemassa!";
             $errors['fields']['group_code'] = true;
         }
     }
     return (object) ['data' => $data, 'errors' => $errors, 'passed' => count($errors['messages']) == 0];
 }
예제 #25
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //
     $group = new Group();
     $group->where('id', $id)->update(['is_active' => 0]);
     //return Redirect::route('groups.index')->with('flash_notice', 'You are successfully delete!');
 }
예제 #26
0
@section('sidebar')
@include('layouts.include.sidebar')
@endsection

@section('bodycontent')
<div class = "span9">	
					{!! Form::open(array('action'=>'RoutineDisplayController@viewbatchschedule', 'method'=>'post')) !!} 
						<?php 
use App\Department;
use App\User;
use App\User_detail;
use App\Group;
$id = User::where('username', $username)->first()->id;
$department = User_detail::where('id', $id)->first()->department;
$batch = Group::where('department', $department)->orderby('group_code')->lists('group_code', 'group_code');
?>
						<fieldset>
						<legend>Department: {{ $department }}</legend>
						<div class="control-group">
						{!! Form::label('batchcode', 'Select Batch:', array('class' => 'control-label')) !!}
						<div class="controls">
						{!! Form::select('selectbatch', $batch) !!}
						</div>
						<div class="controls">
						{!! Form::hidden('teacherdepart', $department) !!}
						</div>
						</div>
						<div class="control-group">
						<div class="controls">
							{!! Form::submit('Check Routine', ['class'=>'btn btn-primary','value'=>'showbatchschedule', 'name'=>'showbatchschedule']) !!}
예제 #27
0
 public function checkForPages(Request $request)
 {
     $id = $request->gId;
     $return = array();
     $pages = Group::where('id', '=', $id)->first()->getPages();
     // echo '<pre>'.print_r($pages,true).'</pre>';
     // exit();
     $return['result'] = count($pages) > 0 ? false : true;
     return response()->json($return);
 }
예제 #28
0
파일: Group.php 프로젝트: KNein32/KYYT1115
 /**
  * Gets the group the user belongs to
  * @param User $user
  * @return string
  */
 public static function getUserGroup(User $user)
 {
     $group = Group::where('id', $user->groupId)->first();
     return $group->name;
 }
예제 #29
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, ['group_name' => 'required|max:255', 'group_description' => 'required']);
     Group::where('id', $id)->update(['name' => $request->group_name, 'description' => $request->group_description, 'active' => isset($request->is_active) ? 1 : 0]);
     return redirect('/groups');
 }
예제 #30
0
 public function pagination($id)
 {
     $url_actual = "http://" . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
     $url_actual = explode('?', $url_actual);
     $pag = Group::where('rb_groups.challenge_id', '=', $id)->join('rb_challenges', 'rb_challenges.id', '=', 'rb_groups.challenge_id')->join('rb_stages', 'rb_stages.id', '=', 'rb_groups.stage_id')->select('rb_groups.*', 'rb_challenges.name as name_cha', 'rb_stages.name as name_sta')->orderBy('id', 'asc')->paginate(env('PAG'));
     $pag->setPath($url_actual[0]);
     return $pag;
 }