本文整理汇总了PHP中app\models\Profile::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::where方法的具体用法?PHP Profile::where怎么用?PHP Profile::where使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Profile
的用法示例。
在下文中一共展示了Profile::where方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Profile $childprofile)
{
if (!empty($parentId = Auth::user()->parent_user)) {
$this->profiles = $childprofile->where('parent_id', '=', $parentId)->orWhere('parent_id', '=', Auth::user()->id)->get();
} else {
$this->profiles = $childprofile->where('parent_id', '=', Auth::user()->id)->get();
}
return view('profile.index', array('profile' => $this->profiles, 'image_path' => $this->imagePath));
}
示例2: findByUserId
public function findByUserId($userId)
{
$profile = Profile::where('user_id', $userId)->first();
if ($profile) {
return $profile;
} else {
$this->throwStoreResourceFailedException();
}
}
示例3: index
public function index()
{
//$user = User::find(11);
//Auth::login($user);
$formData = Auth::user();
$id = Auth::user()->id;
$profile = Profile::where("user_id", '=', $id)->first();
$view_data = ['title' => "My Profile", 'user' => $formData, 'profileData' => $profile];
return view('profile/myprofile', $view_data);
}
示例4: update
/**
* Update user profile
*
* @POST("profile/{id}/update", as="profile.update")
* @param Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function update(Request $request)
{
$user = User::where('id', $request->input('id'))->first();
$user->fill($request->all());
$user->update();
$profile = Profile::where('user_id', $request->input('id'))->first();
$profile->fill($request->all());
$profile->user()->associate($user);
$profile->update();
return redirect('/profile');
}
示例5: index
public function index()
{
$profiles = ProfileModel::where('name', 'andi')->get();
return view('profile', ['name' => $profiles]);
}
示例6: isFirstLogin
public function isFirstLogin($email)
{
$user = $this->loadUser($email);
$profile = Profile::where('user_id', '=', $user->id)->first();
return is_null($profile);
}
示例7: compose
public function compose(View $view)
{
$data = Profile::where('user_id', Auth::user()->id)->first();
$view->with('data', $data);
}
示例8: complete
/**
* Update profile of newly registered user
*
* @param Request $request
* @return Response
*/
public function complete(Request $request)
{
//$user = User::find(1);
//Auth::login($user);
if ($request->isMethod('post')) {
$formData = $request->all();
$user = Auth::user();
$id = Auth::user()->id;
$profile = Profile::where("user_id", '=', $id)->first();
if ($profile['origin'] == "vk" && empty($user->vk_email)) {
$rules = array('email' => 'required|max:50|unique:users,email,' . $id, 'name' => 'required|max:50');
$user->vk_email = $request->get('email');
} else {
$rules = array('name' => 'required|max:50');
}
$validator = Validator::make($formData, $rules);
if ($validator->fails()) {
return Redirect::to('/login/complete')->withInput()->withErrors($validator);
}
// $formData['email'] = Auth::user()->email;
// need server side validation before it goes to db
$user->name = trim($request->get('name'));
$user->save();
$eve_api_key = $request->get('eve_api_key');
$eve_user_id = $request->get('eve_user_id');
$i = 0;
foreach ($eve_user_id as $key => $value) {
$Apikey = new Apikey();
if (empty($value) || empty($eve_api_key[$key])) {
continue;
}
$row_id = Apikey::where('apikey', $value)->where("uid", "=", $user->id)->first();
if (!empty($row_id)) {
$row = $row_id;
} else {
$row = $Apikey;
}
$row->uid = $user->id;
$row->apikey = $value;
$row->vkey = $eve_api_key[$key];
//$row->save();
$i++;
}
/*if($i==0){
Session::flash('error_message', 'Username or password is incorrect');
return redirect("/login/complete") ;
}else{
Session::flash('error_message', 'Username or password is incorrect');
}*/
return redirect('/')->withMessage("Profile Updated");
}
$formData = Auth::user();
$id = $formData->id;
$api_keys = User::find($id)->apikeys;
$profile = Profile::where("user_id", '=', $id)->first();
$view_data = ['title' => "Complete your profile", 'form_data' => $formData, 'apikey' => $api_keys, 'profileData' => $profile];
return view('login/complete', $view_data);
}