当前位置: 首页>>代码示例>>PHP>>正文


PHP models\Person类代码示例

本文整理汇总了PHP中app\models\Person的典型用法代码示例。如果您正苦于以下问题:PHP Person类的具体用法?PHP Person怎么用?PHP Person使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Person类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 public function store(CreateCompanyRequest $request)
 {
     $company = Company::create($request->all());
     if (!Input::get('person_id')) {
         $person = new Person();
         $person->first_name = Input::get('person_fn');
         $person->last_name = Input::get('person_ln');
         $person->save();
     }
     $contact = new CompanyPerson();
     $contact->company_id = $company->id;
     $contact->person_id = Input::get('person_id') ? Input::get('person_id') : $person->id;
     $contact->title_id = Input::get('title_id');
     $contact->department_id = Input::get('department_id');
     $contact->phone = Input::get('phone');
     $contact->extension = Input::get('extension');
     $contact->cellphone = Input::get('cellphone');
     $contact->email = Input::get('email');
     $contact->group_type_id = Input::get('company_id') == ELETTRIC80_COMPANY_ID ? EMPLOYEE_GROUP_TYPE_ID : CUSTOMER_GROUP_TYPE_ID;
     $contact->group_id = Input::get('company_id') == ELETTRIC80_COMPANY_ID ? DEFAULT_EMPLOYEE_GROUP_ID : DEFAULT_CUSTOMER_GROUP_ID;
     $contact->save();
     $company_main_contact = new CompanyMainContact();
     $company_main_contact->company_id = $company->id;
     $company_main_contact->main_contact_id = $contact->id;
     $company_main_contact->save();
     $company_account_manager = new CompanyAccountManager();
     $company_account_manager->company_id = $company->id;
     $company_account_manager->account_manager_id = Input::get('account_manager_id');
     $company_account_manager->save();
     return redirect()->route('companies.index')->with('successes', ['company created successfully']);
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:31,代码来源:CompaniesController.php

示例2: 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.'));
     }
 }
开发者ID:weopendata,项目名称:medea,代码行数:32,代码来源:AuthController.php

示例3: actionCreate

 /**
  * Creates a new SocialServiceManager model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SocialServiceManager();
     if ($model->load(Yii::$app->request->post())) {
         $person = new Person();
         $person->name = $model->name;
         $person->lastname = $model->last_name;
         $person->phone = $model->phone;
         $person->save(false);
         $user = new User();
         $user->username = $model->username;
         $user->password = $model->password;
         $user->email = $model->email;
         $user->person_id = $person->id;
         $user->scenario = 'register';
         if ($user->validate(['username', 'password'])) {
             $user->register();
             $model->user_id = $user->id;
             $model->save(false);
             //assign the role to the user
             $authManager = Yii::$app->getAuthManager();
             $socialServiceMRole = $authManager->getRole('socialServiceManager');
             $authManager->assign($socialServiceMRole, $user->id);
             //set the success message
             Yii::$app->getSession()->setFlash('success', 'Usuario creado con éxito');
             return $this->redirect(['view', 'id' => $model->id]);
         } else {
             $model->addErrors($user->errors);
         }
     }
     return $this->render('create', ['model' => $model]);
 }
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:37,代码来源:SocialServiceManagerController.php

示例4: actionProjectManagerRequest

 /**
  * @return string|\yii\web\Response
  * @throws \yii\base\Exception
  */
 public function actionProjectManagerRequest()
 {
     $projectManager = new ProjectManager();
     $user = new User();
     $person = new Person();
     if (Yii::$app->request->post()) {
         $params = Yii::$app->request->post();
         $person->load($params);
         $user->load($params);
         $projectManager->load($params);
         if ($person->validate() && $user->validate() && $projectManager->validate()) {
             $user->password_hash = Yii::$app->getSecurity()->generatePasswordHash($params['User']['password_hash']);
             $person->save(false);
             $user->person_id = $person->id;
             $user->register();
             $projectManager->user_id = $user->id;
             $projectManager->save();
             Yii::$app->session->setFlash('success', 'Se envío un correo de confirmación. Por favor verifique su correo electrónico');
             return $this->refresh();
         } else {
             Yii::$app->session->setFlash('danger', 'Ocurrió un error al guardar. Vuelve a intentar');
         }
     }
     return $this->render('project-manager-request', ['projectManager' => $projectManager, 'user' => $user, 'person' => $person]);
 }
开发者ID:RomarioLopezC,项目名称:RobotSS,代码行数:29,代码来源:SiteController.php

示例5: create

 public function create($inputs)
 {
     $person = new Person();
     $person->name = $inputs['name'];
     $person->surname = $inputs['surname'];
     $person->birthdate = $inputs['birthdate'];
     $person->save();
 }
开发者ID:morawcik,项目名称:app,代码行数:8,代码来源:PersonRepository.php

示例6: actionPerson

 public function actionPerson()
 {
     $model = new Person();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate()) {
             // form inputs are valid, do something here
             return;
         }
     }
     return $this->render('person', ['model' => $model]);
 }
开发者ID:unix-admin,项目名称:profitday,代码行数:11,代码来源:SiteController.php

示例7: 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');
 }
开发者ID:weopendata,项目名称:medea,代码行数:17,代码来源:RegistrationController.php

示例8: fillForUser

 public function fillForUser(Person $user)
 {
     $this->durations = [];
     $this->workTypes = [];
     $this->courses = [];
     foreach ($user->getWorkPreferences() as $workPref) {
         $this->workTypes[] = $workPref["id"];
     }
     foreach ($user->getPeriodPreferences() as $periodPref) {
         $this->durations[] = $periodPref["id"];
     }
     foreach ($user->getCoursePreferences() as $coursePref) {
         $this->courses[] = $coursePref["id"];
     }
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:15,代码来源:Preferences.php

示例9: 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.");
 }
