本文整理汇总了PHP中app\User::all方法的典型用法代码示例。如果您正苦于以下问题:PHP User::all方法的具体用法?PHP User::all怎么用?PHP User::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listAllUsers
/**
* 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;
}
示例2: handle
/**
* 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('hziflytek@126.com', '移动互联签到系统');
$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('hziflytek@126.com', '移动互联签到系统');
$message->to($this->userData->employee->email, $this->userData->employee->name);
$message->subject('【审核提醒】');
});
// $this->info('提醒'.$user->employee->name);
}
}
}
}
示例3: competition
public function competition()
{
$users = User::all();
$competitors = Competitor::all();
$data = ['competitors' => $competitors];
return View('competition.competition')->with($data);
}
示例4: show
/**
* 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]);
}
示例5: handle
/**
* 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]);
}
}
示例6: store
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'));
}
示例7: index
public function index()
{
if (\Request::ajax()) {
return User::all();
}
return view('user.index');
}
示例8: 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'));
}
示例9: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$users = User::all();
foreach ($users as $user) {
$user->update_status();
}
}
示例10: getInfoById
/**
* 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;
}
示例11: getInvite
public function getInvite($group)
{
$title = "Groups";
$bodyclass = "app-groups";
$users = \App\User::all();
return view('site.groups.invite', compact('title', 'group', 'users', 'bodyclass'));
}
示例12: home
/**
* 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'));
}
示例13: getAssigntarget
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));
}
示例14: is_active
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>";
}
}
示例15: index
/**
* 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);
}