Example #1
0
 public function getUser()
 {
     $all = User::all();
     $env = \App::environment();
     var_dump($all, $env);
     foreach ($all as $v) {
         var_dump($env);
         var_dump($v->name);
         var_dump($v->nickname);
         var_dump($v->createTime);
         var_dump($v->updateTime);
         var_dump($v->deleteTime);
     }
     //$id = 30;
     //$user = UserService::getUserById($id);
     //$list = UserService::getList(1,10);
     //\Debugbar::info();
     //\Debugbar::error('Error!');
     //\Debugbar::warning('Watch out…');
     //\Debugbar::addMessage('Another message', 'mylabel');
     //\Debugbar::startMeasure('render','Time for rendering');
     //\Debugbar::stopMeasure('render');
     //\Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
     //echo 'ssss';
     //\Debugbar::disable();
     /*
     foreach($list  as $k=>$v){
     	   //var_dump($v['name']);
     }
     var_dump($list);
     */
 }
Example #2
0
 /**
  * @return Faker
  */
 protected function getFakerWithUniqueUserData()
 {
     // Prepare an array with user data already used
     $users = User::all();
     if (!$this->uniques) {
         $uniques = ['username' => [], 'email' => []];
         foreach ($users as $user) {
             array_push($uniques['username'], [$user->username => null]);
             array_push($uniques['email'], [$user->email => null]);
         }
         $this->uniques = $uniques;
     }
     // As the array of already used faker data is protected in Faker and
     // has no accessor method, we'll rely on ReflectionObject to modify
     // the property before letting faker generate data.
     //though reflected object should be added to the faker itself somehow
     // which is hacky
     //so we decided to overcome it with bindTo hack
     $faker = Faker::create();
     $unique = $faker->unique();
     $binder = function ($value) {
         $this->unqiue = $value;
     };
     $unqiueBinder = $binder->bindTo($unique, $unique);
     $unqiueBinder($this->uniques);
     return $faker;
 }
 public function delete($userType, $id, Request $req)
 {
     $temp = null;
     $profile = null;
     if ($userType == 'admin') {
         //$profile=  Founder::findOrFail($id)->toArray();
         //dd($profile);
         Admin::findOrFail($id)->delete();
     } elseif ($userType == 'founder') {
         //$profile=  Founder::findOrFail($id)->toArray();
         //dd($profile);
         Founder::findOrFail($id)->delete();
     } elseif ($userType = 'investor') {
         //$profile=  Investor::findOrFail($id)->toArray();
         //dd($profile);
         Investor::findOrFail($id)->delete();
     } elseif ($userType = 'campaign') {
         //$profile=  Investor::findOrFail($id)->toArray();
         //dd($profile);
         Campaign::findOrFail($id)->delete();
     }
     flash()->success($userType . ' Deleted');
     $users = User::all();
     return view('admin.home', compact('users'));
 }
Example #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $brand = Brand::all();
     $category = Category::all();
     $user = User::all();
     return view('product.create_new_product', compact('brand', 'category', 'subcat_level1', 'user'));
 }
 protected function _init()
 {
     parent::_init();
     $this->aclAdd('login', array('restricted', 'accounts'));
     $this->Facebook = new FacebookConnect(FACEBOOK_APP_ID, FACEBOOK_APP_SECRET, array('redirect_uri' => FACEBOOK_REDIRECT_URI));
     $this->tpl->assign('Facebook', $this->Facebook);
     $this->tpl->assign('users', User::all());
 }
Example #6
0
 public function all()
 {
     $users = User::all();
     if ($users->isEmpty()) {
         return $this->responseNotFound(['Users is empty']);
     }
     return $this->responseOk($users);
 }
Example #7
0
 public function getIndex()
 {
     $roles = [0 => 'Все'];
     foreach (Role::all() as $role) {
         $roles[$role->id] = $role->title;
     }
     return view('admin.users.index', ['users' => User::all(), 'roles' => $roles]);
 }
