Esempio n. 1
0
 /**
  * Handle data that was POSTed to the register page
  */
 public static function postRegister()
 {
     /*
      * Construct a Validator object to verify the input is correct
      * Validation is designed to be extensible, with objects defined for a 
      * specific type of field, rather than one validation object trying to handle
      * every type of field.
      */
     $validator = new Validator(INPUT_POST, ['email' => 'Email', 'password' => 'Password', 'name' => 'Text', 'dob' => 'Date']);
     // Run the validation
     $result = $validator->run();
     if (!$result) {
         // Validation failed, show the registration page with errors
         Flight::render('register', ['errors' => $validator->getErrors()], 'body_content');
         Flight::render('layout/layout');
     } else {
         // Success, get the valid data back from the validator object
         $content = $validator->getFields();
         // Create a new user object
         $user = new User();
         $user->name = $content['name'];
         $user->email = $content['email'];
         $user->password = $content['password'];
         $user->dob = $content['dob'];
         // Save the user data
         $user->save();
         // Redirect to thank you page
         Flight::redirect('/thanks');
     }
 }
Esempio n. 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $user_id = \Register\User::where('name', '=', 'Jill')->pluck('id');
     DB::table('items')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'school' => 'Sunshine Dance', 'name' => 'Dance Medley', 'type' => 'Dance', 'participant_count' => 2, 'audition_link' => 'http://www.example.com', 'user_id' => $user_id, 'description' => 'Medley of dances', 'status' => 'Incomplete', 'special_notes' => 'Need floor mikes']);
     DB::table('items')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'school' => 'Lidman music school', 'name' => 'String quartets rock!', 'type' => 'Music', 'participant_count' => 4, 'audition_link' => 'http://www.example.com', 'user_id' => $user_id, 'description' => '2 violins, cello and a guitar', 'status' => 'Incomplete', 'special_notes' => 'Need 4 mikes']);
     $user_id = \Register\User::where('name', '=', 'Jamal')->pluck('id');
     DB::table('items')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'school' => "Violets violas", 'name' => 'String quartet', 'type' => 'Music', 'participant_count' => 4, 'audition_link' => 'http://www.example.com', 'user_id' => $user_id, 'description' => 'Violins and Cellos', 'status' => 'Incomplete', 'special_notes' => 'Need standing mikes']);
     DB::table('items')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'school' => "Concord Academy", 'name' => 'Shakespeare', 'type' => 'Skit', 'participant_count' => 6, 'audition_link' => 'http://www.example.com', 'user_id' => $user_id, 'description' => 'Spoof on shakespearean characters', 'status' => 'Incomplete', 'special_notes' => 'Need 2 tables and 4 chairs']);
 }
Esempio n. 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $user = \Register\User::firstOrCreate(['email' => '*****@*****.**']);
     $user->name = 'Jill';
     $user->email = '*****@*****.**';
     $user->password = \Hash::make('helloworld');
     $user->save();
     $user = \Register\User::firstOrCreate(['email' => '*****@*****.**']);
     $user->name = 'Jamal';
     $user->email = '*****@*****.**';
     $user->password = \Hash::make('helloworld');
     $user->save();
     //
     $user = \Register\User::firstOrCreate(['email' => '*****@*****.**']);
     $user->name = 'Jessica';
     $user->email = '*****@*****.**';
     $user->password = \Hash::make('helloworld');
     $user->role = 'Organizer';
     $user->save();
 }
Esempio n. 4
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }