本文整理汇总了PHP中app\models\Person::setNode方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::setNode方法的具体用法?PHP Person::setNode怎么用?PHP Person::setNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Person
的用法示例。
在下文中一共展示了Person::setNode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login(Request $request)
{
if (!empty($request->input('email'))) {
$email = $request->input('email');
$password = $request->input('password');
$user_node = $this->users->getUser($email);
// Create the Person model
$user = new Person();
$user->setNode($user_node);
if (!empty($user_node)) {
// Check password and verification
if (!$user->verified) {
$message_bag = new MessageBag();
return redirect()->back()->with('errors', $message_bag->add('email', 'Dit emailadres is nog niet geverifieerd.'));
} elseif (Hash::check($password, $user->password)) {
Auth::login($user);
// Register the event to Piwik
$this->registerPiwikEvent($user->email, 'Login');
return redirect($this->redirectTo);
} else {
$message_bag = new MessageBag();
return redirect()->back()->with('errors', $message_bag->add('password', 'Het wachtwoord is incorrect.'));
}
} else {
$message_bag = new MessageBag();
return redirect()->back()->with('errors', $message_bag->add('email', 'Het emailadres werd niet gevonden.'));
}
} else {
$message_bag = new MessageBag();
return redirect()->back()->with('errors', $message_bag->add('email', 'Het emailadres werd niet gevonden.'));
}
}
示例2: denyRegistration
/**
* Deny a user's registration
*
* @param string $token
* @return mixed
*/
public function denyRegistration($token, AppMailer $mailer)
{
$user = $this->users->denyUser($token);
if (!empty($user)) {
$person = new Person();
$person->setNode($user);
// Send an email to the user that his email has been confirmed
$mailer->sendRegistrationDenial($person);
}
return redirect('/persons');
}
示例3: removeAllUsers
private function removeAllUsers()
{
$count = 0;
$userNodes = $this->users->getAll();
$bar = $this->output->createProgressBar(count($userNodes));
foreach ($userNodes as $userNode) {
$person = new Person();
$person->setNode($userNode);
$person->delete();
$bar->advance();
$count++;
}
$this->info("");
$this->info("Removed {$count} Person nodes.");
}
示例4: retrieveByCredentials
/**
* Retrieve a user by the given credentials.
*
* @param array $credentials
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
public function retrieveByCredentials(array $credentials)
{
$users = $this->person_label->getNodes('email', $user->email);
if ($users->count() > 0) {
$user_node = $users[0];
$person = new Person();
$person->setNode($user_node);
return $person;
}
return user;
}
示例5: userSettings
/**
* Administrator can view settings of a certain user
*
* @param integer $userId
* @param Request $request
*
* @return
*/
public function userSettings($userId, Request $request)
{
if (empty($request->user()) || !$request->user()->hasRole('administrator')) {
return redirect('/');
}
$user = $this->users->getById($userId);
if (empty($user)) {
abort(404);
}
// The person to view the profile of
$person = new Person();
$person->setNode($user);
$fullUser = $user->getProperties();
unset($fullUser['created_at']);
unset($fullUser['MEDEA_UUID']);
unset($fullUser['password']);
unset($fullUser['remember_token']);
unset($fullUser['token']);
unset($fullUser['updated_at']);
unset($fullUser['verified']);
$fullUser['id'] = $userId;
return view('pages.settings', ['accessLevels' => $this->getProfileAccessLevels(), 'roles' => $person->getRoles(), 'user' => $fullUser]);
}
示例6: show
/**
* Display the specified resource.
*
* @param ShowFindRequest $request
*
* @return \Illuminate\Http\Response
*/
public function show(ShowFindRequest $request)
{
$find = $request->getFind();
// If the user is not owner of the find and not a researcher, obscure the location to 1km accuracy
if (empty($user) || !empty($find['person']['identifier']) && $find['person']['identifier'] != $user->id && !in_array('onderzoeker', $user->getRoles())) {
if (!empty($find['findSpot']['location']['lat'])) {
$find['findSpot']['location']['lat'] = round($find['findSpot']['location']['lat'] / 2, 2) * 2;
$find['findSpot']['location']['lng'] = round($find['findSpot']['location']['lng'] / 2, 2) * 2;
}
}
$users = new UserRepository();
// Check if the user of the find allows their name to be displayed on the find details
$findUser = $users->getById($find['person']['identifier']);
$publicUserInfo = [];
if (!empty($findUser)) {
$person = new Person();
$person->setNode($findUser);
if ($person->showNameOnPublicFinds) {
$publicUserInfo['name'] = $person->lastName . ' ' . $person->firstName;
}
// Should there be a link to the profile page
if ($person->profileAccessLevel == 4 || !empty($request->user()) && ($request->user()->id == $person->id || $request->user()->hasRole($person->getProfileAllowedRoles()))) {
$publicUserInfo['id'] = $person->id;
}
}
return view('pages.finds-detail', ['fields' => $this->list_values->getFindTemplate(), 'find' => $find, 'publicUserInfo' => $publicUserInfo]);
}
示例7: getAllWithRoles
/**
* Get all the bare nodes of a findEvent
*
* @param integer $limit
* @param integer $offset
*
* @return array
*/
public function getAllWithRoles()
{
$client = $this->getClient();
$findLabel = $client->makeLabel($this->label);
$findNodes = $findLabel->getNodes();
$data = [];
foreach ($findNodes as $findNode) {
$person = new Person();
$person->setNode($findNode);
$personData = array_only($findNode->getProperties(), ['firstName', 'lastName', 'verified']);
$personData['id'] = $findNode->getId();
$personData['personType'] = $person->getRoles();
$data[] = $personData;
}
return $data;
}
示例8: resetPassword
/**
* Reset the given user's password.
*
* @param Node $user
* @param string $password
* @return void
*/
protected function resetPassword($user, $password)
{
$person = new Person();
$person->setNode($user);
$person->setPassword($password);
$person->setPasswordResetToken('');
Auth::guard($this->getGuard())->login($person);
}