Example #8
0
 public function run()
 {
     $faker = Faker::create();
     $usersId = \App\Models\User::all()->lists('id');
     foreach (range(0, 20) as $index) {
         DB::table('orders')->insert(['user_id' => $faker->randomElement($usersId), 'specialInstruction' => $faker->text(), 'status' => 1]);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('profiles')->delete();
     $users = User::all();
     foreach ($users as $user) {
         Profile::create(['display_name' => 'The Real Doodle Maestro', 'user_id' => $user->id]);
     }
 }
 public function getIndex()
 {
     if (!$this->hasPermission('manage.user')) {
         return response()->view('errors.401', [], 401);
     }
     $users = User::all();
     return view('user.index', compact('users'));
 }
Example #11
0
 /**
  * Get a set of application data.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function index()
 {
     $playlists = Playlist::byCurrentUser()->orderBy('name')->with('songs')->get()->toArray();
     // We don't need full song data, just ID's
     foreach ($playlists as &$playlist) {
         $playlist['songs'] = array_pluck($playlist['songs'], 'id');
     }
     return response()->json(['artists' => Artist::orderBy('name')->with('albums', with('albums.songs'))->get(), 'settings' => Setting::all()->lists('value', 'key'), 'playlists' => $playlists, 'interactions' => Interaction::byCurrentUser()->get(), 'users' => auth()->user()->is_admin ? User::all() : [], 'user' => auth()->user()]);
 }
Example #12
0
 /**
  * Show the form for creating a new Role.
  *
  * @return Response
  */
 public function create()
 {
     $users = User::all();
     $userlist = array();
     foreach ($users as $key => $value) {
         $userlist[$value->objectId] = $value->username;
     }
     return view('roles.create')->with(array('users' => $userlist));
 }
Example #13
0
 /**
  * Get a set of application data.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function index()
 {
     $playlists = Playlist::byCurrentUser()->orderBy('name')->with('songs')->get()->toArray();
     // We don't need full song data, just ID's
     foreach ($playlists as &$playlist) {
         $playlist['songs'] = array_pluck($playlist['songs'], 'id');
     }
     return response()->json(['artists' => Artist::orderBy('name')->with('albums', with('albums.songs'))->get(), 'settings' => Setting::lists('value', 'key')->all(), 'playlists' => $playlists, 'interactions' => Interaction::byCurrentUser()->get(), 'users' => auth()->user()->is_admin ? User::all() : [], 'currentUser' => auth()->user(), 'useLastfm' => env('LASTFM_API_KEY') && env('LASTFM_API_SECRET'), 'currentVersion' => Application::VERSION, 'latestVersion' => auth()->user()->is_admin ? app()->getLatestVersion() : Application::VERSION]);
 }
Example #14
0
 /**
  * Get a set of application data.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function index()
 {
     $playlists = Playlist::byCurrentUser()->orderBy('name')->with('songs')->get()->toArray();
     // We don't need full song data, just ID's
     foreach ($playlists as &$playlist) {
         $playlist['songs'] = array_pluck($playlist['songs'], 'id');
     }
     return response()->json(['artists' => Artist::orderBy('name')->with('albums', with('albums.songs'))->get(), 'settings' => auth()->user()->is_admin ? Setting::pluck('value', 'key')->all() : [], 'playlists' => $playlists, 'interactions' => Interaction::byCurrentUser()->get(), 'users' => auth()->user()->is_admin ? User::all() : [], 'currentUser' => auth()->user(), 'useLastfm' => Lastfm::used(), 'useYouTube' => YouTube::enabled(), 'allowDownload' => config('koel.download.allow'), 'cdnUrl' => app()->staticUrl(), 'currentVersion' => Application::VERSION, 'latestVersion' => auth()->user()->is_admin ? app()->getLatestVersion() : Application::VERSION]);
 }
Example #15
0
 /**
  * get Index.
  *
  * @return Response Show Root dashboard
  */
 public function getIndex()
 {
     logger()->info(__METHOD__);
     logger()->warning('[ROOT ACCESS]');
     //////////////////
     // FOR REFACTOR //
     //////////////////
     $users = User::all();
     return view('Backend::dashboard', compact('users'));
 }
Example #16
0
 /**
  * get Index.
  *
  * @return Response Show Root dashboard
  */
 public function getIndex()
 {
     $this->log->info(__METHOD__);
     $this->log->warning('[ROOT ACCESS]');
     //////////////////
     // FOR REFACTOR //
     //////////////////
     $users = User::all();
     return view('root.dashboard', compact('users'));
 }
Example #17
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //
     $users = User::all();
     $response = new \stdClass();
     $response->success = true;
     $response->total = count($users);
     $response->data = $users;
     return response()->json($response);
 }
