Example #1
0
 public function Usuarios($action = null)
 {
     if (isset($action)) {
         if ($action == "create") {
             $data = User::firstOrCreate(Input::except("_token", "_user"));
             return $respuesta = array('Record' => $data, 'Result' => "OK");
         }
         if ($action == "edit") {
             User::where("id", Input::get("id"))->update(Input::except("_token", "id", "_user"));
             return $respuesta = array('Record' => User::find(Input::get('id')), 'Result' => "OK");
         }
         if ($action == "remove") {
             User::where('id', Input::get("id"))->delete();
             return '{"Result":"OK"}';
         }
         if ($action == "list") {
             $Records = User::get();
             $respuesta = array('Records' => $Records, 'Result' => "OK");
             return json_encode($respuesta);
         }
         if ($action == "empresas") {
             $nulos = DB::table('empresas')->select(DB::raw("'NO POSEE' as DisplayText, NULL as Value"));
             $respuesta = DB::table('empresas')->select("nombre as DisplayText", "id as Value")->union($nulos)->orderby('value', 'asc')->distinct()->get();
             return "var opciones=" . json_encode($respuesta);
         }
     }
 }
 public function testGet()
 {
     $users = User::get();
     $this->assertEquals(3, $users->count());
     $users = User::where('id', '>', 1)->get();
     $this->assertEquals(2, $users->count());
     // test chunk
     User::chunk(2, function ($users) {
         foreach ($users as $user) {
             $this->assertInternalType('int', $user->id);
         }
     });
     User::chunk(1, function ($users) {
         $this->assertInstanceOf('Illuminate\\Support\\Collection', $users);
     });
     // test find with query builder
     $user = User::where('id', '>', 1)->find(1);
     $this->assertNull($user);
     $user = User::where('id', '>', 1)->find(2);
     $this->assertEquals(2, $user->id);
     // test first without query builder
     $user = User::first();
     $this->assertInstanceOf('App\\User', $user);
     // test retrieving aggregates
     $max_id = User::max('id');
     $this->assertGreaterThanOrEqual(3, $max_id);
     $count = User::count();
     $this->assertGreaterThanOrEqual(3, $count);
     $sum = User::sum('id');
     $this->assertGreaterThanOrEqual(6, $sum);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (Team::get() as $te) {
         RelationTeUs::create(['team_id' => $te->id, 'user_coach_id' => $faker->numberBetween(1, count(User::get())), 'user_coach_aux_id' => $faker->numberBetween(1, count(User::get())), 'user_coordinador_id' => $faker->numberBetween(1, count(User::get())), 'user_cap_id' => $faker->numberBetween(1, count(User::get())), 'user_int2_id' => $faker->numberBetween(1, count(User::get())), 'user_int3_id' => $faker->numberBetween(1, count(User::get())), 'user_int4_id' => $faker->numberBetween(1, count(User::get()))]);
     }
 }
Example #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $titulo = 'Usuarios';
     $users = User::get();
     //dd($users);
     return view('painel.tables', compact('users', 'titulo'));
 }
Example #5
0
 function user()
 {
     $data = User::get();
     //       print_r($data);
     //       die;
     return view('user.home')->with('users', $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $users = User::get();
     $heading = 'User Management';
     return view('admin.users', array('users' => $users, 'heading' => $heading));
 }
Example #7
0
 public function userPosts()
 {
     $posts = \App\Posts::where('user_id', '=', \Auth::user()->id)->orderBy("created_at", "desc")->get();
     $search_info = "";
     $data = array('posts' => $posts, 'search_info' => \Auth::user()->name . '\'s posts', 'users' => \App\User::get());
     return view('home')->with($data);
 }
Example #8
0
 /**
  * Display users management view.
  *
  * @return \Illuminate\Http\Response
  */
 public function users()
 {
     $users = User::all()->count();
     $requests = collect(Invitation::where('status', 1)->orWhere('status', 2)->orWhere('status', 4)->get());
     $lastest_users = User::get()->take(7);
     return view('sys/pages/users/view-all')->with(['users' => $users, 'requests' => $requests->count(), 'latest_users' => $lastest_users]);
 }
Example #9
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     if (Request::isMethod('get')) {
         $this->data['items'] = User::get();
         return view('pages.user.index', $this->data);
     } elseif (Request::isMethod('post')) {
     }
 }
