Example #1
0
 /**
  * Return all records/entities for users
  *
  * @return array
  */
 public function listAllUsers()
 {
     $listUsers = array();
     $users = $this->model->all();
     foreach ($users as $usr) {
         $listUsers[$usr->id] = $usr->firstname . ' ' . $usr->lastname;
     }
     return $listUsers;
 }
Example #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     // 提醒迟到用户申辩
     foreach (User::all() as $user) {
         $dashboardController = new DashboardController();
         $overResult = $dashboardController->calculateOvertime($user, date('Y-m-d'), $dashboardController->isWorkday(time()));
         $lateResult = $dashboardController->calculateLatetime($user, $overResult['firstSignIn'], date('Y-m-d'), $dashboardController->isWorkday(time()), '09:30:00');
         $count = $user->complains()->where('startdate', date('Y-m-d'))->where('state', '')->where('type', 'late')->count();
         if ($lateResult['isLate'] && $count == 0) {
             $this->userData = $user;
             Mail::send('emails.late', ['username' => $this->userData->employee->name], function ($message) {
                 $message->from('*****@*****.**', '移动互联签到系统');
                 $message->to($this->userData->employee->email, $this->userData->employee->name);
                 $message->subject('【迟到提醒】');
             });
             // $this->info($user->employee->name.'迟到了');
         }
     }
     // 提醒管理员处理申诉
     $count = Complain::where('state', '')->count();
     if ($count != 0) {
         foreach (User::all() as $user) {
             if ($user->employee->admin) {
                 $this->userData = $user;
                 Mail::send('emails.admin', ['username' => $this->userData->employee->name], function ($message) {
                     $message->from('*****@*****.**', '移动互联签到系统');
                     $message->to($this->userData->employee->email, $this->userData->employee->name);
                     $message->subject('【审核提醒】');
                 });
                 // $this->info('提醒'.$user->employee->name);
             }
         }
     }
 }
 public function competition()
 {
     $users = User::all();
     $competitors = Competitor::all();
     $data = ['competitors' => $competitors];
     return View('competition.competition')->with($data);
 }
Example #4
0
 /**
  * Display the specified resource.
  *
  * @param  int  
  * @return \Illuminate\Http\Response
  */
 public function show()
 {
     $user = User::all();
     $dog = Dog::all();
     //$dog = Dog::find(3);
     return view('users', ['users' => $user, 'dogs' => $dog]);
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $users = User::all();
     foreach ($users as $user) {
         Artisan::call('api-key:generate', ['--user-id' => $user->id]);
     }
 }
 public function store(Request $r)
 {
     if (!User::all()->count()) {
         User::create(['name' => $r['name'], 'email' => $r['email'], 'password' => bcrypt($r['password'])]);
     }
     return redirect(url('/login'));
 }
Example #7
0
 public function index()
 {
     if (\Request::ajax()) {
         return User::all();
     }
     return view('user.index');
 }
 /**
  * Index page
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function index()
 {
     $productsCount = Product::all()->count();
     $categoriesCount = Category::all()->count();
     $usersCount = User::all()->count();
     return view('manage.index', compact('productsCount', 'categoriesCount', 'usersCount'));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $users = User::all();
     foreach ($users as $user) {
         $user->update_status();
     }
 }
 /**
  * Get user object by id
  *
  * @param $id
  *
  * @return null|stdClass
  */
 public static function getInfoById($id)
 {
     $users = User::all()->where('id', intval($id));
     if ($users->count() == 0) {
         return null;
     }
     $user = $users->first();
     $u = new stdClass();
     $u->id = $user->id;
     $u->name = $user->name;
     $u->lop = ClassX::getClassName($user->class);
     $u->email = $user->email;
     $u->type = $user->type;
     if ($u->type == 'teacher') {
         $u->avatar = '0';
     } else {
         $u->avatar = '1';
     }
     if ($u->type == 'student') {
         $u->mssv = $user->msv;
     } else {
         $u->mssv = '';
     }
     return $u;
 }
