当前位置: 首页>>代码示例>>PHP>>正文


PHP User::select方法代码示例

本文整理汇总了PHP中app\User::select方法的典型用法代码示例。如果您正苦于以下问题:PHP User::select方法的具体用法?PHP User::select怎么用?PHP User::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\User的用法示例。


在下文中一共展示了User::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getMethod

 public function getMethod(Request $request, Builder $htmlBuilder)
 {
     if ($request->ajax()) {
         return Datatables::of(User::select(['id', 'name', 'email', 'created_at', 'updated_at']))->make(true);
     }
     $html = $htmlBuilder->addColumn(['data' => 'id', 'name' => 'id', 'title' => 'Id'])->addColumn(['data' => 'name', 'name' => 'name', 'title' => 'Name'])->addColumn(['data' => 'email', 'name' => 'email', 'title' => 'Email'])->addColumn(['data' => 'created_at', 'name' => 'created_at', 'title' => 'Created At'])->addColumn(['data' => 'updated_at', 'name' => 'updated_at', 'title' => 'Updated At']);
     return view('datatables.html.method', compact('html'));
 }
开发者ID:nmardones,项目名称:laravel-datatables-demo,代码行数:8,代码来源:HtmlBuilderController.php

示例2: data

 public function data()
 {
     $users = User::select(['id', 'first_name', 'last_name', 'email']);
     return Datatables::of($users)->add_column('actions', '<a href="{{ route(\'admin.users.show\', $id) }}"><i class="livicon" data-name="info" data-size="18" data-loop="true" data-c="#428BCA" data-hc="#428BCA" title="view user"></i></a>
                                 <a href="{{ route(\'admin.users.edit\', $id) }}"><i class="livicon" data-name="edit" data-size="18" data-loop="true" data-c="#428BCA" data-hc="#428BCA" title="update user"></i></a>
             				   ')->make(true);
 }
开发者ID:jeremyreese,项目名称:quotes,代码行数:7,代码来源:DataTablesController.php

示例3: index

 /**
  * Display a listing of the resource.
  * Display every conversation/topics with the first Thread related
  * @return Response
  */
 public function index(Request $request)
 {
     $Threads = array();
     $Result = array();
     $count = 0;
     $admin = Role::select('id')->where('description', '=', 'admin')->firstorFail();
     // if we are admin we want to see everything
     if (\Auth::id() == $admin->id) {
         $Conversations = User::select('*')->join('conversations', 'conversations.user_id', '=', 'users.id')->get();
     } else {
         // we are not admin but we want to see published messages and the status of our posted messages
         if (\Auth::guest()) {
             $Conversations = User::select('*')->join('conversations', 'conversations.user_id', '=', 'users.id')->where('conversations.Pending', '=', 0)->get();
         } else {
             $Conversations = User::select('*')->join('conversations', 'conversations.user_id', '=', 'users.id')->where('conversations.Pending', '=', 0)->orwhere('conversations.user_id', '=', \Auth::id())->get();
         }
     }
     // we recover the first Thread according to the conversations which passed the previous tests
     foreach ($Conversations as $Conversation) {
         $Threads[$count] = Thread::where('conversation_id', '=', $Conversation->id)->firstOrFail();
         $Result[$count] = array($Conversation, $Threads[$count]);
         $count++;
     }
     return view('dashboard')->with(['dashboard' => $Result, 'adminID' => $admin]);
 }
开发者ID:yves01,项目名称:dashboard,代码行数:30,代码来源:DashboardController.php

示例4: show

 /**
  * Поиск пользователя
  * @param  Request $request
  * @return array
  */
 public function show(Request $request)
 {
     $s = $request->get('s');
     return ['results' => User::select('name', 'id')->where('id', '!=', $this->user->id)->where(function ($q) use($s) {
         $q->where('name', 'LIKE', "%{$s}%")->orWhere('id', 'LIKE', "%{$s}%");
     })->get()];
 }
开发者ID:avil13,项目名称:test_card,代码行数:12,代码来源:UserController.php

示例5: update

 /**
  * @param Request $request
  * @param $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function update(Request $request, $id)
 {
     $user_id = $request->input('user_id');
     $user = User::find($user_id);
     $change = User::find($id);
     if ($user && $user->access < 5) {
         return response()->json(['notPermission' => true, 'message' => $user->first_name . ' não possui permissão!']);
     }
     if ($request->has('access') && $user->access < $request->input('access')) {
         return response()->json(['notPermission' => true, 'message' => 'Você não possui acesso para dar uma permissão maior que a sua!']);
     }
     if ($user->access < $change->access) {
         return response()->json(['notPermission' => true, 'message' => 'Você não possui acesso para dar uma permissão maior que a sua!']);
     }
     $change->username = $request->has('username') ? $request->input('username') : $change->username;
     $change->email = $request->has('email') ? $request->input('email') : $change->email;
     $change->first_name = $request->has('first_name') ? $request->input('first_name') : $change->first_name;
     $change->last_name = $request->has('last_name') ? $request->input('last_name') : $change->last_name;
     $change->role = $request->has('role') ? $request->input('role') : $change->role;
     $change->access = $request->has('access') ? $request->input('access') : $change->access;
     if ($change->save()) {
         return User::select('users.id', 'users.username', 'users.email', 'users.first_name', 'users.last_name', 'users.role', 'users.access', 'permissions.permission', 'users.created_at')->join('permissions', 'users.access', '=', 'permissions.id')->where('users.id', $id)->first();
     } else {
         return response()->json(['error' => true, 'message' => 'Ocorreu um error inexperado!']);
     }
 }
开发者ID:paulopanissa,项目名称:nNotary,代码行数:31,代码来源:UserController.php

示例6: index

 public function index()
 {
     $professores = User::select('users.id', 'users.name')->where('tipo_usuario', '=', 1)->get();
     $turmas = Turma::all();
     // Show the page
     return view('admin.professorturmas.index', compact('professores', 'turmas'));
 }
开发者ID:hyagobasilio,项目名称:gebep,代码行数:7,代码来源:ProfessorTurmaController.php

示例7: getProfile

 public function getProfile()
 {
     $users = \App\User::select('id', 'name')->where('id', '!=', \Auth::user()->id)->get();
     $resHours = count(\App\ReservedHours::where('user_id', \Auth::user()->id)->get());
     $finHours = count(\App\FinishedHour::where('user_id', \Auth::user()->id)->get());
     return view('users.index', ['users' => $users, 'resHours' => $resHours, 'finHours' => $finHours]);
 }
开发者ID:DiCore,项目名称:hours,代码行数:7,代码来源:SettingsController.php

示例8: ListaCoach

 public function ListaCoach()
 {
     $users = User::select('users.id', 'roles.display_name', 'users.name', 'users.last_name', 'users.email')->join('role_user', 'users.id', '=', 'role_user.user_id')->join('roles', 'roles.id', '=', 'role_user.role_id')->whereIn('roles.id', array(2, 5));
     // coach
     $filter = DataFilter::source($users);
     $filter->attributes(array('class' => 'form-inline'));
     //$filter->add('user_id','Buscar por ID', 'text');
     $filter->add('user.name', 'Buscar por Nombre', 'text');
     $filter->add('email', 'Buscar por Email', 'text');
     $filter->add('created_at', 'Fecha de Ingreso', 'daterange')->format('d/m/Y', 'es');
     $filter->add('cuenta_activa', 'Usuarios Activos', 'select')->options(array('1' => 'Activos', '0' => 'Inactivos'));
     $filter->submit('Buscar');
     $filter->reset('Limpiar');
     $grid = DataGrid::source($filter);
     $grid->attributes(array("class" => "table table-hover"));
     $grid->add('id', 'ID', true);
     $grid->add('display_name', 'Rol', true);
     $grid->add('name', 'Nombre', true);
     $grid->add('last_name', 'Apellido', true);
     $grid->add('email', 'Email', true);
     $grid->add('{!! ("<a href=# data-id=$id class=reset_pass >Reset</a>") !!}', 'Resetear Contraseña');
     $grid->edit(url('/') . '/coach/edit', 'Editar/Borrar', 'modify|delete');
     $grid->link('/coach/create', 'Crear Coach', 'TR');
     //$grid->orderBy('role.id','desc');
     $grid->paginate(10);
     return view('coach.lista', compact('filter', 'grid'));
 }
开发者ID:davila7,项目名称:kayra,代码行数:27,代码来源:UsuariosController.php

示例9: index

 public function index()
 {
     $alunos = User::select('users.id', 'users.name')->where('tipo_usuario', '=', 0)->get();
     $turmas = Turma::select('turmas.id', 'turmas.nome')->get();
     // Show the page
     return view('admin.alunosturmas.index', compact('alunos', 'turmas'));
 }
开发者ID:hyagobasilio,项目名称:gebep,代码行数:7,代码来源:AlunoTurmaController.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->guest()) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest('auth/login');
         }
     } elseif (session('role_id') == 3) {
         $route = $request->route();
         $routeName = $route->getName();
         if ($routeName == 'activity.show') {
             $activityId = $route->getParameter('activity');
             $orgId = Activity::select('organization_id')->find($activityId)->organization_id;
         } elseif ($routeName == 'organization.show') {
             $orgId = $route->getParameter('organization');
         } else {
             $orgId = session('org_id');
         }
         if ($orgId && $this->auth->user()->isSuperAdmin()) {
             $userId = User::select('id')->where('org_id', $orgId)->where('role_id', 1)->first()->id;
             app(OrganizationController::class)->masqueradeOrganization($orgId, $userId);
         } elseif (!$orgId && !isSuperAdminRoute()) {
             return redirect(config('app.super_admin_dashboard'));
         }
     } elseif (isSuperAdminRoute()) {
         $response = ['type' => 'warning', 'code' => ['message', ['message' => "You don't have correct privilege"]]];
         return redirect(config('app.admin_dashboard'))->withResponse($response);
     }
     return $next($request);
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:38,代码来源:Authenticate.php

示例11: users

 public function users()
 {
     $term = Input::get('term');
     $m = User::select('id', 'name')->where('name', 'LIKE', '%' . $term . '%')->orWhere('identification', 'LIKE', '%' . $term . '%')->orWhere('email', 'LIKE', '%' . $term . '%');
     $query = $this->paginateQuery($m);
     return $query;
 }
开发者ID:ReyesPedro,项目名称:Proyecto-de-grado,代码行数:7,代码来源:SelectsController.php

示例12: getSortableUsers

 public function getSortableUsers($sort = 'name', $direction = 'asc')
 {
     if (!in_array($sort, ['name', 'created_at'])) {
         $sort = 'name';
     }
     return User::select('users.id', 'users.name', 'users.created_at')->orderBy($sort, $direction)->paginate(10);
 }
开发者ID:robeasdon,项目名称:golf-stat-tracker,代码行数:7,代码来源:UserRepository.php

示例13: getGrid

 public function getGrid()
 {
     $users = User::select(['id', 'name', 'email', 'role', 'created_at', 'updated_at']);
     return Datatables::of($users)->addColumn('action', function ($user) {
         return '<a href="/admin/users/edit/' . $user->id . '" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a> <a href="/admin/users/delete/' . $user->id . '" class="btn btn-xs btn-primary delete-button"><i class="glyphicon glyphicon-remove"></i> Delete</a>';
     })->make(true);
 }
开发者ID:hugoleodev,项目名称:WhatTheTag,代码行数:7,代码来源:UserController.php

示例14: index

 /**
  * Display a listing of the resource.
  *
  * @param  Request  $request
  * @return Datatables
  */
 public function index(Request $request)
 {
     $users = User::select(['id', 'photo', 'first_name', 'last_name', 'is_active', 'created_at']);
     // super admin visibility
     if (config('laravel-user-module.non_visibility.super_admin') && !Sentinel::getUser()->is_super_admin) {
         $users->where('is_super_admin', false);
     }
     // if is filter action
     if ($request->has('action') && $request->input('action') === 'filter') {
         $users->filter($request);
     }
     $addColumns = ['addUrls' => $this->urls, 'status' => function ($model) {
         return $model->is_active;
     }, 'fullname' => function ($model) {
         return $model->fullname;
     }];
     $editColumns = ['photo' => function ($model) {
         $photoKey = array_keys(config('laravel-user-module.user.uploads.photo.thumbnails'));
         return $model->getPhoto([], $photoKey[0], true);
     }, 'created_at' => function ($model) {
         return $model->created_at_table;
     }];
     $removeColumns = ['is_active', 'first_name', 'last_name'];
     return $this->getDatatables($users, $addColumns, $editColumns, $removeColumns);
 }
开发者ID:erenmustafaozdal,项目名称:laravel-user-module,代码行数:31,代码来源:UserApiController.php

示例15: enviar_email

 public function enviar_email(\Illuminate\Http\Request $request)
 {
     $input = $request->except(array('_token'));
     //não levar o token
     $buscar = \App\Models\pessoas::select('razaosocial', 'empresas_id', 'empresas_clientes_cloud_id')->where('emailprincipal', $input["email"])->get();
     if ($buscar->count() > 0) {
         $usuario = User::select('id')->where('email', $input["email"])->where('password', bcrypt($input["password"]))->get();
         if ($usuario->count() > 0) {
             return redirect()->guest('login');
         } else {
             //criar usuario
             //Gera token qualquer
             $dados = str_random(30);
             $data = $input;
             $retorno = User::create(['name' => $buscar[0]->razaosocial, 'email' => $input["email"], 'password' => bcrypt($input["password"]), 'confirmation_code' => $dados]);
             usuario::create(['id' => $retorno->id, 'empresas_id' => $buscar[0]->razaosocial, 'empresas_clientes_cloud_id' => $input["email"]]);
             \Mail::send('emails.link_newuser', ['key' => $dados], function ($message) use($data) {
                 $message->from('contato@sigma3sistemas.com.br', 'Sigma3');
                 $message->subject('Link para validação SIGMA3 - Área do Membro');
                 $message->to($data['email']);
                 $message->bcc('contato@sigma3sistemas.com.br');
             });
             $conteudo = ['mensagem' => 'Verifique sua conta de email para validar o acesso ao sistema.'];
         }
     } else {
         $credentials = array('email' => $input["email"], 'password' => $input["password"]);
         if (Auth::attempt($credentials, true)) {
             Auth::login(Auth::user(), true);
             Auth::guard('web')->login($credentials);
             //return redirect('login');
             return \Redirect::intended('login');
         }
     }
     //return view('tutoriais.minhaigreja', ['conteudo'=>$conteudo]);
 }
开发者ID:prasist,项目名称:prjwebch,代码行数:35,代码来源:MinhaIgreja.php


注:本文中的app\User::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。