Example #18
0
 private function prepareForTests()
 {
     Artisan::call('migrate');
     if (!User::all()->count()) {
         Artisan::call('db:seed');
     }
     if (!file_exists($this->coverPath)) {
         mkdir($this->coverPath, 0777, true);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('trackings')->truncate();
     $faker = Faker::create();
     foreach (range(1, 20) as $index) {
         Tracking::create(['image_url' => $faker->imageUrl(640, 480, 'city'), 'facing_id' => Facing::find($faker->numberBetween(1, 20))->id]);
     }
     foreach (range(21, 30) as $index) {
         Tracking::create(['image_url' => $faker->imageUrl(640, 480, 'city'), 'state' => 'Inserted', 'inserted_at' => Carbon::now(), 'facing_id' => Facing::all()->get($faker->numberBetween(1, 20))->id, 'product_id' => Product::all()->get($faker->numberBetween(1, 20))->id, 'brand_id' => Brand::all()->get($faker->numberBetween(1, 20))->id, 'user_id' => User::all()->get($faker->numberBetween(1, 10))->id]);
     }
 }
 public function getAdmin()
 {
     if (Auth::user()->isAdmin()) {
         $users = User::all();
         $podcasts = Podcast::all();
         $jobs = DB::select('select * from jobs');
         $failed_jobs = DB::select('select * from failed_jobs');
         return view('admin', compact('users', 'podcasts', 'jobs', 'failed_jobs'));
     }
     return;
 }
 /**
  * Test User encode to JWT and decode from JWT back.
  */
 public function testUserEncodeDecode()
 {
     $users = User::all();
     $this->assertGreaterThan(0, count($users));
     /** @var User $firstUser */
     $this->assertNotNull($firstUser = $users[0]);
     unset($users);
     $this->assertNotNull($jwt = $this->codec->encode($firstUser));
     $this->assertNotNull($sameUser = $this->codec->decode($jwt));
     $this->assertEquals($firstUser->getAuthIdentifier(), $sameUser->getAuthIdentifier());
 }
Example #22
0
 public function get_all_user()
 {
     $users = User::all();
     foreach ($users as $user) {
         $roles = $user->_roles()->where('user', $user->user)->getResults();
         foreach ($roles as $role) {
             $user->label = $role->label;
         }
     }
     return $users;
 }
 private function getJwtAuthHeader()
 {
     $allUsers = User::all();
     $this->assertGreaterThan(0, count($allUsers));
     /** @var User $firstUser */
     $this->assertNotNull($firstUser = $allUsers[0]);
     /** @var UserJwtCodecInterface $jwtCodec */
     $this->assertNotNull($jwtCodec = app(UserJwtCodecInterface::class));
     $jwt = $jwtCodec->encode($firstUser);
     return 'Bearer ' . $jwt;
 }
Example #24
0
 public function executeSearch()
 {
     $keywords = Input::get('keywords');
     $users = User::all();
     $searchUsers = new Collection();
     foreach ($users as $u) {
         if (Str::contains(Str::lower($u->name), Str::lower($keywords))) {
             $searchUsers->add($u);
         }
     }
     return view('dump.searchUsers', compact('searchUsers'));
 }
 public function run()
 {
     $faker = Faker::create();
     $users = App\Models\User::all()->lists('id')->toArray();
     $userIds = App\Models\User::lists('id');
     foreach (range(1, 20) as $index) {
         $firstname = $faker->firstname;
         $lastname = $faker->lastname;
         $username = str_replace('.', '_', $faker->unique()->userName);
         $profile = Profile::create(['user_id' => $faker->randomElement($userIds), 'confirmed' => $faker->boolean($chanceOfGettingTrue = 50), 'is_active' => $faker->boolean($chanceOfGettingTrue = 50), 'is_fake' => true, 'activated' => $faker->boolean($chanceOfGettingTrue = 50), 'published' => $faker->boolean($chanceOfGettingTrue = 50), 'is_active' => $faker->boolean($chanceOfGettingTrue = 50), 'is_employee' => $faker->boolean($chanceOfGettingTrue = 50), 'is_public' => $faker->boolean($chanceOfGettingTrue = 50), 'website' => $faker->domainName, 'company' => $faker->company, 'uuid' => $faker->uuid, 'facebook_username' => $username . '_facebook', 'twitter_username' => $username . '_twitter', 'instagram_username' => $username . '_instagram', 'githubid' => $username . '_github', 'skypeid' => $username . '_skype', 'linkedinurl' => 'http://www.linkedin.com', 'googleplusurl' => 'http://plus.google.com', 'facebookurl' => 'http://www.facebook.com', 'birth_date' => $faker->date($format = 'm-d-Y', $max = 'now'), 'dob_month' => $faker->numberBetween($min = 1, $max = 12), 'dob_day' => $faker->numberBetween($min = 1, $max = 30), 'dob_year' => $faker->numberBetween($min = 1980, $max = 2010), 'pic' => $faker->imageUrl(600, 600, 'people', true, 'Faker'), 'username' => $username, 'display_name' => $firstname . " " . $lastname, 'about_me' => $faker->paragraph($nbSentences = 3), 'phone' => $faker->phoneNumber, 'phone_type' => 'Home', 'position' => 'employee', 'supervisor' => 'jaren', 'employment_title' => 'random employee', 'employment_role' => 'to follow nathan around the office', 'employment_status' => 'active', 'gender' => $faker->randomElement($array = ['Male', 'Female']), 'note' => $faker->bs, 'user_api_key' => str_random(32), 'user_api_secret' => str_random(64), 'user_activation_key' => str_random(128), 'activation_code_id' => str_random(128), 'activation_code' => str_random(15), 'confirmation_code' => str_random(4), 'profile_activated_on' => $faker->dateTimeBetween($startDate = '-2 years', $endDate = 'now'), 'published_on' => $faker->dateTimeBetween($startDate = '-2 years', $endDate = 'now'), 'slug' => $faker->slug, 'created_at' => Carbon\Carbon::now(), 'updated_at' => Carbon\Carbon::now()]);
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     try {
         DB::beginTransaction();
         $question = new CompetitionQuestion();
         $question->question = $request->question;
         $question->question_mm = $request->question_mm;
         $question->description = $request->description;
         $question->description_mm = $request->description_mm;
         $question->instruction_about_game = $request->instruction_about_game;
         $question->start_date = $request->start_date;
         $question->end_date = $request->end_date;
         $question->save();
         $users = User::all();
         if ($users) {
             $group_users = array();
             foreach ($users as $i => $user) {
                 //Grouping
                 if (isset($user['tlg_city_address']) && $user['tlg_city_address']) {
                     $group_users[$user['tlg_city_address']][] = $user;
                 }
             }
             $group_index = 1;
             $i = 0;
             foreach ($group_users as $key => $city) {
                 foreach ($city as $user) {
                     if ($i % 5 == 0) {
                         $group_name = 'Group - ' . $group_index++;
                     }
                     $group_user = new CompetitionGroupUser();
                     $group_user->group_name = $group_name;
                     $group_user->user_id = $user['id'];
                     $group_user->username = $user['username'];
                     $group_user->phone = $user['phoneNo'];
                     $group_user->profile_img = isset($user['user_profile_img']) ? json_encode($user['user_profile_img']) : null;
                     $group_user->group_city = $key;
                     $group_user->competition_question_id = $question->id;
                     $group_user->save();
                     $i++;
                 }
             }
         } else {
             DB::rollBack();
             return response()->json('Something went wrong in parse.', 400);
         }
         DB::commit();
     } catch (Exception $e) {
         DB::rollBack();
         return response()->json('Something went wrong.', 400);
     }
     return response()->json($question);
 }
Example #27
0
 protected function onAJAX(\Illuminate\Http\Request $input)
 {
     $search = $input->get('search');
     if ('' == $search) {
         return User::all()->toArray();
     }
     $users = User::where('name', 'LIKE', $search . '%')->orWhere('scientific', 'LIKE', $search . '%');
     if ($users->count()) {
         return $users->get()->toArray();
     }
     $users = User::where('name', 'LIKE', '%' . $search . '%')->orWhere('scientific', 'LIKE', '%' . $search . '%');
     return $users->get()->toArray();
 }
Example #28
0
 public function export()
 {
     $separator = ';';
     $file = '"ID"' . $separator . '"Prenom"' . $separator . '"Nom"' . $separator . '"Genre"' . $separator . '"Inscription"' . $separator . '"Age"' . $separator . '"Ville"' . $separator . '"Pays"' . $separator . '"Scores"' . "\r\n";
     foreach (User::all() as $user) {
         $file .= '"' . $user->id . '"' . $separator . '"' . $user->first_name . '"' . $separator . '"' . $user->last_name . '"' . $separator . '"' . $user->gender . '"' . $separator . '"' . $user->created_at . '"' . $separator . '"' . $user->age . '"' . $separator . '"' . $user->city . '"' . $separator . '"' . $user->country . '"' . $separator . '"';
         foreach ($user->scores as $score) {
             $file .= $score->quizz->label . ':' . $score->score . '-';
         }
         $file .= "\"\r\n";
     }
     return response($file, 200, ['Content-Type' => 'text/csv; charset=utf-8']);
 }
 public function getUsuariosAndPacientes()
 {
     $user = User::fromToken();
     $respuesta = [];
     $respuesta['imagenes'] = ImagenModel::where('user_id', $user['id'])->get();
     if ($user['is_superuser']) {
         $respuesta['usuarios'] = User::all();
     } else {
         $respuesta['usuarios'] = User::where('is_superuser', false)->get();
     }
     $respuesta['pacientes'] = Paciente::all();
     return $respuesta;
 }
Example #30
0
 public function index()
 {
     if (Input::get('_id')) {
         return $this->show(Input::get('_id'));
     }
     if (Input::get('hxid')) {
         $user = User::where('hxid', Input::get('hxid'))->first();
         $user->school;
         unset($user->schoolId);
         $user->tags;
         return $this->output($user);
     }
     return $this->output(User::all());
 }