Example #11
0
 public function getInvite($group)
 {
     $title = "Groups";
     $bodyclass = "app-groups";
     $users = \App\User::all();
     return view('site.groups.invite', compact('title', 'group', 'users', 'bodyclass'));
 }
Example #12
0
 /**
  * Display a home page.
  *
  * @return Response
  */
 public function home()
 {
     $activeUsers = 3;
     $totalUsers = User::all()->count();
     $eventCount = Event::all()->count();
     return view('admin.home', compact('activeUsers', 'totalUsers', 'eventCount'));
 }
 public function getAssigntarget()
 {
     $employee = Employee::all();
     $categories = Event::all();
     $userdetails = User::all();
     $targets = Targetassign::all();
     $deals = Deal::all();
     $userData = array();
     $key = 0;
     foreach ($targets as $target) {
         $achieved = 0;
         $userData[$key]['eventcode'] = $target->Eventcode;
         $userData[$key]['event'] = $target->Eventname;
         $userData[$key]['employee'] = $target->Employeeid;
         $userData[$key]['targetVal'] = $target->Targetvalue;
         foreach ($deals as $deal) {
             if ($target->Eventcode == $deal->Eventcode && $target->Employeeid == $deal->Empid) {
                 $achieved = $achieved + $deal->Dealvalue;
             }
         }
         $userData[$key]['achieved'] = $achieved;
         $userData[$key]['variance'] = $achieved - $target->Targetvalue;
         $userData[$key]['cur'] = $target->Currency;
         $key++;
     }
     return View('approval/assigntarget')->with(array('categories' => $categories, 'employee' => $employee, 'userdata' => $userData, 'targets' => $targets, 'eventtable' => $categories));
 }
 public function is_active($id)
 {
     $page = 'partials.admin-userManagement';
     $users = User::all();
     // Lấy hết tất cả các User có trong table users
     $manage_users = User::simplePaginate(8);
     // Phân trang
     $manage_users->setPath('');
     // Chỉnh đường dẫn URL
     // --------------- //
     $identifier = User::find($id);
     // Tìm user có ID như $id cho vào biến $identifier
     $user_order = Order::where('user_id', '=', $identifier->id)->first();
     ///////////////////////////////////////////////////////////
     // Câu điều kiện kiểm tra nếu người dùng có hóa đơn chưa //
     // thanh toán thì không cho người dùng đó ngưng hoạt động//
     ///////////////////////////////////////////////////////////
     if (count($user_order) == 0 || $user_order->status == 1) {
         if ($identifier->is_active == 1) {
             $identifier->is_active = 0;
         } else {
             $identifier->is_active = 1;
         }
         $identifier->save();
         return redirect()->route('admin.userManagement');
     } else {
         echo "<script>\n                    alert('This user havent paid his/her Order yet!');\n                    window.history.back();\n                 </script>";
     }
 }
Example #15
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = Cache::remember('users', 15, function () {
         return User::all();
     });
     return response()->json(['data' => $users], 200);
 }