Example #10
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $rodeos = Rodeos::paginate(10);
     //print_r($animales); die();
     $potreros = Potreros::get()->all();
     $users = User::get()->all();
     return view('rodeos.index', ['rodeos' => $rodeos, 'potreros' => $potreros, 'users' => $users]);
 }
Example #11
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index($id)
 {
     $this->data['users'] = User::get();
     $this->data['artikel'] = Artikel::where('kategori_id', '=', $id)->get();
     $this->data['kategori'] = Kategori::find($id);
     $this->data['id_kategori'] = $id;
     return view('admin.article.manage', $this->data);
 }
Example #12
0
 public function run()
 {
     $faker = Faker::create();
     $users = User::get();
     #Category
     foreach (range(1, 20) as $void) {
         Log::create(['user_id' => $users->random(1)->id, 'type' => $faker->text(10), 'source_id' => $faker->numberBetween(50, 1000000), 'details' => $faker->text(50)]);
     }
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     $users = User::get();
     // Get all the current users and associate them with manchester (MCR).
     foreach ($users as $user) {
         $user->city_id = null;
         $user->save();
     }
 }
Example #14
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     $users = User::get()->lists('id')->all();
     $products = Product::get()->lists('id')->all();
     foreach (range(1, 30) as $index) {
         Bid::create(['amount' => $faker->randomNumber(), 'user_id' => $faker->randomElement($users), 'product_id' => $faker->randomElement($products)]);
     }
 }
Example #15
0
 public function checkout()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     $shoppingCarts = customer_item::where('customer_id', '=', \Auth::user()->id)->get();
     // get all selected shopping cart product from customer_items table
     $users = User::get();
     return view('Pages.checkout', compact('users', 'shoppingCarts'));
 }
 public function run()
 {
     $faker = Faker::create();
     $actions = ActionType::get();
     $users = User::get();
     #Category
     foreach (range(1, 20) as $void) {
         Comment::create(['user_id' => $users->random(1)->id, 'action_type_id' => $actions->random(1)->id, 'source_id' => $faker->numberBetween(50, 1000000), 'comment' => $faker->text(50)]);
     }
 }
Example #17
0
 public function getUsuarios(Request $request)
 {
     $users = User::get();
     $view = View::make('adminSuper.usuariosComunes')->with(['users' => $users]);
     if ($request->ajax()) {
         $sections = $view->renderSections();
         $response = Response::json(['success' => true, 'data' => $sections['usuarios']], 200);
     } else {
         $response = $view;
     }
     return $response;
 }
 public function view($projectId)
 {
     $param['pageNo'] = 1;
     $param['projectId'] = $projectId;
     $param['tasks'] = TaskModel::where('project_id', $projectId)->orderBy('sequence')->paginate(10);
     $param['users'] = UserModel::get();
     $param['projectId'] = $projectId;
     if (Session::has('alert')) {
         $param['alert'] = Session::get('alert');
     }
     return View::make('company.project.view')->with($param);
 }
Example #19
0
 public function boollogin()
 {
     $Inputdata = array("username" => Input::get("username"), "password" => Input::get("password"));
     foreach (User::get() as $user) {
         if (strtolower($user->acc) == strtolower($Inputdata["username"]) && $user->pass == $Inputdata["password"]) {
             Session::put("login", "true");
             Session::put("nameuser", $user->name);
             return true;
         }
     }
     Session::put("login", "false");
     return false;
 }