开发者ID:weopendata,项目名称:medea,代码行数:15,代码来源:DataManagement.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make(Request::all(), ['name' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator->errors());
     } else {
         try {
             $person = new Person();
             $person->name = Input::get('name');
             $person->last_name = Input::get('last_name');
             $person->document = Input::get('document') == '' ? null : Input::get('document');
             $person->identity = Input::get('identity') == '' ? null : Input::get('identity');
             $person->email = Input::get('email') == '' ? null : Input::get('email');
             $person->birthdate = Input::get('birthdate');
             $person->nationality = Input::get('nationality');
             $person->gender = Input::get('gender');
             $person->phone = Input::get('phone');
             $person->phone_cel = Input::get('phone_cel');
             $person->name = Input::get('name');
             $person->name = Input::get('name');
             $person->save();
             $member = new Member();
             $member->father = Input::get('father');
             $member->mother = Input::get('mother');
             $member->marital_status_id = Input::get('marital_status_id');
             $member->date_baptism = Input::get('date_baptism');
             $member->occupacion = Input::get('occupacion');
             $member->function_id = Input::get('function_id');
             $member->literacy_id = Input::get('literacy_id');
             $member->person_id = $person->id;
             $member->save();
             $address = new Address();
             $address->address = Input::get('address');
             $address->number = Input::get('number');
             $address->complement = Input::get('complement');
             $address->zip_code = Input::get('zip_code');
             $address->reference = Input::get('reference');
             $address->country = Input::get('country');
             $address->state = Input::get('state');
             $address->city = Input::get('city');
             $address->person_id = $person->id;
             $address->save();
             return redirect('members');
         } catch (\Illuminate\Database\QueryException $e) {
             print_r($e->errorInfo);
         }
     }
 }
开发者ID:igormoura,项目名称:ecclesia,代码行数:54,代码来源:MemberController.php

示例11: actionIncoming

 public function actionIncoming($id)
 {
     $user_id = NULL;
     $from = Yii::$app->request->post('From');
     $body = Yii::$app->request->post('Body');
     // Lookup user based on a few different methods
     // First, check with basic number with +1 removed
     $number = str_replace('+1', '', $from);
     $person = Person::find()->where(['phone' => $number])->one();
     // If no results, add hyphens
     if (!$person) {
         $formatted_number = preg_replace("/^(\\d{3})(\\d{3})(\\d{4})\$/", "\$1-\$2-\$3", $number);
         $person = Person::find()->where(['phone' => $formatted_number])->one();
     }
     if ($person) {
         $user_id = $person->id;
     }
     if ($from) {
         $message = new Message();
         $message->message = $body;
         $message->project_id = $id;
         $message->time = time();
         $message->user_id = $user_id;
         $message->status = 2;
         $message->type = 'text';
         $message->number = $from;
         $message->save();
     }
 }
开发者ID:jcshep,项目名称:FrontRunner,代码行数:29,代码来源:MessageController.php

示例12: show

 public function show($personId)
 {
     $person = Person::find($personId);
     $tree = $person->buildRelationsTree();
     JavaScript::put(['gentree' => $tree, 'currentElementId' => $personId]);
     return view('person.gentree.show');
 }
开发者ID:sabahtalateh,项目名称:familyeditor,代码行数:7,代码来源:PersonGenTreeController.php

示例13: all

 public function all($params)
 {
     $params['order'] = isset($params['order']) ? $params['order'] : ['last_name|ASC', 'first_name|ASC'];
     $users = Person::select("people.*");
     $users = parent::execute($users, $params);
     return $users;
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:7,代码来源:PeopleController.php

示例14: actionView

 public function actionView()
 {
     $id = \Yii::$app->getRequest()->get()['match'];
     $vacancy = \Yii::$app->getRequest()->get()['vacancy'];
     $person = Person::findOne($id);
     return $this->render("view", ["person" => $person]);
 }
开发者ID:janwillemm,项目名称:sa-matcher,代码行数:7,代码来源:MatchController.php

示例15: listFiles

 public function listFiles($target, $target_action, $target_id)
 {
     $resource_type = 'App\\Models\\' . ucfirst(str_singular($target));
     $uploader_id = Auth::user()->active_contact->id;
     if ($target == "posts") {
         if ($target_action == "create") {
             $post = Post::where('author_id', $uploader_id)->where("status_id", "=", POST_DRAFT_STATUS_ID)->where("ticket_id", $target_id)->first();
         } elseif ($target_action == "edit") {
             $post = Post::where("id", $target_id)->first();
         }
         $id = isset($post->id) ? $post->id : null;
     } elseif ($target == "tickets") {
         if ($target_action == "create") {
             $ticket = Ticket::where('status_id', TICKET_DRAFT_STATUS_ID)->where('creator_id', $uploader_id)->first();
         } else {
             $ticket = Ticket::where("id", $target_id)->first();
         }
         $id = isset($ticket->id) ? $ticket->id : null;
     } elseif ($target == "people") {
         $target_id = is_null($target_id) ? Auth::user()->owner->id : $target_id;
         $person = Person::find($target_id);
         $id = $person->id;
     }
     $files = is_null($id) ? [] : File::where('resource_type', $resource_type)->where("resource_id", $id)->get();
     foreach ($files as $file) {
         $file->size = filesize(RESOURCES . DS . $file->file_path . DS . $file->file_name);
     }
     return $files;
 }
开发者ID:pinkynrg,项目名称:convergence2.0,代码行数:29,代码来源:FilesController.php


注:本文中的app\models\Person类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。