本文整理汇总了PHP中app\User::get方法的典型用法代码示例。如果您正苦于以下问题:PHP User::get方法的具体用法?PHP User::get怎么用?PHP User::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Usuarios
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);
}
}
}
示例2: testGet
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);
}
示例3: run
/**
* 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()))]);
}
}
示例4: index
/**
* 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'));
}
示例5: user
function user()
{
$data = User::get();
// print_r($data);
// die;
return view('user.home')->with('users', $data);
}
示例6: index
/**
* 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));
}
示例7: userPosts
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);
}
示例8: users
/**
* 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]);
}
示例9: index
/**
* 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')) {
}
}
示例10: index
/**
* 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]);
}
示例11: index
/**
* 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);
}
示例12: run
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)]);
}
}
示例13: down
/**
* 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();
}
}
示例14: run
/**
* 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)]);
}
}
示例15: checkout
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'));
}