Example #20
0
 public function index()
 {
     $tab = 'dashboard';
     $users = User::get();
     $usersCount = $users->count();
     $activeUsers = $users->where('active', 1)->count();
     $inactiveUsers = $usersCount - $activeUsers;
     $roles = Role::get();
     $rolesCount = $roles->count();
     $usersWithRole = DB::table('role_user')->count();
     $permissionsCount = Permission::get()->count();
     return view('admin.dashboard', compact('tab', 'usersCount', 'activeUsers', 'inactiveUsers', 'rolesCount', 'usersWithRole', 'permissionsCount'));
 }
 public function sharing($id)
 {
     $entry = FileRecord::where('id', '=', $id)->firstOrFail();
     $rawSharing = (array) json_decode($entry->sharing);
     $docType = $entry->doc_type_id;
     $users = User::get();
     $sharedUsers = (array) $rawSharing['users'];
     $departments = Department::get();
     $sharedDepartments = (array) $rawSharing['departments'];
     $editors = (array) json_decode($entry->user_editor);
     $mass = $rawSharing['mass'];
     return view('modals.sharingModal')->with('sharedUsers', $sharedUsers)->with('editors', $editors)->with('docType', $docType)->with('users', $users)->with('departments', $departments)->with('sharedDepartments', $sharedDepartments)->with('mass', $mass)->with('id', $id);
 }
 public function newUser(CreateUserRequest $request)
 {
     $input = $request->all();
     User::create($input);
     if (Session::get('errors') == "") {
         $errorCode = 0;
         $errorMessage = null;
     }
     \Session::flash('key', $input['_token']);
     $id = User::get()->where('UserName', $input['UserName'])->where('Password', $input['Password']);
     $showId = last(array_flatten($id))['id'];
     return $array = ['ErrorCode' => $errorCode, 'ErrorMessage' => $errorMessage, 'Data' => ['UserId' => $showId, 'SessionId' => Session::get('key'), 'UserName' => $input['UserName']]];
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('users', function (Blueprint $table) {
         $table->string('slug')->nullable();
     });
     // Get records from old column.
     $users = User::get();
     // Get all the old users first and last name and smush them together into a username
     foreach ($users as $user) {
         $first_name = $user->name_first;
         $last_name = $user->name_last;
         $user->username = $first_name . ' ' . $last_name;
         $user->save();
     }
 }
Example #24
0
 public function run()
 {
     $faker = Faker::create();
     $users = User::get()->toArray();
     foreach ($users as $user) {
         //dd($user);
         foreach (range(1, 10) as $void) {
             $sender_id = $user['id'];
             while ($sender_id == $user['id']) {
                 $sender_id = $faker->randomElement($users)['id'];
             }
             Notice::create(['user_id' => $user['id'], 'sender_id' => $sender_id, 'source_id' => $faker->numberBetween(50, 1000000), 'title' => $faker->text(50), 'message' => $faker->text(150), 'status' => $faker->randomElement(['read', 'unread', 'new']), 'type' => $faker->randomElement(['info', 'danger', 'warning', 'success'])]);
         }
     }
 }
 public function home(Content $content, Ticket $ticket, User $user, Application $application, BusinessUnit $businessUnit)
 {
     //FIND USERS WITH SUBMITTED TICKETS
     $users_with_tickets = User::has('tickets')->get();
     //USERS WHO ARE NOT ADMIN
     $non_admin_users = $user->notAdmin()->get();
     $admin_users = $user->admins()->get();
     $tickets_all = $ticket->all()->count();
     $tickets_c = $ticket->completed()->get()->count();
     $prj_brief_records = $content->latest()->brief()->get();
     $prj_notes_records = $content->latest()->notes()->get();
     $status_records = $content->latest()->status()->get();
     $applications = $application->get();
     $users = $user->get();
     return view('pages.home', compact('prj_notes_records', 'status_records', 'tickets_c', 'tickets_all', 'users_with_tickets', 'applications', 'non_admin_users', 'admin_users', 'users'));
 }
