本文整理汇总了PHP中app\User::Where方法的典型用法代码示例。如果您正苦于以下问题:PHP User::Where方法的具体用法?PHP User::Where怎么用?PHP User::Where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\User
的用法示例。
在下文中一共展示了User::Where方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkEmail
private function checkEmail($email)
{
$user = User::Where('email', $email)->first();
if ($user == null) {
return true;
}
return false;
}
示例2: json
public function json(Request $requests)
{
$limit = $requests->input('limit') ? $requests->input('limit') : 15;
if ($limit > 100 || $limit <= 0) {
$limit = 15;
}
$users = User::Where('email', 'like', '%' . $requests->input('search') . '%')->whereNull('deleted_at')->paginate($limit);
$data = View('admin.users.user_template')->with('users', $users)->render();
return response()->json($data);
}
示例3: store
/**
* Attach a user as a project team member.
*
* @param Request $request
* @param Project $project
* @return User
*/
public function store(Request $request, Project $project)
{
$email = $request->input('email');
$user = User::Where('email', $email)->first();
if (!$user) {
// Should send an invitation to join the project team
// The new user must register him self to access the app
// For now, only an empty response is sent instead
return;
}
$project->team()->detach($user);
// to prevent multiple assignments
$project->team()->attach($user);
return $user;
}
示例4: handleProviderCallback
public function handleProviderCallback()
{
$user = Socialite::driver('facebook')->user();
$userSudahAda = \App\User::Where('idsocial', $user->getId())->first();
if ($userSudahAda) {
\Auth::login($userSudahAda);
} else {
$newUser = new \App\User();
$newUser->idsocial = $user->getId();
$newUser->name = $user->getName();
$newUser->profile_picture = $user->getAvatar();
$newUser->email = $user->getEmail();
$newUser->save();
\Auth::login($newUser);
}
return redirect('home');
}
示例5: postAddTeacher
public function postAddTeacher()
{
//Moin
//Teacher Registration post Function For Admin
$email = Input::get('email');
$userc = User::Where('email', '=', $email)->count();
$marchant = Institute::Where('email', '=', $email)->count();
if ($userc > 0) {
Session::flash('data', 'This Email already used. Please Try a another email.');
return Redirect::to('admin/add/teacher');
} else {
$iid = User::where('uid', '=', Auth::user()->uid)->pluck('institute_id');
$name = Input::get('firstname') . ' ' . Input::get('lastname');
$designation = Input::get('designation');
$dbirth = Input::get('dbirth');
$gender = Input::get('gender');
$religion = Input::get('religion');
$address = Input::get('address');
$national_id = Input::get('nid');
$join_date = Input::get('join_date');
$phone = Input::get('phone');
$username = Input::get('username');
$uid = mt_rand('00000', '99999') . ' ' . $iid;
//$i=Input::get('image');
if (Input::hasFile('image')) {
//return 1;
$extension = Input::file('image')->getClientOriginalExtension();
if ($extension == 'png' || $extension == 'jpg' || $extension == 'jpeg' || $extension == 'bmp' || $extension == 'PNG' || $extension == 'jpg' || $extension == 'JPEG' || $extension == 'BMP') {
$date = date('dmyhsu');
$fname = $date . '.' . $extension;
$destinationPath = 'images/';
Input::file('image')->move($destinationPath, $fname);
$final = $fname;
}
} else {
$final = '';
}
$tu = new User();
$tu->name = $name;
$tu->uid = $uid;
$tu->user_name = $username;
$tu->user_type = 'Teacher';
$tu->priv = 4;
$tu->email = $email;
$tu->password = Hash::make(Input::get('confirm_password'));
$tu->institute_id = $iid;
$tu->save();
$ut = new Teacher();
$ut->institute_code = $iid;
$ut->teacher_id = $uid;
$ut->name = $name;
$ut->designation = $designation;
$ut->birth_date = $dbirth;
$ut->gender = $gender;
$ut->religion = $religion;
$ut->email = $email;
$ut->phone = $phone;
$ut->address = $address;
$ut->join_date = $join_date;
$ut->national_id = $national_id;
$ut->user_name = $username;
$ut->image = $final;
$ut->password = Hash::make(Input::get('confirm_password'));
$ut->user_type = 'Teacher';
$ut->save();
Session::flash('data', 'Data successfully added !');
return Redirect::to('admin/add/teacher');
}
}
示例6: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id, $franchiseId)
{
//
$registered_resturant = Resturant::Where('id', '=', $id)->firstOrFail();
$subscription = SubscriptionPlan::Where('id', '=', $registered_resturant->subscription_plan_id)->firstOrFail();
$franchise_users = User::Where('franchise_id', '=', $franchiseId)->count();
$all_users = User::Where('resturant_id', '=', $id)->where('franchise_id', '!=', -1)->count();
$request_data = $request->input('request');
$request_array = json_decode($request_data, true);
$Location_users = $request_array['users'];
$effective_users = $all_users - $franchise_users + sizeof($Location_users);
if ($effective_users > $subscription->user) {
return response()->json(["Response" => "error", "message" => "You Subscription plan doesn't allow more users"]);
} else {
$franchise = Franchise::Where('id', '=', $franchiseId)->firstOrFail();
$parsed_object = $request_array['Franchise'];
$franchise->location_id = $parsed_object['location_id'];
$franchise->address = $parsed_object['address'];
$franchise->phone = $parsed_object['phone'];
$franchise->name = $parsed_object['name'];
$franchise->save();
$rules = array('email' => 'unique:users,username');
foreach ($Location_users as $users) {
$name = $users['username'];
$validator = \Validator::make(array('email' => $name), $rules);
if ($validator->fails()) {
return response()->json(["Response" => "error", "message" => 'Email Address : ' . $name . ' is Already Registered in our system.']);
}
}
foreach ($Location_users as $users) {
$isnew = array_get($users, 'isnew', 'default');
if ($isnew != 'default') {
$user = new User();
$name = $users['username'];
$password = $user['password'];
$user->username = $name;
$hashed_password = Hash::make($password);
$user->password = $hashed_password;
$user->resturant_id = $id;
$user->franchise_id = $franchiseId;
$user->role_id = 2;
$user->active = 0;
$user->activation_token = str_random(32);
\Event::fire(new registrationEmail($user));
$user->save();
} else {
$name = $users['username'];
$password = $users['password'];
$userId = $users['id'];
$user = User::Where('id', '=', $userId)->firstOrFail();
$user->username = $name;
if ($user->password != $password) {
$hashed_password = Hash::make($password);
$user->password = $password;
}
$user->save();
}
}
$franchise_Users = User::Where('franchise_id', '=', $franchiseId)->get();
foreach ($franchise_Users as $franchiseUsers) {
$franchiseUserId = $franchiseUsers->id;
$tobeDeleted = true;
foreach ($Location_users as $locationUsers) {
$isnew = array_get($locationUsers, 'isnew', 'default');
if ($isnew == 'default') {
if ($locationUsers['id'] == $franchiseUserId) {
$tobeDeleted = false;
break;
}
} else {
$tobeDeleted = false;
}
}
if ($tobeDeleted) {
User::where('id', '=', $franchiseUserId)->delete();
}
}
return response()->json(["Response" => "success", "message" => "Franchise info Updated"]);
}
return response()->json(["Response" => "error", "message" => "There was an error processing your request"]);
}
示例7: getUserPage
public function getUserPage($slug)
{
$user = \App\User::Where('slug', '=', $slug)->first();
return view('user-profile')->with(['user' => $user]);
}
示例8: deleteUser
public function deleteUser($id)
{
UserAction::Where('user_id', '=', $id)->delete();
UserLocation::Where('user_id', '=', $id)->delete();
User::Where('id', '=', $id)->delete();
return response()->json(["Response" => "success", "message" => "User Deleted"]);
}
示例9: getDebtors
public static function getDebtors()
{
$debtorsCount = User::Where('balance', '>', 0)->count();
return $debtorsCount;
}