Example #16
0
 public function show($id)
 {
     //todo: Need to remove the user it self from the current online User.
     /*
      * Variable list:
      * 1. Current online User, fetch from Reids, remove the user itself.
      * 2. UserInformation, fetch from sqlite(mysql);
      * 3. Group list?
      */
     /*
      * Get online User from Redis;
      */
     $redis = Redis::connection();
     //        $onlineUserIdList = $redis->keys('*');
     //Fix online UserIdList, all online user should be in one list;
     //todo: Need to fix the login, it shouldn't create a new list, but set keys for online user;
     $onlineUserIdList = $redis->hkeys("onlineUsers");
     $onlineUsers = array();
     foreach ($onlineUserIdList as $userId) {
         if (strcmp($userId, "user" . $id) != 0) {
             $onlineUsers[] = (object) $redis->hgetall($userId);
         } else {
             continue;
         }
     }
     //Get User Info
     $userInfo = User::find($id);
     $users = User::all();
     return view('Lobby.Lobby', compact('userInfo', 'onlineUsers', 'users'))->withEncryptedCsrfToken(Crypt::encrypt(csrf_token()));
 }
 public function index()
 {
     $users = User::all();
     if ($users) {
         return response()->json(['usuarios' => $users]);
     }
 }
 public function index()
 {
     // TODO: show users
     // Retrieve all the users in the database and return them
     $users = User::all();
     return $users;
 }
 public function run()
 {
     // create roles
     $admin = Role::create(['name' => 'admin', 'display_name' => 'Admin', 'description' => 'performs administrative tasks', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $cashier = Role::create(['name' => 'cashier', 'display_name' => 'Cashier', 'description' => 'performs cashier tasks', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $user = Role::create(['name' => 'user', 'display_name' => 'Portal User', 'description' => 'performs all basic tasks like print receipt, etc...', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     // create permissions
     $editUser = Permission::create(['name' => 'edit-user', 'display_name' => 'Edit Users', 'description' => 'manage users', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $reporting = Permission::create(['name' => 'reporting', 'display_name' => 'Print Report, Print receipt', 'description' => 'manage reports', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $editReporting = Permission::create(['name' => 'edit-reporting', 'display_name' => 'Edit Report, Edit receipt', 'description' => 'manage reports', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     $receipt = Permission::create(['name' => 'view-receipt', 'display_name' => 'View receipt, View Billings', 'description' => 'View recipent and view billings', 'created_at' => date('Y-m-d H:i:s'), 'updated_at' => date('Y-m-d H:i:s')]);
     // assign permissions to roles
     $admin->attachPermissions(array($editUser, $reporting, $receipt, $editReporting));
     $cashier->attachPermissions(array($reporting, $receipt, $editReporting));
     $user->attachPermissions(array($reporting, $receipt));
     // attach admin user to admin role
     $userAdmin = User::where('email', env('ADMIN_EMAIL'))->firstOrFail();
     $userAdmin->attachRole($admin);
     // assign default role to users
     $users = User::all();
     foreach ($users as $normalUser) {
         if ($normalUser->hasRole('user')) {
             continue;
         }
         $normalUser->attachRole($user);
     }
 }
 /**
  * Register any other events for your application.
  *
  * @param  \Illuminate\Contracts\Events\Dispatcher  $events
  * @return void
  */
 public function boot(DispatcherContract $events)
 {
     parent::boot($events);
     Event::listen('Aacotroneo\\Saml2\\Events\\Saml2LoginEvent', function (Saml2LoginEvent $event) {
         $user = $event->getSaml2User();
         /*$userData = [
               'id' => $user->getUserId(),
               'attributes' => $user->getAttributes(),
               'assertion' => $user->getRawSamlAssertion()
           ];*/
         $laravelUser = User::where("username", "=", $user->getUserId())->get()->first();
         if ($laravelUser != null) {
             Auth::login($laravelUser);
         } else {
             //if first user then create it and login
             $count = \App\User::all()->count();
             if ($count == 0) {
                 $data = array();
                 $data['lastname'] = "";
                 $data['firstname'] = "";
                 $data['username'] = $user->getUserId();
                 $data['role'] = "admin";
                 $user = \App\User::create($data);
                 \Auth::login($user);
                 return \Redirect::to('/');
             } else {
                 abort(401);
             }
         }
         //if it does not exist create it and go on  or show an error message
     });
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     $noticias = Noticia::all();
     $user = User::all();
     return view('noticias.index', compact('noticias', 'user'));
     //return view('beneficios.index', compact('beneficios'));
 }
Example #22
0
 public function ajax()
 {
     //
     $data['users'] = User::all();
     //$data['groups']->load('manager');
     return $data;
 }
Example #23
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $users = User::all()->sortByDesc('updated_at');
     $total_users = count($users);
     $total_replies = \App\Reply::all()->count();
     return view('users.index', compact('users', 'total_users', 'total_replies'));
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $users = User::all();
     foreach ($users as $user) {
         SMS::send($user->phone_number, 'New code has been deployed onto ClientApp');
     }
 }
 /**
  * Display a listing of the resource.
  *This method will show all the users within this webbapplication
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $users = User::all();
     dd($users);
     // $data = array('users' => $users);
     // return view('projectresult', compact('users'));
 }
Example #26
0
 /**
  * Seed the confer tables of the application.
  *
  * @return void
  */
 public function run()
 {
     $conversation = Conversation::create(['name' => 'Global', 'is_private' => false]);
     foreach (User::all() as $user) {
         $user->conversations()->attach($conversation->id);
     }
 }
 public function index()
 {
     $usersData = [];
     $usersData['count'] = User::all()->count();
     $usersData['incompleteCount'] = User::where('status', 0)->count();
     $picsData = [];
     $picsData['count'] = Pic::all()->count();
     $clubsData = [];
     $clubsData['count'] = Club::all()->count();
     $badgesData = [];
     $badgesData['count'] = Badge::all()->count();
     $fixtures = Fixture::all();
     $fixturesData = [];
     $fixturesData['count'] = $fixtures->count();
     $fixturesData['overCount'] = $fixtures->filter(function ($fxt) {
         return $fxt->isOver();
     })->count();
     $fixturesData['closedNotOverCount'] = $fixtures->filter(function ($fxt) {
         return $fxt->isClosed() and !$fxt->isOver();
     })->count();
     $gameweeks = Gameweek::all();
     $gameweeksData = [];
     $gameweeksData['count'] = $gameweeks->count();
     $gameweeksData['completeCount'] = Gameweek::complete()->get()->count();
     $gameweeksData['pendingCount'] = Gameweek::incomplete()->get()->filter(function ($gw) {
         return $gw->hasCompletedFixture();
     })->count();
     $adminsData = [];
     $adminsData['count'] = Admin::all()->count();
     return view('admin.dashboard.index', compact('usersData', 'picsData', 'clubsData', 'badgesData', 'fixturesData', 'gameweeksData', 'adminsData'));
 }
 public function edit($id)
 {
     $page = 'partials.admin-editType';
     $users = User::all();
     $type = Type::find($id);
     return view('quantri/admin', compact('page', 'users', 'type'));
 }
 function testNewUser()
 {
     // Given
     $this->startSession();
     $validName = 'Some name';
     $validEmail = '*****@*****.**';
     $validPassword = '******';
     $validCountryCode = '1';
     $validPhoneNumber = '5558180101';
     $this->assertCount(0, User::all());
     $mockAuthyApi = Mockery::mock('Authy\\AuthyApi')->makePartial();
     $mockAuthyUser = Mockery::mock();
     $mockAuthyApi->shouldReceive('registerUser')->with($validEmail, $validPhoneNumber, $validCountryCode)->once()->andReturn($mockAuthyUser);
     $mockAuthyUser->shouldReceive('ok')->once()->andReturn(true);
     $mockAuthyUser->shouldReceive('id')->once()->andReturn('authy_id');
     $mockAuthyApi->shouldReceive('requestSms')->with('authy_id')->once();
     $this->app->instance('Authy\\AuthyApi', $mockAuthyApi);
     // When
     $response = $this->call('POST', route('user-create'), ['name' => $validName, 'email' => $validEmail, 'password' => $validPassword, 'country_code' => $validCountryCode, 'phone_number' => $validPhoneNumber, '_token' => csrf_token()]);
     // Then
     $this->assertCount(1, User::all());
     $user = User::first();
     $this->assertEquals($user->name, $validName);
     $this->assertEquals($user->email, $validEmail);
     $this->assertEquals($user->country_code, $validCountryCode);
     $this->assertEquals($user->authy_id, 'authy_id');
     $this->assertEquals($user->verified, false);
     $this->assertRedirectedToRoute('user-show-verify');
     $this->assertSessionHas('status');
     $flashMessage = $this->app['session']->get('status');
     $this->assertEquals($flashMessage, "User created successfully");
 }
Example #30
0
 public function showNotesAll()
 {
     $users = User::all();
     $notes = Notes::all();
     $vars = ["users" => $users, "notes" => $notes];
     return view('backend.page.notes-list')->with($vars);
 }