Example #26
0
 public function run()
 {
     $faker = Faker::create();
     $users = User::get();
     $products = Product::get();
     for ($i = 0; $i < 10; $i++) {
         $user = $users->random(1);
         $status = $faker->randomElement(['open', 'paid', 'pending', 'installed', 'cancelled']);
         $order = Order::create(['user_id' => $user->id, 'status' => $status, 'end_date' => $status == 'installed' || $status == 'cancelled' ? $faker->dateTime() : null]);
         $random = $faker->numberBetween(1, 2);
         for ($y = 0; $y < $random; $y++) {
             $product = $products->random(1);
             OrderDetail::create(['order_id' => $order->id, 'product_id' => $product->id, 'price' => $product->price, 'quantity' => 1]);
         }
     }
 }
 /**
  * return json user
  */
 public function getUsers($id)
 {
     if ($id == "pm") {
         $idus = UserGroup::distinct()->where("group_id", "=", 6)->orWhere("group_id", "=", 11)->groupBy('user_id')->get(array("user_id"));
         $user = array();
         foreach ($idus as $key) {
             array_push($user, User::get(array("fullname", "id"))->find($key['user_id']));
         }
         return json_encode($user);
     } else {
         $i = UserGroup::distinct()->where('group_id', '<>', 11)->groupBy('user_id')->get();
         $u = array();
         foreach ($i as $key) {
             array_push($u, User::get(array("fullname", "id"))->find($key['user_id']));
         }
         return json_encode($u);
     }
 }
 public function EV3()
 {
     $faker = Faker::create();
     $data = CombatRound::where('challenge_id', '=', 1)->get();
     foreach ($data as $d) {
         $score1 = $faker->numberBetween($min = 2, $max = 3);
         $score2 = $faker->numberBetween($min = 2, $max = 3);
         if ($score1 == 3 && $score2 == 3) {
             $score1 = $score1 - 1;
         }
         if ($score1 == 2 && $score2 == 2) {
             $score2 = $score2 + 1;
         }
         if ($score1 > $score2) {
             $win = $d['versus_one'];
         } else {
             if ($score2 > $score1) {
                 $win = $d['versus_two'];
             }
         }
         Sumo::create(['combat_id' => $d['id'], 'team_id_win' => $win, 'team_id_one' => $d['versus_one'], 'scort_team_one' => $score1, 'firm_team_one' => $faker->numberBetween($min = 1, $max = count(User::get())), 'team_id_two' => $d['versus_two'], 'scort_team_two' => $score2, 'firm_team_two' => $faker->numberBetween($min = 1, $max = count(User::get()))]);
     }
 }
Example #29
0
* Institucional
*/
Route::get('termos', function () {
    return view('site.termos');
});
Route::get('newsletter', function () {
    return view('site.mail');
});
Route::get('privacidade', function () {
    return view('site.privacidade');
});
/**
* API
*/
Route::get('api/users', ['middleware' => 'cors', function () {
    return \Response::json(\App\User::get(), 200);
}]);
Route::get('api/markers', ['middleware' => 'cors', function () {
    return \Response::json(\App\Mark::get(), 200);
}]);
Route::post('api/markers', ['middleware' => 'cors', function () {
    return \Response::json(\App\Mark::get(), 200);
}]);
Route::get('api/contributors', ['middleware' => 'cors', function () {
    return \Response::json(\App\Contributor::get(), 200);
}]);
Route::get('api/posts', ['middleware' => 'cors', function () {
    return \Response::json(\App\Posts::get(), 200);
}]);
Route::get('api/news', ['middleware' => 'cors', function () {
    return \Response::json(\App\Posts::get(), 200);
 public function edit($id)
 {
     return view('playthrough.edit', ['players' => User::get(['id', 'nickname', 'profile_photo']), 'games' => Game::get(['id', 'name', 'photo']), 'playthrough' => Playthrough::find($id), 'p_id' => $id]);
 }