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


PHP Student::create方法代码示例

本文整理汇总了PHP中app\models\Student::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::create方法的具体用法?PHP Student::create怎么用?PHP Student::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Student的用法示例。


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::truncate();
     Staff::truncate();
     Student::truncate();
     StudentNumber::truncate();
     StaffNumber::truncate();
     $user = ['first_name' => 'Jose Antonio', 'last_name' => 'Sinadinse', 'fullname' => '', 'password' => \Hash::make('password'), 'email' => 'toniobarros@hotmail.com', 'address' => 'Pretoria', 'cellnumber' => '000000000', 'user_type_id' => 1, 'state_id' => 1];
     if (StaffNumber::all()->count() == 0) {
         $stfnum = StaffNumber::create(["number" => 2000, "date" => date("Y-m-d")]);
     } else {
         $lateststfnum = StaffNumber::all()->last();
         $stfnum = StaffNumber::create(["number" => $lateststfnum->number + 1, "date" => date("Y-m-d")]);
     }
     $staff = Staff::create(['staff_number' => $stfnum->number]);
     $user = $staff->user()->create($user);
     $user->addPermission('admin');
     for ($i = 3; $i < 20; $i++) {
         $user = ['first_name' => 'Name' . $i, 'last_name' => 'Surname' . $i, 'fullname' => '', 'password' => \Hash::make('aleluia'), 'email' => 'josebarros' . $i . '@hotmail.com', 'address' => 'Pretoria', 'cellnumber' => '00000000' . $i, 'user_type_id' => 3, 'state_id' => 1];
         if (StudentNumber::all()->count() == 0) {
             $stdnum = StudentNumber::create(["number" => 200000000, "date" => date("Y-m-d")]);
         } else {
             $lateststdnum = StudentNumber::all()->last();
             $stdnum = StudentNumber::create(["number" => $lateststdnum->number + 1, "date" => date("Y-m-d")]);
         }
         $student = Student::create(['student_number' => $stdnum->number, "university_id" => 1, "faculty_id" => '', "department_id" => '', "course_id" => '']);
         $user = $student->user()->create($user);
         $user->addPermission('student');
     }
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:35,代码来源:DatabaseSeeder.php

示例2: run

 public function run()
 {
     DB::table('students')->delete();
     Student::create(['student_id' => 'M21132111002', 'batch' => '25', 'department' => 'CSE', 'user_id' => '2']);
     Student::create(['student_id' => 'M21132111009', 'batch' => '27', 'department' => 'BBA', 'user_id' => '3']);
     Student::create(['student_id' => 'M21132111003', 'batch' => '26', 'department' => 'English', 'user_id' => '4']);
 }
开发者ID:Kryptonitesoft,项目名称:quizapp,代码行数:7,代码来源:StudentTableSeeder.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(StudentsRequest $request)
 {
     $user = ['first_name' => $request->input('first_name'), 'last_name' => $request->input('last_name'), 'fullname' => '', 'password' => '0000', 'email' => $request->input('email'), 'address' => $request->input('address'), 'cellnumber' => $request->input('cellnumber'), 'user_type_id' => $request->input('user_type_id'), 'state_id' => 1];
     $student = Student::create(['student_number' => '00000']);
     $user = $student->user()->create($user);
     $user->makeEmployee('student');
     return redirect("/students");
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:13,代码来源:StudentsController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(UsersRequest $request)
 {
     $user = ['first_name' => $request->input('first_name'), 'last_name' => $request->input('last_name'), 'fullname' => '', 'password' => '0000', 'email' => $request->input('email'), 'address' => $request->input('address'), 'cellnumber' => $request->input('cellnumber'), 'user_type_id' => $request->input('user_type_id'), 'state_id' => 1];
     if ($request->input("user_type_id") === "1") {
         $student = Staff::create(['staff_number' => '00000']);
         $user = $student->user()->create($user);
         $user->makeEmployee('admin');
     } else {
         if ($request->input("user_type_id") === "2") {
             $student = Staff::create(['staff_number' => '00000']);
             $user = $student->user()->create($user);
             $user->makeEmployee('lecturer');
         } else {
             $student = Student::create(['student_number' => '00000']);
             $user = $student->user()->create($user);
             $user->makeEmployee('student');
         }
     }
     return redirect("/users");
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:25,代码来源:UsersController.php

示例5: saveUser

 /**
  * Add contact to wordpress newsletter
  * @param ContactEvent $event
  * @param $newsletter string
  * @param $name string
  * @param $email string
  */
 private function saveUser(ContactEvent $event, $newsletter, $name, $email)
 {
     if ($newsletter != 'newsletter') {
         return;
     }
     $this->name_split($name);
     $this->addEmailToList($email, $name);
     if (Student::isStudent($name, $email)) {
         return;
     }
     $newsletter_class = Student::create($event->getRequest()->all());
     $newsletter_class->status = 'C';
     $newsletter_class->save();
 }
开发者ID:kevinslondon,项目名称:Yogaground,代码行数:21,代码来源:ContactListener.php

示例6: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return DB::transaction(function () use($data) {
         $data['status'] = "WAITING_APPROVAL";
         $data['password'] = bcrypt($data['password']);
         $user = new User();
         $user = User::create($data);
         if (isset($data['avatar'])) {
             $imageName = time() . '.' . $data['avatar']->getClientOriginalExtension();
             $location = 'uploads/avatar/' . str_slug($user->name) . '/';
             $data['avatar']->move($location, $imageName);
             $user->avatar = url($location . $imageName);
         } else {
             if ($data['gender'] == "F") {
                 $user->avatar = url('uploads/avatar/defaultLady.jpg');
             } else {
                 $user->avatar = url('uploads/avatar/defaultMale.jpg');
             }
         }
         $user->save();
         $data['user_id'] = $user->id;
         switch ($data['UsertypeName']) {
             case 'Student':
                 Student::create($data);
                 break;
             case 'Parent':
                 ParentModel::create($data);
                 break;
             case 'Staff':
                 Staff::create($data);
                 break;
             default:
                 Foundation::create($data);
                 break;
         }
         return $user;
     });
 }
开发者ID:razikallayi,项目名称:peaceschools,代码行数:44,代码来源:AuthController.php

示例7: create

 protected function create(array $data)
 {
     $user = User::create(['name' => $data['name'], 'username' => $data['username'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'role' => 'student']);
     Student::create(['user_id' => $user->id]);
     return $user;
 }
开发者ID:Kryptonitesoft,项目名称:quizapp,代码行数:6,代码来源:AuthController.php

示例8: create

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return Student
  */
 protected function create(array $data)
 {
     return Student::create(['firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'gender' => $data['gender'], 'group' => $data['group'], 'phone' => $data['phone'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
开发者ID:lyovkin,项目名称:students,代码行数:10,代码来源:AuthController.php

示例9: store

 /**
  * Stores Student into database
  *
  * @param array $input
  *
  * @return Student
  */
 public function store($input)
 {
     return Student::create($input);
 }
开发者ID:amandiotsungo,项目名称:ExameNormal,代码行数:11,代码来源:StudentRepository.php

示例10: store

 public function store(StudentRequest $request)
 {
     Student::create($request->all());
 }
开发者ID:Kryptonitesoft,项目名称:quizapp,代码行数:4,代码来源:StudentController.php


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